변경 파일 목록
총 34개
Admin (3)
layer_company_certification_setting.phpmember/member_joinitem.phpmember/_member_view_business.phpmember/Component (7)
CompanyCertification.phpMember/Company/MemberAdmin.phpMember/MemberDAO.phpMember/Member.phpMember/MemberVO.phpMember/MyPage.phpMember/JoinItemPolicy.phpPolicy/Controller (9)
CompanyCertificationPsController.phpAdmin/Member/LayerCompanyCertificationSettingController.phpAdmin/Member/MemberJoinitemController.phpAdmin/Member/MemberModifyController.phpAdmin/Member/MemberRegisterController.phpAdmin/Member/MemberCrmDetailController.phpAdmin/Share/JoinController.phpFront/Member/MyPageController.phpFront/Mypage/JoinController.phpMobile/Member/Enum (1)
DocumentType.phpMember/Company/Repository (1)
CompanyCertificationRepository.phpMember/data (12)
gd_member2.jsskin/front/moment/js/_join_view_business.htmlskin/front/moment/member/gd_member2.jsskin/front/mygreek/js/_join_view_business.htmlskin/front/mygreek/member/member.cssskin/mobile/moment/css/member/gd_member2.jsskin/mobile/moment/js/_join_view_business.htmlskin/mobile/moment/member/my_page.htmlskin/mobile/moment/mypage/member.cssskin/mobile/mygreek/css/member/gd_member2.jsskin/mobile/mygreek/js/_join_view_business.htmlskin/mobile/mygreek/member/my_page.htmlskin/mobile/mygreek/mypage/변경 파일 코드
추가삭제
변경 전layer_company_certification_setting.php
| } | |
| // 부모 폼의 certificationFileSize 값 입력 | |
| window.parent.$('#certificationFileSize').val(inputSize); | |
| $.ajax({ | |
| url: '../member/company_certification_ps.php', | |
| type: 'POST', | |
| data: { mode: 'setting', fileSize: inputSize }, | |
| success: function(res) { | |
| if(res.result) { | |
| dialog_alert('설정이 저장되었습니다.'); | |
| } | |
| // 부모 폼의 certificationFileSize 값 입력 | |
| window.parent.$('#certificationFileSize').val(inputSize); | |
| $.ajax({ | |
| url: '../member/company_certification_ps.php', | |
| type: 'POST', | |
| data: { mode: 'setting', fileSize: inputSize }, | |
| success: function(res) { | |
| if(res.result) { | |
| dialog_alert('설정이 저장되었습니다.'); | |
변경 후layer_company_certification_setting.php
| } | |
| // 부모 폼의 certificationFileSize 값 입력 | |
| var key = '<?= $key ?>'; | |
| var matched = key.match(/^comAddiCert(\d+)$/); | |
| if (matched) { | |
| // 추가 첨부 항목인 경우: comAddiCert[index][certificationFileSize] 변경 | |
| var index = matched[1]; | |
| $('input[name="comAddiCert[' + index + '][certificationFileSize]"]', window.parent.document).val(inputSize); | |
| } else { | |
| // 사업자등록증인 경우 | |
| $('#certificationFileSize', window.parent.document).val(inputSize); | |
| } | |
| $.ajax({ | |
| url: '../member/company_certification_ps.php', | |
| type: 'POST', | |
| data: { | |
| mode: 'setting', | |
| fileSize: inputSize, | |
| key : '<?= $key ?>' | |
| }, | |
| success: function(res) { | |
| if(res.result) { | |
| dialog_alert('설정이 저장되었습니다.'); | |
| } | |
| // 부모 폼의 certificationFileSize 값 입력 | |
| var key = '<?= $key ?>'; | |
| var matched = key.match(/^comAddiCert(\d+)$/); | |
| if (matched) { | |
| // 추가 첨부 항목인 경우: comAddiCert[index][certificationFileSize] 변경 | |
| var index = matched[1]; | |
| $('input[name="comAddiCert[' + index + '][certificationFileSize]"]', window.parent.document).val(inputSize); | |
| } else { | |
| // 사업자등록증인 경우 | |
| $('#certificationFileSize', window.parent.document).val(inputSize); | |
| } | |
| $.ajax({ | |
| url: '../member/company_certification_ps.php', | |
| type: 'POST', | |
| data: { | |
| mode: 'setting', | |
| fileSize: inputSize, | |
| key : '<?= $key ?>' | |
| }, | |
| success: function(res) { | |
| if(res.result) { | |
| dialog_alert('설정이 저장되었습니다.'); | |
변경 전member_joinitem.php
| <table class="table table-cols div-business"> | |
| <colgroup> | |
| <col class="width-md"/> | |
| <col class="width-xl"/> | |
| <col/> | |
| <col class="width-xs center"/> | |
| </colgroup> | |
| <tr> | |
| <th rowspan="7">사업자회원</th> | |
| <td class="business"> | |
| <label class="checkbox-inline" title="사용여부를 선택해주세요!"> | |
| <input type="checkbox" name="company[use]" class="defaultBusinessInfoUse" value="y"/> | |
| 필수 | |
| </label> | |
| ) | |
| <input type="hidden" name="certificationFileSize" id="certificationFileSize" value="<?= $data['comCertification']['maxSize']?>"/> | |
| <button type="button" class="comCertificationSetting btn btn-gray btn-sm">설정</button> | |
| </td> | |
| <td></td> | |
| </tr> | |
| </table> | |
| <?php } ?> | |
| return pass; | |
| } | |
| $(document).ready(function () { | |
| // 아이디 자리수 체크 | |
| $('input[name*="memId"]:text').on('blur', function() { | |
| able_rquire.call(this); | |
| }); | |
| // 사업자회원 활성화 | |
| var $businessinfo = $('input[name=\'businessinfo[use]\']'); | |
| var $defaultBusinessInfoUse = $('.defaultBusinessInfoUse'); | |
| // 가입항목추가 버튼 | |
| $('.addfield').on('click', add_field); | |
| // 가입항목추가필드 삭제 | |
| $('.delfield').one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| }); | |
| $('#frmSetup').validate({ | |
| submitHandler: function (form) { | |
| if (minMaxRangeValidation('memId') && minMaxRangeValidation('nickNm') && extraValidation()) { | |
| form.submit(); | |
| } | |
| return false; | |
| $('.setup_field', obj).on('click', call_setup_field); | |
| } | |
| /** | |
| * 가입항목추가필드 설정창 호출 | |
| */ | |
| } | |
| } | |
| /** | |
| * 사업자회원 활성화 | |
| */ | |
| <table class="table table-cols div-business"> | |
| <colgroup> | |
| <col class="width-md"/> | |
| <col class="width-xl"/> | |
| <col/> | |
| <col class="width-xs center"/> | |
| </colgroup> | |
| <tr> | |
| <th rowspan="7">사업자회원</th> | |
| <td class="business"> | |
| <label class="checkbox-inline" title="사용여부를 선택해주세요!"> | |
| <input type="checkbox" name="company[use]" class="defaultBusinessInfoUse" value="y"/> | |
| 필수 | |
| </label> | |
| ) | |
| <input type="hidden" name="certificationFileSize" id="certificationFileSize" value="<?= $data['comCertification']['maxSize']?>"/> | |
| <button type="button" class="comCertificationSetting btn btn-gray btn-sm">설정</button> | |
| </td> | |
| <td></td> | |
| </tr> | |
| </table> | |
| <?php } ?> | |
| return pass; | |
| } | |
| $(document).ready(function () { | |
| // 아이디 자리수 체크 | |
| $('input[name*="memId"]:text').on('blur', function() { | |
| able_rquire.call(this); | |
| }); | |
| // 사업자회원 활성화 | |
| var $businessinfo = $('input[name=\'businessinfo[use]\']'); | |
| var $defaultBusinessInfoUse = $('.defaultBusinessInfoUse'); | |
| // 가입항목추가 버튼 | |
| $('.addfield').on('click', add_field); | |
| // 가입항목추가필드 삭제 | |
| $('.delfield').one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| }); | |
| $('#frmSetup').validate({ | |
| submitHandler: function (form) { | |
| if (minMaxRangeValidation('memId') && minMaxRangeValidation('nickNm') && extraValidation()) { | |
| form.submit(); | |
| } | |
| return false; | |
| $('.setup_field', obj).on('click', call_setup_field); | |
| } | |
| /** | |
| * 가입항목추가필드 설정창 호출 | |
| */ | |
| } | |
| } | |
| /** | |
| * 사업자회원 활성화 | |
| */ | |
변경 후member_joinitem.php
| <table class="table table-cols div-business"> | |
| <colgroup> | |
| <col class="width-md"/> | |
| <col class="width-h2xl"/> | |
| <col/> | |
| <col class="width-xs center"/> | |
| </colgroup> | |
| <tr> | |
| <th rowspan="12">사업자회원</th> | |
| <td class="business"> | |
| <label class="checkbox-inline" title="사용여부를 선택해주세요!"> | |
| <input type="checkbox" name="company[use]" class="defaultBusinessInfoUse" value="y"/> | |
| 필수 | |
| </label> | |
| ) | |
| <input type="hidden" name="certificationFileSize" id="certificationFileSize" value="<?= $data['comCertification']['maxSize'] ?>"/> | |
| <button type="button" class="comCertificationSetting btn btn-gray btn-sm">설정</button> | |
| </td> | |
| <td></td> | |
| </tr> | |
| <?php | |
| for ($i = 0; $i < $certificationAdditionalFileCount; $i++) { | |
| // 초기값이 없는 경우에도 첫 번째 row(추가 버튼 보유)는 강제 렌더링 | |
| if ($i !== 0 && !isset($data["comAddiCert$i"])) { | |
| continue; | |
| } | |
| $additionalData = $data["comAddiCert$i"] ?? []; | |
| ?> | |
| <tr> | |
| <td class="business"> | |
| <label class="checkbox-inline" title="사용여부를 선택해주세요!"> | |
| <input type="checkbox" name="comAddiCert[<?= $i ?>][use]" value="y" <?= (($additionalData['use'] ?? '') == 'y') ? 'checked' : '' ?>/> | |
| </label> | |
| <span class="checkbox-inline width40p"> | |
| <input type="text" name="comAddiCert[<?= $i ?>][name]" placeholder="추가 첨부 항목명" class="form-control width100p" value="<?= $additionalData['name'] ?? '' ?>" data-initial-value="<?= $additionalData['name'] ?? '' ?>"/> | |
| </span> | |
| ( | |
| <label class="checkbox-inline" title="필수 사용여부를 선택해주세요!"> | |
| <input value="y" name="comAddiCert[<?= $i ?>][require]" type="checkbox" <?= !empty($additionalData['require']) ? 'checked' : '' ?> /> | |
| 필수 | |
| </label> | |
| ) | |
| <input type="hidden" name="comAddiCert[<?= $i ?>][certificationFileSize]" value="<?= $additionalData['certificationFileSize'] ?? $defaultCertificationFileSize ?>"> | |
| <button type="button" class="comAddfieldSetting btn btn-gray btn-sm">설정</button> | |
| </td> | |
| <td></td> | |
| <td> | |
| <?php if ($i === 0) { ?> | |
| <a class="businessAddfiled btn btn-white btn-icon-plus btn-sm">추가</a> | |
| <?php } else { ?> | |
| <a class="businessDelField btn btn-white btn-icon-minus btn-sm">삭제</a> | |
| <?php } ?> | |
| </td> | |
| </tr> | |
| <?php | |
| } ?> | |
| </table> | |
| <?php } ?> | |
| return pass; | |
| } | |
| /** | |
| * 추가 첨부 항목 use 체크 시 항목명 입력 여부 검증 | |
| */ | |
| function comAddiCertValidation() { | |
| var pass = true; | |
| $('input[name^="comAddiCert"][name$="[use]"]').each(function () { | |
| if ($(this).prop('checked') !== true) { | |
| return true; | |
| } | |
| var $tr = $(this).closest('tr'); | |
| var $nameInput = $tr.find('input[name^="comAddiCert"][name$="[name]"]'); | |
| var nameValue = ($nameInput.val() || '').replace(/^\s+|\s+$/g, ''); | |
| if (nameValue === '') { | |
| BootstrapDialog.alert({ | |
| title: "경고", | |
| message: "추가 첨부의 항목명을 입력해주세요." | |
| }); | |
| $nameInput.focus(); | |
| pass = false; | |
| return false; | |
| } | |
| }); | |
| return pass; | |
| } | |
| $(document).ready(function () { | |
| // 아이디 자리수 체크 | |
| $('input[name*="memId"]:text').on('blur', function() { | |
| able_rquire.call(this); | |
| }); | |
| // 추가 첨부 항목: comAddiCert[N][use]에 따라 같은 row의 comAddiCert[N][require] 활성/비활성 | |
| $('#frmSetup').on('click', 'input[name^="comAddiCert"][name$="[use]"]', able_com_add_file_require); | |
| $('#frmSetup input[name^="comAddiCert"][name$="[use]"]').each(able_com_add_file_require); | |
| // 추가 첨부 항목명 변경 시 확인 모달 (기존 등록값이 있을 때만) | |
| $('#frmSetup').on('change', 'input[name^="comAddiCert"][name$="[name]"]', function () { | |
| var $target = $(this); | |
| var initialValue = $target.attr('data-initial-value') || ''; | |
| var currentValue = $target.val(); | |
| if (initialValue !== '' && initialValue !== currentValue) { | |
| BootstrapDialog.confirm({ | |
| title: "확인", | |
| message: "이미 사용중인 추가 첨부 항목을 변경하시겠습니까? 사용중인 항목이 변경될 경우, 기존 등록된 회원정보 내 항목도 변경됩니다.", | |
| btnCancelLabel: "취소", | |
| btnOkLabel: "변경", | |
| callback: function (result) { | |
| if (!result) { | |
| $target.val(initialValue); | |
| } | |
| } | |
| }); | |
| } | |
| }); | |
| // 사업자회원 활성화 | |
| var $businessinfo = $('input[name=\'businessinfo[use]\']'); | |
| var $defaultBusinessInfoUse = $('.defaultBusinessInfoUse'); | |
| // 가입항목추가 버튼 | |
| $('.addfield').on('click', add_field); | |
| $('.businessAddfiled').on('click', business_add_field) | |
| $('.businessDelField').one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| // 가입항목추가필드 삭제 | |
| $('.delfield').one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| }); | |
| // 추가 첨부 항목 설정 버튼 (동적으로 추가된 row까지 처리되도록 이벤트 위임 사용) | |
| $('#frmSetup').on('click', '.comAddfieldSetting', function () { | |
| var $tr = $(this).closest('tr'); | |
| var nameValue = $tr.find('input[name^="comAddiCert"][name$="[name]"]').val(); | |
| var title = (nameValue ? nameValue + ' ' : '') + '추가 설정'; | |
| // 부모 row의 comAddiCert[N][use] name에서 인덱스 추출 | |
| var useName = $tr.find('input[name^="comAddiCert"][name$="[use]"]').attr('name') || ''; | |
| var matched = useName.match(/comAddiCert\[(\d+)\]/); | |
| var rowIndex = matched ? matched[1] : 0; | |
| $.get('layer_company_certification_setting.php?type=comAddiCert&index=' + rowIndex, function (data) { | |
| layer_popup(data, title, 'normal'); | |
| }); | |
| }); | |
| $('#frmSetup').validate({ | |
| submitHandler: function (form) { | |
| if (minMaxRangeValidation('memId') && minMaxRangeValidation('nickNm') && extraValidation() && comAddiCertValidation()) { | |
| form.submit(); | |
| } | |
| return false; | |
| $('.setup_field', obj).on('click', call_setup_field); | |
| } | |
| function business_add_field(e) { | |
| if ($('.businessDelField').length >= <?= $certificationAdditionalFileCount - 1 ?>) { | |
| alert('사업자회원 추가 항목은 5개까지만 추가할 수 있습니다.'); | |
| return; | |
| } | |
| // 클론 전 시점의 comAddiCert[N][use] 개수가 새 row의 인덱스 | |
| var addFileLength = $('input[name^="comAddiCert"][name$="[use]"]').length; | |
| var obj = $(this).parents('tr').clone(); | |
| obj.find('.businessAddfiled').parents('td').html('<a class="businessDelField btn btn-white btn-icon-minus btn-sm">삭제</a>'); | |
| obj.find('input[name^="comAddiCert"]').each(function () { | |
| this.name = this.name.replace(/comAddiCert\[\d+\]/, 'comAddiCert[' + addFileLength + ']'); | |
| }); | |
| obj.find('input').each(function () { | |
| if (this.type == 'text' || this.type == 'hidden') { | |
| this.value = ''; | |
| } else if (this.type == 'checkbox') { | |
| this.checked = false; | |
| } | |
| }); | |
| // 추가 첨부 최대 용량 hidden 은 빈값으로 두지 않고 기본값으로 초기화 | |
| obj.find('input[name^="comAddiCert"][name$="[certificationFileSize]"]').val('<?= $defaultCertificationFileSize?>'); | |
| // 신규 row이므로 항목명 input의 기존값 attribute 비움 (변경 모달 미발생 처리) | |
| obj.find('input[name^="comAddiCert"][name$="[name]"]').attr('data-initial-value', ''); | |
| obj.appendTo($(this).parents('table')); | |
| // event element | |
| $('label input[name*=\'[use]\']', obj).click(able_rquire).each(able_rquire); | |
| // 클론된 row의 comAddiCert[N][require] disabled 상태 초기화 | |
| $('input[name^="comAddiCert"][name$="[use]"]', obj).each(able_com_add_file_require); | |
| $('.businessDelField', obj).one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| } | |
| /** | |
| * 가입항목추가필드 설정창 호출 | |
| */ | |
| } | |
| } | |
| /** | |
| * 추가 첨부 항목 row의 comAddiCert[N][use]에 따라 같은 row의 comAddiCert[N][require] 활성/비활성 | |
| * 텍스트 input(ex[name][])은 영향받지 않음 | |
| */ | |
| function able_com_add_file_require() { | |
| var $tr = $(this).closest('tr'); | |
| var $require = $tr.find('input[name^="comAddiCert"][name$="[require]"]'); | |
| $require.prop('disabled', !$(this).prop('checked')); | |
| } | |
| /** | |
| * 사업자회원 활성화 | |
| */ | |
| <table class="table table-cols div-business"> | |
| <colgroup> | |
| <col class="width-md"/> | |
| <col class="width-h2xl"/> | |
| <col/> | |
| <col class="width-xs center"/> | |
| </colgroup> | |
| <tr> | |
| <th rowspan="12">사업자회원</th> | |
| <td class="business"> | |
| <label class="checkbox-inline" title="사용여부를 선택해주세요!"> | |
| <input type="checkbox" name="company[use]" class="defaultBusinessInfoUse" value="y"/> | |
| 필수 | |
| </label> | |
| ) | |
| <input type="hidden" name="certificationFileSize" id="certificationFileSize" value="<?= $data['comCertification']['maxSize'] ?>"/> | |
| <button type="button" class="comCertificationSetting btn btn-gray btn-sm">설정</button> | |
| </td> | |
| <td></td> | |
| </tr> | |
| <?php | |
| for ($i = 0; $i < $certificationAdditionalFileCount; $i++) { | |
| // 초기값이 없는 경우에도 첫 번째 row(추가 버튼 보유)는 강제 렌더링 | |
| if ($i !== 0 && !isset($data["comAddiCert$i"])) { | |
| continue; | |
| } | |
| $additionalData = $data["comAddiCert$i"] ?? []; | |
| ?> | |
| <tr> | |
| <td class="business"> | |
| <label class="checkbox-inline" title="사용여부를 선택해주세요!"> | |
| <input type="checkbox" name="comAddiCert[<?= $i ?>][use]" value="y" <?= (($additionalData['use'] ?? '') == 'y') ? 'checked' : '' ?>/> | |
| </label> | |
| <span class="checkbox-inline width40p"> | |
| <input type="text" name="comAddiCert[<?= $i ?>][name]" placeholder="추가 첨부 항목명" class="form-control width100p" value="<?= $additionalData['name'] ?? '' ?>" data-initial-value="<?= $additionalData['name'] ?? '' ?>"/> | |
| </span> | |
| ( | |
| <label class="checkbox-inline" title="필수 사용여부를 선택해주세요!"> | |
| <input value="y" name="comAddiCert[<?= $i ?>][require]" type="checkbox" <?= !empty($additionalData['require']) ? 'checked' : '' ?> /> | |
| 필수 | |
| </label> | |
| ) | |
| <input type="hidden" name="comAddiCert[<?= $i ?>][certificationFileSize]" value="<?= $additionalData['certificationFileSize'] ?? $defaultCertificationFileSize ?>"> | |
| <button type="button" class="comAddfieldSetting btn btn-gray btn-sm">설정</button> | |
| </td> | |
| <td></td> | |
| <td> | |
| <?php if ($i === 0) { ?> | |
| <a class="businessAddfiled btn btn-white btn-icon-plus btn-sm">추가</a> | |
| <?php } else { ?> | |
| <a class="businessDelField btn btn-white btn-icon-minus btn-sm">삭제</a> | |
| <?php } ?> | |
| </td> | |
| </tr> | |
| <?php | |
| } ?> | |
| </table> | |
| <?php } ?> | |
| return pass; | |
| } | |
| /** | |
| * 추가 첨부 항목 use 체크 시 항목명 입력 여부 검증 | |
| */ | |
| function comAddiCertValidation() { | |
| var pass = true; | |
| $('input[name^="comAddiCert"][name$="[use]"]').each(function () { | |
| if ($(this).prop('checked') !== true) { | |
| return true; | |
| } | |
| var $tr = $(this).closest('tr'); | |
| var $nameInput = $tr.find('input[name^="comAddiCert"][name$="[name]"]'); | |
| var nameValue = ($nameInput.val() || '').replace(/^\s+|\s+$/g, ''); | |
| if (nameValue === '') { | |
| BootstrapDialog.alert({ | |
| title: "경고", | |
| message: "추가 첨부의 항목명을 입력해주세요." | |
| }); | |
| $nameInput.focus(); | |
| pass = false; | |
| return false; | |
| } | |
| }); | |
| return pass; | |
| } | |
| $(document).ready(function () { | |
| // 아이디 자리수 체크 | |
| $('input[name*="memId"]:text').on('blur', function() { | |
| able_rquire.call(this); | |
| }); | |
| // 추가 첨부 항목: comAddiCert[N][use]에 따라 같은 row의 comAddiCert[N][require] 활성/비활성 | |
| $('#frmSetup').on('click', 'input[name^="comAddiCert"][name$="[use]"]', able_com_add_file_require); | |
| $('#frmSetup input[name^="comAddiCert"][name$="[use]"]').each(able_com_add_file_require); | |
| // 추가 첨부 항목명 변경 시 확인 모달 (기존 등록값이 있을 때만) | |
| $('#frmSetup').on('change', 'input[name^="comAddiCert"][name$="[name]"]', function () { | |
| var $target = $(this); | |
| var initialValue = $target.attr('data-initial-value') || ''; | |
| var currentValue = $target.val(); | |
| if (initialValue !== '' && initialValue !== currentValue) { | |
| BootstrapDialog.confirm({ | |
| title: "확인", | |
| message: "이미 사용중인 추가 첨부 항목을 변경하시겠습니까? 사용중인 항목이 변경될 경우, 기존 등록된 회원정보 내 항목도 변경됩니다.", | |
| btnCancelLabel: "취소", | |
| btnOkLabel: "변경", | |
| callback: function (result) { | |
| if (!result) { | |
| $target.val(initialValue); | |
| } | |
| } | |
| }); | |
| } | |
| }); | |
| // 사업자회원 활성화 | |
| var $businessinfo = $('input[name=\'businessinfo[use]\']'); | |
| var $defaultBusinessInfoUse = $('.defaultBusinessInfoUse'); | |
| // 가입항목추가 버튼 | |
| $('.addfield').on('click', add_field); | |
| $('.businessAddfiled').on('click', business_add_field) | |
| $('.businessDelField').one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| // 가입항목추가필드 삭제 | |
| $('.delfield').one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| }); | |
| // 추가 첨부 항목 설정 버튼 (동적으로 추가된 row까지 처리되도록 이벤트 위임 사용) | |
| $('#frmSetup').on('click', '.comAddfieldSetting', function () { | |
| var $tr = $(this).closest('tr'); | |
| var nameValue = $tr.find('input[name^="comAddiCert"][name$="[name]"]').val(); | |
| var title = (nameValue ? nameValue + ' ' : '') + '추가 설정'; | |
| // 부모 row의 comAddiCert[N][use] name에서 인덱스 추출 | |
| var useName = $tr.find('input[name^="comAddiCert"][name$="[use]"]').attr('name') || ''; | |
| var matched = useName.match(/comAddiCert\[(\d+)\]/); | |
| var rowIndex = matched ? matched[1] : 0; | |
| $.get('layer_company_certification_setting.php?type=comAddiCert&index=' + rowIndex, function (data) { | |
| layer_popup(data, title, 'normal'); | |
| }); | |
| }); | |
| $('#frmSetup').validate({ | |
| submitHandler: function (form) { | |
| if (minMaxRangeValidation('memId') && minMaxRangeValidation('nickNm') && extraValidation() && comAddiCertValidation()) { | |
| form.submit(); | |
| } | |
| return false; | |
| $('.setup_field', obj).on('click', call_setup_field); | |
| } | |
| function business_add_field(e) { | |
| if ($('.businessDelField').length >= <?= $certificationAdditionalFileCount - 1 ?>) { | |
| alert('사업자회원 추가 항목은 5개까지만 추가할 수 있습니다.'); | |
| return; | |
| } | |
| // 클론 전 시점의 comAddiCert[N][use] 개수가 새 row의 인덱스 | |
| var addFileLength = $('input[name^="comAddiCert"][name$="[use]"]').length; | |
| var obj = $(this).parents('tr').clone(); | |
| obj.find('.businessAddfiled').parents('td').html('<a class="businessDelField btn btn-white btn-icon-minus btn-sm">삭제</a>'); | |
| obj.find('input[name^="comAddiCert"]').each(function () { | |
| this.name = this.name.replace(/comAddiCert\[\d+\]/, 'comAddiCert[' + addFileLength + ']'); | |
| }); | |
| obj.find('input').each(function () { | |
| if (this.type == 'text' || this.type == 'hidden') { | |
| this.value = ''; | |
| } else if (this.type == 'checkbox') { | |
| this.checked = false; | |
| } | |
| }); | |
| // 추가 첨부 최대 용량 hidden 은 빈값으로 두지 않고 기본값으로 초기화 | |
| obj.find('input[name^="comAddiCert"][name$="[certificationFileSize]"]').val('<?= $defaultCertificationFileSize?>'); | |
| // 신규 row이므로 항목명 input의 기존값 attribute 비움 (변경 모달 미발생 처리) | |
| obj.find('input[name^="comAddiCert"][name$="[name]"]').attr('data-initial-value', ''); | |
| obj.appendTo($(this).parents('table')); | |
| // event element | |
| $('label input[name*=\'[use]\']', obj).click(able_rquire).each(able_rquire); | |
| // 클론된 row의 comAddiCert[N][require] disabled 상태 초기화 | |
| $('input[name^="comAddiCert"][name$="[use]"]', obj).each(able_com_add_file_require); | |
| $('.businessDelField', obj).one('click', function () { | |
| $(this).parents('tr').remove(); | |
| }); | |
| } | |
| /** | |
| * 가입항목추가필드 설정창 호출 | |
| */ | |
| } | |
| } | |
| /** | |
| * 추가 첨부 항목 row의 comAddiCert[N][use]에 따라 같은 row의 comAddiCert[N][require] 활성/비활성 | |
| * 텍스트 input(ex[name][])은 영향받지 않음 | |
| */ | |
| function able_com_add_file_require() { | |
| var $tr = $(this).closest('tr'); | |
| var $require = $tr.find('input[name^="comAddiCert"][name$="[require]"]'); | |
| $require.prop('disabled', !$(this).prop('checked')); | |
| } | |
| /** | |
| * 사업자회원 활성화 | |
| */ | |
변경 전_member_view_business.php
| <br> | |
| <?php endif; ?> | |
| <div class="form-inline"> | |
| <input type="file" id="companyCertification" name="companyCertification" class="form-control" accept="image/*, application/pdf"/> | |
| </div> | |
| <div class="notice-info mgt10"> | |
| 파일 업로드 최대 사이즈는 <?= $certificationMaxFileSize ?>MB 입니다.<br> | |
| <?php if (!empty($certification)): ?> | |
| <span> | |
| <input type="checkbox" name="certificationDeleteSno" class="js-certification-checkbox" value="<?= $certification['sno'] ?>" /> | |
| Delete Uploaded File .. <?= $certification['imageFileNm'] ?> | |
| <br> | |
| </span> | |
| <?php endif; ?> | |
| </td> | |
| </tr> | |
| </table> | |
| </div> | |
| <iframe id="downloadFrame" style="display:none;"></iframe> | |
| $(document).on('change', '.js-certification-checkbox', function(e) { | |
| var checkbox = this; | |
| if (checkbox.checked) { | |
| dialog_confirm('등록된 사업자등록증을 삭제하시겠습니까? 회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.', function(result) { | |
| if (!result) { | |
| checkbox.checked = false; | |
| } | |
| } | |
| }); | |
| $('#companyCertification').change(function (e) { | |
| const $fileInput = $('input[name="companyCertification"]'); | |
| const file = $fileInput[0].files[0]; | |
| const fileMaxSize = certificationMaxFileSize || 2; // MB | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| dialog_alert('등록이 불가한 파일 형식입니다. 이미지(jpg, jpeg, png, gif, bmp, webp, svg) 및 pdf 파일만 업로드 가능합니다.'); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > fileMaxSize) { | |
| e.target.value = ''; | |
| dialog_alert('파일은 최대 ' + fileMaxSize.toString() + 'MB 이하로만 등록 가능합니다.'); | |
| } | |
| }); | |
| </script> | |
| <br> | |
| <?php endif; ?> | |
| <div class="form-inline"> | |
| <input type="file" id="companyCertification" name="companyCertification" class="form-control" accept="image/*, application/pdf"/> | |
| </div> | |
| <div class="notice-info mgt10"> | |
| 파일 업로드 최대 사이즈는 <?= $certificationMaxFileSize ?>MB 입니다.<br> | |
| <?php if (!empty($certification)): ?> | |
| <span> | |
| <input type="checkbox" name="certificationDeleteSno" class="js-certification-checkbox" value="<?= $certification['sno'] ?>" /> | |
| Delete Uploaded File .. <?= $certification['imageFileNm'] ?> | |
| <br> | |
| </span> | |
| <?php endif; ?> | |
| </td> | |
| </tr> | |
| </table> | |
| </div> | |
| <iframe id="downloadFrame" style="display:none;"></iframe> | |
| $(document).on('change', '.js-certification-checkbox', function(e) { | |
| var checkbox = this; | |
| if (checkbox.checked) { | |
| dialog_confirm('등록된 사업자등록증을 삭제하시겠습니까? 회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.', function(result) { | |
| if (!result) { | |
| checkbox.checked = false; | |
| } | |
| } | |
| }); | |
| $('#companyCertification').change(function (e) { | |
| const $fileInput = $('input[name="companyCertification"]'); | |
| const file = $fileInput[0].files[0]; | |
| const fileMaxSize = certificationMaxFileSize || 2; // MB | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| dialog_alert('등록이 불가한 파일 형식입니다. 이미지(jpg, jpeg, png, gif, bmp, webp, svg) 및 pdf 파일만 업로드 가능합니다.'); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > fileMaxSize) { | |
| e.target.value = ''; | |
| dialog_alert('파일은 최대 ' + fileMaxSize.toString() + 'MB 이하로만 등록 가능합니다.'); | |
| } | |
| }); | |
| </script> | |
변경 후_member_view_business.php
| <br> | |
| <?php endif; ?> | |
| <div class="form-inline"> | |
| <input type="file" id="companyCertification" name="companyCertification" class="form-control js-cert-file" accept="image/*, application/pdf" data-max-size="<?= $certificationMaxFileSize ?>"/> | |
| <?php if ($mode === 'register'): // 등록 시에만 첨부 취소 버튼 노출 (수정 시 미노출) ?> | |
| <button type="button" class="btn btn-white btn-sm js-cert-file-clear" style="display:none;">- 삭제</button> | |
| <?php endif; ?> | |
| </div> | |
| <div class="notice-info mgt10"> | |
| 파일 업로드 최대 사이즈는 <?= $certificationMaxFileSize ?>MB 입니다.<br> | |
| <?php if (!empty($certification)): ?> | |
| <span> | |
| <input type="checkbox" name="certificationDeleteSno" class="js-certification-checkbox" value="<?= $certification['sno'] ?>" /> | |
| 업로드된 파일 삭제 .. <?= $certification['imageFileNm'] ?> | |
| <br> | |
| </span> | |
| <?php endif; ?> | |
| </td> | |
| </tr> | |
| <?php | |
| for ($i = 0; $i < $certificationAdditionalFileCount ; $i++) { | |
| $additional = $additionalCertification["comAddiCert$i"] ?? null; | |
| if($additional && $additional['use'] === 'y') { ?> | |
| <tr> | |
| <th><?= $additional['name'] ?></th> | |
| <td class="input_area" colspan="3"> | |
| <?php if (!empty($additional['file'])): ?> | |
| <a href="#" class="js-certification-download" data-url="../member/company_certification.php?mode=download&sno=<?= $additional['file']['sno'] ?>"> | |
| <?= $additional['file']['imageFileNm'] ?> | |
| </a> | |
| <br> | |
| <?php endif; ?> | |
| <div class="form-inline"> | |
| <input type="file" id="comAddiCert[<?= $i ?>][file]" name="comAddiCert[<?= $i ?>][file]" class="form-control js-cert-file" accept="image/*, application/pdf" data-max-size="<?= $additional['certificationFileSize'] ?>"/> | |
| <?php if ($mode === 'register'): // 등록 시에만 첨부 취소 버튼 노출 (수정 시 미노출) ?> | |
| <button type="button" class="btn btn-white btn-sm js-cert-file-clear" style="display:none;">- 삭제</button> | |
| <?php endif; ?> | |
| </div> | |
| <div class="notice-info mgt10"> | |
| 파일 업로드 최대 사이즈는 <?= $additional['certificationFileSize'] ?>MB 입니다.<br> | |
| </div> | |
| <?php if (!empty($additional['file'])): ?> | |
| <span> | |
| <input type="checkbox" name="comAddiCert[<?= $i ?>][DeleteSno]" class="js-certification-checkbox" value="<?= $additional['file']['sno'] ?>" /> | |
| 업로드된 파일 삭제 .. <?= $additional['file']['imageFileNm'] ?> | |
| <br> | |
| </span> | |
| <?php endif; ?> | |
| </td> | |
| </tr> | |
| <?php | |
| } | |
| } ?> | |
| </table> | |
| </div> | |
| <iframe id="downloadFrame" style="display:none;"></iframe> | |
| $(document).on('change', '.js-certification-checkbox', function(e) { | |
| var checkbox = this; | |
| if (checkbox.checked) { | |
| // 추가서류(comAddiCert[N][DeleteSno])와 사업자등록증(certificationDeleteSno) 문구 구분 | |
| var message = checkbox.name.indexOf('comAddiCert') === 0 | |
| ? '등록된 첨부파일을 삭제하시겠습니까? 회원정보 최종 저장 시 삭제되며, 복구가 불가능 합니다.' | |
| : '등록된 사업자등록증을 삭제하시겠습니까? 회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'; | |
| dialog_confirm(message, function(result) { | |
| if (!result) { | |
| checkbox.checked = false; | |
| } | |
| } | |
| }); | |
| // 선택 파일 비우기: bootstrap-filestyle 위젯이 적용된 경우 표시 텍스트박스까지 함께 비운다 | |
| function clearCertFile($input) { | |
| if ($input.data('filestyle')) { | |
| $input.filestyle('clear'); | |
| } else { | |
| $input.val(''); | |
| } | |
| } | |
| // 찾아보기로 파일 선택 시 확장자·용량 검사 후 '- 삭제' 버튼 노출, 클릭 시 선택 취소(첨부 제거) | |
| $(document).on('change', '.js-cert-file', function () { | |
| const file = this.files[0]; | |
| if (file) { | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| clearCertFile($(this)); | |
| dialog_alert('등록이 불가한 파일 형식입니다. 이미지(jpg, jpeg, png, gif, bmp, webp, svg) 및 pdf 파일만 업로드 가능합니다.'); | |
| } else { | |
| const fileMaxSize = parseFloat($(this).data('max-size')) || 2; // MB | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > fileMaxSize) { | |
| clearCertFile($(this)); | |
| dialog_alert('파일은 최대 ' + fileMaxSize.toString() + 'MB 이하로만 등록 가능합니다.'); | |
| } | |
| } | |
| } | |
| $(this).closest('.form-inline').find('.js-cert-file-clear').toggle(this.files.length > 0); | |
| }); | |
| $(document).on('click', '.js-cert-file-clear', function () { | |
| clearCertFile($(this).closest('.form-inline').find('.js-cert-file')); | |
| $(this).hide(); | |
| }); | |
| </script> | |
| <br> | |
| <?php endif; ?> | |
| <div class="form-inline"> | |
| <input type="file" id="companyCertification" name="companyCertification" class="form-control js-cert-file" accept="image/*, application/pdf" data-max-size="<?= $certificationMaxFileSize ?>"/> | |
| <?php if ($mode === 'register'): // 등록 시에만 첨부 취소 버튼 노출 (수정 시 미노출) ?> | |
| <button type="button" class="btn btn-white btn-sm js-cert-file-clear" style="display:none;">- 삭제</button> | |
| <?php endif; ?> | |
| </div> | |
| <div class="notice-info mgt10"> | |
| 파일 업로드 최대 사이즈는 <?= $certificationMaxFileSize ?>MB 입니다.<br> | |
| <?php if (!empty($certification)): ?> | |
| <span> | |
| <input type="checkbox" name="certificationDeleteSno" class="js-certification-checkbox" value="<?= $certification['sno'] ?>" /> | |
| 업로드된 파일 삭제 .. <?= $certification['imageFileNm'] ?> | |
| <br> | |
| </span> | |
| <?php endif; ?> | |
| </td> | |
| </tr> | |
| <?php | |
| for ($i = 0; $i < $certificationAdditionalFileCount ; $i++) { | |
| $additional = $additionalCertification["comAddiCert$i"] ?? null; | |
| if($additional && $additional['use'] === 'y') { ?> | |
| <tr> | |
| <th><?= $additional['name'] ?></th> | |
| <td class="input_area" colspan="3"> | |
| <?php if (!empty($additional['file'])): ?> | |
| <a href="#" class="js-certification-download" data-url="../member/company_certification.php?mode=download&sno=<?= $additional['file']['sno'] ?>"> | |
| <?= $additional['file']['imageFileNm'] ?> | |
| </a> | |
| <br> | |
| <?php endif; ?> | |
| <div class="form-inline"> | |
| <input type="file" id="comAddiCert[<?= $i ?>][file]" name="comAddiCert[<?= $i ?>][file]" class="form-control js-cert-file" accept="image/*, application/pdf" data-max-size="<?= $additional['certificationFileSize'] ?>"/> | |
| <?php if ($mode === 'register'): // 등록 시에만 첨부 취소 버튼 노출 (수정 시 미노출) ?> | |
| <button type="button" class="btn btn-white btn-sm js-cert-file-clear" style="display:none;">- 삭제</button> | |
| <?php endif; ?> | |
| </div> | |
| <div class="notice-info mgt10"> | |
| 파일 업로드 최대 사이즈는 <?= $additional['certificationFileSize'] ?>MB 입니다.<br> | |
| </div> | |
| <?php if (!empty($additional['file'])): ?> | |
| <span> | |
| <input type="checkbox" name="comAddiCert[<?= $i ?>][DeleteSno]" class="js-certification-checkbox" value="<?= $additional['file']['sno'] ?>" /> | |
| 업로드된 파일 삭제 .. <?= $additional['file']['imageFileNm'] ?> | |
| <br> | |
| </span> | |
| <?php endif; ?> | |
| </td> | |
| </tr> | |
| <?php | |
| } | |
| } ?> | |
| </table> | |
| </div> | |
| <iframe id="downloadFrame" style="display:none;"></iframe> | |
| $(document).on('change', '.js-certification-checkbox', function(e) { | |
| var checkbox = this; | |
| if (checkbox.checked) { | |
| // 추가서류(comAddiCert[N][DeleteSno])와 사업자등록증(certificationDeleteSno) 문구 구분 | |
| var message = checkbox.name.indexOf('comAddiCert') === 0 | |
| ? '등록된 첨부파일을 삭제하시겠습니까? 회원정보 최종 저장 시 삭제되며, 복구가 불가능 합니다.' | |
| : '등록된 사업자등록증을 삭제하시겠습니까? 회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'; | |
| dialog_confirm(message, function(result) { | |
| if (!result) { | |
| checkbox.checked = false; | |
| } | |
| } | |
| }); | |
| // 선택 파일 비우기: bootstrap-filestyle 위젯이 적용된 경우 표시 텍스트박스까지 함께 비운다 | |
| function clearCertFile($input) { | |
| if ($input.data('filestyle')) { | |
| $input.filestyle('clear'); | |
| } else { | |
| $input.val(''); | |
| } | |
| } | |
| // 찾아보기로 파일 선택 시 확장자·용량 검사 후 '- 삭제' 버튼 노출, 클릭 시 선택 취소(첨부 제거) | |
| $(document).on('change', '.js-cert-file', function () { | |
| const file = this.files[0]; | |
| if (file) { | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| clearCertFile($(this)); | |
| dialog_alert('등록이 불가한 파일 형식입니다. 이미지(jpg, jpeg, png, gif, bmp, webp, svg) 및 pdf 파일만 업로드 가능합니다.'); | |
| } else { | |
| const fileMaxSize = parseFloat($(this).data('max-size')) || 2; // MB | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > fileMaxSize) { | |
| clearCertFile($(this)); | |
| dialog_alert('파일은 최대 ' + fileMaxSize.toString() + 'MB 이하로만 등록 가능합니다.'); | |
| } | |
| } | |
| } | |
| $(this).closest('.form-inline').find('.js-cert-file-clear').toggle(this.files.length > 0); | |
| }); | |
| $(document).on('click', '.js-cert-file-clear', function () { | |
| clearCertFile($(this).closest('.form-inline').find('.js-cert-file')); | |
| $(this).hide(); | |
| }); | |
| </script> | |
변경 전CompanyCertification.php
| namespace Bundle\Component\Member\Company; | |
| use DTO\Member\CompanyCertificationInsertDTO; | |
| use Exception; | |
| use Framework\Debug\Exception\AlertBackException; | |
| { | |
| const DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE = '2'; // MB | |
| const CERTIFICATION_IMAGE_UPLOAD_PATH = '/member/company/certification/%s'; | |
| const ALLOW_MIME_TYPES = [ | |
| 'application/pdf', | |
| 'image/jpeg', | |
| } | |
| /** | |
| * 사업자 등록증 파일 크기 설정 | |
| * @param int $size | |
| * @return bool | |
| */ | |
| public function setCompanyCertificationFileSize(int $size): bool | |
| { | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| $joinItem['comCertification']['maxSize'] = $size; | |
| return $this->policy->setValue('member.joinitem', $joinItem); | |
| } | |
| /** | |
| * 사업자 등록증 파일 크기 | |
| * | |
| * @return int | |
| */ | |
| public function getCompanyCertificationFileSize(): int | |
| { | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| return $joinItem['comCertification']['maxSize'] ?? self::DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE; | |
| } | |
| /** | |
| * 사업자 등록증 이미지 OBS 업로드 | |
| * | |
| * @param array $certificationFiles | |
| * @param int $memNo | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| public function upload(array $certificationFiles, int $memNo): void | |
| { | |
| $fileCount = count($certificationFiles['tmp_name']); | |
| if ($fileCount !== 1) { | |
| throw new \Exception('사업자 등록증 파일은 1개만 업로드 가능합니다.'); | |
| } | |
| // 기존파일이 있으면 삭제부터 진행. | |
| $certificationInfo = $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| if (!empty($certificationInfo)) { | |
| $deleteResult = $this->imageUploadService->deleteImage($certificationInfo['imageFilePath']); | |
| if ($deleteResult === false) { | |
| throw new \Exception('기존 사업자 등록증 이미지 삭제에 실패했습니다.'); | |
| } | |
| $this->companyCertificationRepository->deleteCertificationInfo($certificationInfo['sno']); | |
| } | |
| // 파일 업로드 최대 사이즈 | |
| $maxFileSize = $this->getCompanyCertificationFileSize(); | |
| $result = $this->uploadToObs($maxFileSize, $certificationFiles, $memNo); | |
| $this->logger->channel('adminLog')->info('OBS IMAGE UPLOAD RESULT : ', $result); | |
| // 업로드 결과 처리 | |
| if ($result['result']) { | |
| $this->insertCertificationInfo($memNo, $result); // 성공시 insert | |
| } else { | |
| throw new \Exception('사업자 등록증 이미지 업로드에 실패했습니다.'); | |
| } | |
| } | |
| * 결과 정보 저장 | |
| * @param int $memNo | |
| * @param array $result | |
| * @return void | |
| * @throws \Throwable | |
| */ | |
| private function insertCertificationInfo(int $memNo, array $result): void | |
| { | |
| // DB 저장 | |
| try { | |
| $dto = new CompanyCertificationInsertDTO($memNo, [ | |
| 'filePath' => $result['saveFileNm'], // img full url | |
| 'fileName' => $result['uploadFileNm'], // file name | |
| ]); | |
| $this->companyCertificationRepository->insertCertificationInfo($dto); | |
| } catch (\Throwable $e) { | |
| // DB 저장 실패 시 OBS에서 파일 삭제 | |
| return $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| } | |
| /** | |
| * 사업자 등록증 다운로드 | |
| * @param int $sno | |
| } | |
| } | |
| /** | |
| * 사업자등록증을 OBS에 업로드하는 함수 | |
| * @param int $maxFileSize | |
| namespace Bundle\Component\Member\Company; | |
| use DTO\Member\CompanyCertificationInsertDTO; | |
| use Exception; | |
| use Framework\Debug\Exception\AlertBackException; | |
| { | |
| const DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE = '2'; // MB | |
| const CERTIFICATION_IMAGE_UPLOAD_PATH = '/member/company/certification/%s'; | |
| const ALLOW_MIME_TYPES = [ | |
| 'application/pdf', | |
| 'image/jpeg', | |
| } | |
| /** | |
| * 사업자 등록증 파일 크기 설정 | |
| * @param int $size | |
| * @return bool | |
| */ | |
| public function setCompanyCertificationFileSize(int $size): bool | |
| { | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| $joinItem['comCertification']['maxSize'] = $size; | |
| return $this->policy->setValue('member.joinitem', $joinItem); | |
| } | |
| /** | |
| * 사업자 등록증 파일 크기 | |
| * | |
| * @return int | |
| */ | |
| public function getCompanyCertificationFileSize(): int | |
| { | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| return $joinItem['comCertification']['maxSize'] ?? self::DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE; | |
| } | |
| /** | |
| * 사업자 등록증 이미지 OBS 업로드 | |
| * | |
| * @param array $certificationFiles | |
| * @param int $memNo | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| public function upload(array $certificationFiles, int $memNo): void | |
| { | |
| $fileCount = count($certificationFiles['tmp_name']); | |
| if ($fileCount !== 1) { | |
| throw new \Exception('사업자 등록증 파일은 1개만 업로드 가능합니다.'); | |
| } | |
| // 기존파일이 있으면 삭제부터 진행. | |
| $certificationInfo = $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| if (!empty($certificationInfo)) { | |
| $deleteResult = $this->imageUploadService->deleteImage($certificationInfo['imageFilePath']); | |
| if ($deleteResult === false) { | |
| throw new \Exception('기존 사업자 등록증 이미지 삭제에 실패했습니다.'); | |
| } | |
| $this->companyCertificationRepository->deleteCertificationInfo($certificationInfo['sno']); | |
| } | |
| // 파일 업로드 최대 사이즈 | |
| $maxFileSize = $this->getCompanyCertificationFileSize(); | |
| $result = $this->uploadToObs($maxFileSize, $certificationFiles, $memNo); | |
| $this->logger->channel('adminLog')->info('OBS IMAGE UPLOAD RESULT : ', $result); | |
| // 업로드 결과 처리 | |
| if ($result['result']) { | |
| $this->insertCertificationInfo($memNo, $result); // 성공시 insert | |
| } else { | |
| throw new \Exception('사업자 등록증 이미지 업로드에 실패했습니다.'); | |
| } | |
| } | |
| * 결과 정보 저장 | |
| * @param int $memNo | |
| * @param array $result | |
| * @return void | |
| * @throws \Throwable | |
| */ | |
| private function insertCertificationInfo(int $memNo, array $result): void | |
| { | |
| // DB 저장 | |
| try { | |
| $dto = new CompanyCertificationInsertDTO($memNo, [ | |
| 'filePath' => $result['saveFileNm'], // img full url | |
| 'fileName' => $result['uploadFileNm'], // file name | |
| ]); | |
| $this->companyCertificationRepository->insertCertificationInfo($dto); | |
| } catch (\Throwable $e) { | |
| // DB 저장 실패 시 OBS에서 파일 삭제 | |
| return $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| } | |
| /** | |
| * 사업자 등록증 다운로드 | |
| * @param int $sno | |
| } | |
| } | |
| /** | |
| * 사업자등록증을 OBS에 업로드하는 함수 | |
| * @param int $maxFileSize | |
변경 후CompanyCertification.php
| namespace Bundle\Component\Member\Company; | |
| use Bundle\Enum\Member\Company\DocumentType; | |
| use DTO\Member\CompanyCertificationInsertDTO; | |
| use Exception; | |
| use Framework\Debug\Exception\AlertBackException; | |
| { | |
| const DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE = '2'; // MB | |
| const CERTIFICATION_IMAGE_UPLOAD_PATH = '/member/company/certification/%s'; | |
| /** 주 사업자등록증의 정책(member.joinitem) file key (DB documentType=registration 과 표현이 다름) */ | |
| const REGISTRATION_FILE_KEY = 'comCertification'; | |
| const ALLOW_MIME_TYPES = [ | |
| 'application/pdf', | |
| 'image/jpeg', | |
| } | |
| /** | |
| * 사업자 등록증(주 서류) 파일 크기 설정 | |
| * 주 사업자등록증(comCertification) 기준으로 최대 파일 크기를 설정한다. | |
| * 튜닝 메소드 시그니처 호환용 | |
| * | |
| * @param int $size 최대 파일 크기 (MB) | |
| * @return bool | |
| */ | |
| public function setCompanyCertificationFileSize(int $size): bool | |
| { | |
| return $this->setCompanyCertificationFileSizeByKey($size, $this->toFileKey(DocumentType::REGISTRATION)); | |
| } | |
| /** | |
| * 사업자 등록증 / 추가서류 파일 크기 설정 | |
| * key 에 해당하는 서류의 최대 파일 크기를 설정한다. | |
| * | |
| * @param int $size 최대 파일 크기 (MB) | |
| * @param string $key 정책 file key (comCertification / comAddiCert{n}) | |
| * @exception \Exception 허용되지 않은 key 인 경우 | |
| * @return bool | |
| */ | |
| public function setCompanyCertificationFileSizeByKey(int $size, string $key): bool | |
| { | |
| if ($this->tryFromFileKey($key) === null) { | |
| throw new \Exception("허용되지 않은 key Type : $key"); | |
| } | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| $joinItem[$key][$this->fileSizeField($key)] = $size; | |
| return $this->policy->setValue('member.joinitem', $joinItem); | |
| } | |
| /** | |
| * 사업자 등록증(주 서류) 파일 크기 조회 | |
| * 주 사업자등록증(comCertification) 기준 최대 파일 크기를 반환한다. | |
| * 튜닝 메소드 시그니처 호환용 | |
| * | |
| * @return int | |
| */ | |
| public function getCompanyCertificationFileSize(): int | |
| { | |
| return $this->getCompanyCertificationFileSizeByKey($this->toFileKey(DocumentType::REGISTRATION)); | |
| } | |
| /** | |
| * 사업자 등록증 / 추가서류 파일 크기 조회 | |
| * key 에 해당하는 서류의 최대 파일 크기를 반환한다. 미설정 시 기본값. | |
| * | |
| * @param string $key 정책 file key (comCertification / comAddiCert{n}) | |
| * @exception \Exception 허용되지 않은 key 인 경우 | |
| * @return int | |
| */ | |
| public function getCompanyCertificationFileSizeByKey(string $key): int | |
| { | |
| if ($this->tryFromFileKey($key) === null) { | |
| throw new \Exception("허용되지 않은 key Type : $key"); | |
| } | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| return $joinItem[$key][$this->fileSizeField($key)] ?? self::DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE; | |
| } | |
| /** | |
| * 사업자 추가 제출 서류 최대 개수 | |
| * @return int | |
| */ | |
| public function getCompanyAddiCertificationFileCount(): int | |
| { | |
| // 사업자등록증(주 서류) 제외한 추가 제출 서류 개수 | |
| return count(DocumentType::cases()) - 1; | |
| } | |
| /** | |
| * 서류 종류별 정책(member.joinitem)에 보관된 파일 크기 하위 키를 반환한다. | |
| * 사업자등록증(comCertification)은 maxSize, 추가서류(comAddiCert{n})는 certificationFileSize 로 보관된다. | |
| * | |
| * @param string $key 정책 file key | |
| * @return string 파일 크기 하위 키 | |
| */ | |
| private function fileSizeField(string $key): string | |
| { | |
| return $key === self::REGISTRATION_FILE_KEY ? 'maxSize' : 'certificationFileSize'; | |
| } | |
| /** | |
| * 서류 종류(DB documentType)로부터 정책(member.joinitem) file key 로 변환한다. | |
| * 주 사업자등록증만 'comCertification'(REGISTRATION_FILE_KEY) 으로 표현이 다르고, | |
| * 추가서류는 documentType backing value 와 동일하다. | |
| * | |
| * @param DocumentType $type | |
| * @return string 정책 file key | |
| */ | |
| private function toFileKey(DocumentType $type): string | |
| { | |
| return match ($type) { | |
| DocumentType::REGISTRATION => self::REGISTRATION_FILE_KEY, | |
| default => $type->value, | |
| }; | |
| } | |
| /** | |
| * 정책(member.joinitem) file key 로부터 서류 종류를 조회한다. 허용되지 않은 key 면 null. | |
| * | |
| * @param string $fileKey 정책 file key | |
| * @return DocumentType|null | |
| */ | |
| private function tryFromFileKey(string $fileKey): ?DocumentType | |
| { | |
| return match ($fileKey) { | |
| self::REGISTRATION_FILE_KEY => DocumentType::REGISTRATION, | |
| // 'registration'(DB documentType)은 정책 file key 가 아니므로 제외한다 | |
| DocumentType::REGISTRATION->value => null, | |
| default => DocumentType::tryFrom($fileKey), | |
| }; | |
| } | |
| /** | |
| * 사업자 등록증(주 서류) 이미지 OBS 업로드 | |
| * | |
| * @param array $certificationFiles 업로드 파일 정보 (tmp_name, name, size 등) | |
| * @param int $memNo | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| public function upload(array $certificationFiles, int $memNo): void | |
| { | |
| $this->uploadCertificationFile($certificationFiles, $memNo, null); | |
| } | |
| /** | |
| * 사업자 추가 제출 서류 이미지 OBS 업로드 | |
| * | |
| * @param array $certificationFiles 업로드 파일 정보 (tmp_name, name, size 등) | |
| * @param int $memNo | |
| * @param int $index 추가서류 인덱스 (comAddiCert{index} 타입으로 저장) | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| public function uploadAdditional(array $certificationFiles, int $memNo, int $index): void | |
| { | |
| $this->uploadCertificationFile($certificationFiles, $memNo, "comAddiCert$index"); | |
| } | |
| /** | |
| * 사업자 등록증 / 추가서류 공통 업로드 처리 | |
| * | |
| * @param array $certificationFiles 업로드 파일 정보 (tmp_name, name, size 등) | |
| * @param int $memNo | |
| * @param string|null $certType null이면 주 사업자등록증(comCertification), 값이 있으면 추가서류 타입(comAddiCert{index}) | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| private function uploadCertificationFile(array $certificationFiles, int $memNo, ?string $certType): void | |
| { | |
| $fileCount = count($certificationFiles['tmp_name']); | |
| if ($fileCount !== 1) { | |
| throw new \Exception('파일은 1개만 업로드 가능합니다.'); | |
| } | |
| // certType이 있으면 추가서류, 없으면 주 사업자등록증 기준으로 기존 정보 조회 | |
| if ($certType !== null) { | |
| $certificationInfo = $this->companyCertificationRepository->findCertificationInfoByMemNoAndType($memNo, $certType); | |
| } else { | |
| $certificationInfo = $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| } | |
| // 기존파일이 있으면 삭제부터 진행. | |
| if (!empty($certificationInfo)) { | |
| $deleteResult = $this->imageUploadService->deleteImage($certificationInfo['imageFilePath']); | |
| if ($deleteResult === false) { | |
| \Logger::channel('member')->error("기존 사업자 등록 서류 삭제에 실패했습니다. memNo : {$memNo}"); | |
| } | |
| $this->companyCertificationRepository->deleteCertificationInfo($certificationInfo['sno']); | |
| } | |
| // 파일 업로드 최대 사이즈 (주 사업자등록증 / 추가서류 각 서류별 설정값 사용) | |
| $fileKey = $certType ?? $this->toFileKey(DocumentType::REGISTRATION); | |
| $maxFileSize = $this->getCompanyCertificationFileSizeByKey($fileKey); | |
| $result = $this->uploadToObs($maxFileSize, $certificationFiles, $memNo); | |
| $this->logger->channel('adminLog')->info('OBS IMAGE UPLOAD RESULT : ', $result); | |
| // 업로드 결과 처리 | |
| if ($result['result']) { | |
| $this->insertCertificationInfo($memNo, $result, $certType); // 성공시 insert | |
| } else { | |
| throw new \Exception('사업자 등록증 이미지 업로드에 실패했습니다.'); | |
| } | |
| } | |
| * 결과 정보 저장 | |
| * @param int $memNo | |
| * @param array $result | |
| * @param string|null $certType 추가서류 타입(comAddiCert{index}), null이면 주 사업자등록증 | |
| * @return void | |
| * @throws \Throwable | |
| */ | |
| private function insertCertificationInfo(int $memNo, array $result, ?string $certType = null): void | |
| { | |
| // DB 저장 | |
| try { | |
| $dto = new CompanyCertificationInsertDTO( | |
| $memNo, | |
| [ | |
| 'filePath' => $result['saveFileNm'], // img full url | |
| 'fileName' => $result['uploadFileNm'] // file name | |
| ], | |
| $certType | |
| ); | |
| $this->companyCertificationRepository->insertCertificationInfo($dto); | |
| } catch (\Throwable $e) { | |
| // DB 저장 실패 시 OBS에서 파일 삭제 | |
| return $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| } | |
| public function getCertificationByMemNoAndType(int $memNo, string $type): array | |
| { | |
| return $this->companyCertificationRepository->findCertificationInfoByMemNoAndType($memNo, $type); | |
| } | |
| /** | |
| * 사업자 등록증 다운로드 | |
| * @param int $sno | |
| } | |
| } | |
| public function getAdditionalData(): array | |
| { | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| $additionalData = []; | |
| foreach ($joinItem as $key => $value) { | |
| if (str_contains($key, 'comAddiCert')) { | |
| $additionalData[$key] = $value; | |
| } | |
| } | |
| return $additionalData; | |
| } | |
| /** | |
| * 사업자등록증을 OBS에 업로드하는 함수 | |
| * @param int $maxFileSize | |
| namespace Bundle\Component\Member\Company; | |
| use Bundle\Enum\Member\Company\DocumentType; | |
| use DTO\Member\CompanyCertificationInsertDTO; | |
| use Exception; | |
| use Framework\Debug\Exception\AlertBackException; | |
| { | |
| const DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE = '2'; // MB | |
| const CERTIFICATION_IMAGE_UPLOAD_PATH = '/member/company/certification/%s'; | |
| /** 주 사업자등록증의 정책(member.joinitem) file key (DB documentType=registration 과 표현이 다름) */ | |
| const REGISTRATION_FILE_KEY = 'comCertification'; | |
| const ALLOW_MIME_TYPES = [ | |
| 'application/pdf', | |
| 'image/jpeg', | |
| } | |
| /** | |
| * 사업자 등록증(주 서류) 파일 크기 설정 | |
| * 주 사업자등록증(comCertification) 기준으로 최대 파일 크기를 설정한다. | |
| * 튜닝 메소드 시그니처 호환용 | |
| * | |
| * @param int $size 최대 파일 크기 (MB) | |
| * @return bool | |
| */ | |
| public function setCompanyCertificationFileSize(int $size): bool | |
| { | |
| return $this->setCompanyCertificationFileSizeByKey($size, $this->toFileKey(DocumentType::REGISTRATION)); | |
| } | |
| /** | |
| * 사업자 등록증 / 추가서류 파일 크기 설정 | |
| * key 에 해당하는 서류의 최대 파일 크기를 설정한다. | |
| * | |
| * @param int $size 최대 파일 크기 (MB) | |
| * @param string $key 정책 file key (comCertification / comAddiCert{n}) | |
| * @exception \Exception 허용되지 않은 key 인 경우 | |
| * @return bool | |
| */ | |
| public function setCompanyCertificationFileSizeByKey(int $size, string $key): bool | |
| { | |
| if ($this->tryFromFileKey($key) === null) { | |
| throw new \Exception("허용되지 않은 key Type : $key"); | |
| } | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| $joinItem[$key][$this->fileSizeField($key)] = $size; | |
| return $this->policy->setValue('member.joinitem', $joinItem); | |
| } | |
| /** | |
| * 사업자 등록증(주 서류) 파일 크기 조회 | |
| * 주 사업자등록증(comCertification) 기준 최대 파일 크기를 반환한다. | |
| * 튜닝 메소드 시그니처 호환용 | |
| * | |
| * @return int | |
| */ | |
| public function getCompanyCertificationFileSize(): int | |
| { | |
| return $this->getCompanyCertificationFileSizeByKey($this->toFileKey(DocumentType::REGISTRATION)); | |
| } | |
| /** | |
| * 사업자 등록증 / 추가서류 파일 크기 조회 | |
| * key 에 해당하는 서류의 최대 파일 크기를 반환한다. 미설정 시 기본값. | |
| * | |
| * @param string $key 정책 file key (comCertification / comAddiCert{n}) | |
| * @exception \Exception 허용되지 않은 key 인 경우 | |
| * @return int | |
| */ | |
| public function getCompanyCertificationFileSizeByKey(string $key): int | |
| { | |
| if ($this->tryFromFileKey($key) === null) { | |
| throw new \Exception("허용되지 않은 key Type : $key"); | |
| } | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| return $joinItem[$key][$this->fileSizeField($key)] ?? self::DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE; | |
| } | |
| /** | |
| * 사업자 추가 제출 서류 최대 개수 | |
| * @return int | |
| */ | |
| public function getCompanyAddiCertificationFileCount(): int | |
| { | |
| // 사업자등록증(주 서류) 제외한 추가 제출 서류 개수 | |
| return count(DocumentType::cases()) - 1; | |
| } | |
| /** | |
| * 서류 종류별 정책(member.joinitem)에 보관된 파일 크기 하위 키를 반환한다. | |
| * 사업자등록증(comCertification)은 maxSize, 추가서류(comAddiCert{n})는 certificationFileSize 로 보관된다. | |
| * | |
| * @param string $key 정책 file key | |
| * @return string 파일 크기 하위 키 | |
| */ | |
| private function fileSizeField(string $key): string | |
| { | |
| return $key === self::REGISTRATION_FILE_KEY ? 'maxSize' : 'certificationFileSize'; | |
| } | |
| /** | |
| * 서류 종류(DB documentType)로부터 정책(member.joinitem) file key 로 변환한다. | |
| * 주 사업자등록증만 'comCertification'(REGISTRATION_FILE_KEY) 으로 표현이 다르고, | |
| * 추가서류는 documentType backing value 와 동일하다. | |
| * | |
| * @param DocumentType $type | |
| * @return string 정책 file key | |
| */ | |
| private function toFileKey(DocumentType $type): string | |
| { | |
| return match ($type) { | |
| DocumentType::REGISTRATION => self::REGISTRATION_FILE_KEY, | |
| default => $type->value, | |
| }; | |
| } | |
| /** | |
| * 정책(member.joinitem) file key 로부터 서류 종류를 조회한다. 허용되지 않은 key 면 null. | |
| * | |
| * @param string $fileKey 정책 file key | |
| * @return DocumentType|null | |
| */ | |
| private function tryFromFileKey(string $fileKey): ?DocumentType | |
| { | |
| return match ($fileKey) { | |
| self::REGISTRATION_FILE_KEY => DocumentType::REGISTRATION, | |
| // 'registration'(DB documentType)은 정책 file key 가 아니므로 제외한다 | |
| DocumentType::REGISTRATION->value => null, | |
| default => DocumentType::tryFrom($fileKey), | |
| }; | |
| } | |
| /** | |
| * 사업자 등록증(주 서류) 이미지 OBS 업로드 | |
| * | |
| * @param array $certificationFiles 업로드 파일 정보 (tmp_name, name, size 등) | |
| * @param int $memNo | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| public function upload(array $certificationFiles, int $memNo): void | |
| { | |
| $this->uploadCertificationFile($certificationFiles, $memNo, null); | |
| } | |
| /** | |
| * 사업자 추가 제출 서류 이미지 OBS 업로드 | |
| * | |
| * @param array $certificationFiles 업로드 파일 정보 (tmp_name, name, size 등) | |
| * @param int $memNo | |
| * @param int $index 추가서류 인덱스 (comAddiCert{index} 타입으로 저장) | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| public function uploadAdditional(array $certificationFiles, int $memNo, int $index): void | |
| { | |
| $this->uploadCertificationFile($certificationFiles, $memNo, "comAddiCert$index"); | |
| } | |
| /** | |
| * 사업자 등록증 / 추가서류 공통 업로드 처리 | |
| * | |
| * @param array $certificationFiles 업로드 파일 정보 (tmp_name, name, size 등) | |
| * @param int $memNo | |
| * @param string|null $certType null이면 주 사업자등록증(comCertification), 값이 있으면 추가서류 타입(comAddiCert{index}) | |
| * @return void | |
| * @throws Exception|\Throwable | |
| */ | |
| private function uploadCertificationFile(array $certificationFiles, int $memNo, ?string $certType): void | |
| { | |
| $fileCount = count($certificationFiles['tmp_name']); | |
| if ($fileCount !== 1) { | |
| throw new \Exception('파일은 1개만 업로드 가능합니다.'); | |
| } | |
| // certType이 있으면 추가서류, 없으면 주 사업자등록증 기준으로 기존 정보 조회 | |
| if ($certType !== null) { | |
| $certificationInfo = $this->companyCertificationRepository->findCertificationInfoByMemNoAndType($memNo, $certType); | |
| } else { | |
| $certificationInfo = $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| } | |
| // 기존파일이 있으면 삭제부터 진행. | |
| if (!empty($certificationInfo)) { | |
| $deleteResult = $this->imageUploadService->deleteImage($certificationInfo['imageFilePath']); | |
| if ($deleteResult === false) { | |
| \Logger::channel('member')->error("기존 사업자 등록 서류 삭제에 실패했습니다. memNo : {$memNo}"); | |
| } | |
| $this->companyCertificationRepository->deleteCertificationInfo($certificationInfo['sno']); | |
| } | |
| // 파일 업로드 최대 사이즈 (주 사업자등록증 / 추가서류 각 서류별 설정값 사용) | |
| $fileKey = $certType ?? $this->toFileKey(DocumentType::REGISTRATION); | |
| $maxFileSize = $this->getCompanyCertificationFileSizeByKey($fileKey); | |
| $result = $this->uploadToObs($maxFileSize, $certificationFiles, $memNo); | |
| $this->logger->channel('adminLog')->info('OBS IMAGE UPLOAD RESULT : ', $result); | |
| // 업로드 결과 처리 | |
| if ($result['result']) { | |
| $this->insertCertificationInfo($memNo, $result, $certType); // 성공시 insert | |
| } else { | |
| throw new \Exception('사업자 등록증 이미지 업로드에 실패했습니다.'); | |
| } | |
| } | |
| * 결과 정보 저장 | |
| * @param int $memNo | |
| * @param array $result | |
| * @param string|null $certType 추가서류 타입(comAddiCert{index}), null이면 주 사업자등록증 | |
| * @return void | |
| * @throws \Throwable | |
| */ | |
| private function insertCertificationInfo(int $memNo, array $result, ?string $certType = null): void | |
| { | |
| // DB 저장 | |
| try { | |
| $dto = new CompanyCertificationInsertDTO( | |
| $memNo, | |
| [ | |
| 'filePath' => $result['saveFileNm'], // img full url | |
| 'fileName' => $result['uploadFileNm'] // file name | |
| ], | |
| $certType | |
| ); | |
| $this->companyCertificationRepository->insertCertificationInfo($dto); | |
| } catch (\Throwable $e) { | |
| // DB 저장 실패 시 OBS에서 파일 삭제 | |
| return $this->companyCertificationRepository->findCertificationInfoByMemNo($memNo); | |
| } | |
| public function getCertificationByMemNoAndType(int $memNo, string $type): array | |
| { | |
| return $this->companyCertificationRepository->findCertificationInfoByMemNoAndType($memNo, $type); | |
| } | |
| /** | |
| * 사업자 등록증 다운로드 | |
| * @param int $sno | |
| } | |
| } | |
| public function getAdditionalData(): array | |
| { | |
| $joinItem = $this->policy->getValue('member.joinitem'); | |
| $additionalData = []; | |
| foreach ($joinItem as $key => $value) { | |
| if (str_contains($key, 'comAddiCert')) { | |
| $additionalData[$key] = $value; | |
| } | |
| } | |
| return $additionalData; | |
| } | |
| /** | |
| * 사업자등록증을 OBS에 업로드하는 함수 | |
| * @param int $maxFileSize | |
변경 전MemberAdmin.php
| StringUtils::strIsSet($arrData['maillingFl'], 'n'); | |
| StringUtils::strIsSet($arrData['smsFl'], 'n'); | |
| $arrData = $this->validateMemberByAdminModification($arrData); | |
| //@formatter:off | |
| $arrBind = $db->get_binding(DBTableField::tableMember(), $arrData, 'update', gd_array_keys($arrData), ['memNo', 'memId', 'memPw',]); | |
| //@formatter:on | |
| $companyCertificationService->delete($arrData['certificationDeleteSno']); | |
| } | |
| if ($before === null) { | |
| throw new \Exception(__('수정 전 회원정보가 없습니다.')); | |
| } | |
| StringUtils::strIsSet($arrData['maillingFl'], 'n'); | |
| StringUtils::strIsSet($arrData['smsFl'], 'n'); | |
| $arrData = $this->validateMemberByAdminModification($arrData); | |
| //@formatter:off | |
| $arrBind = $db->get_binding(DBTableField::tableMember(), $arrData, 'update', gd_array_keys($arrData), ['memNo', 'memId', 'memPw',]); | |
| //@formatter:on | |
| $companyCertificationService->delete($arrData['certificationDeleteSno']); | |
| } | |
| if ($before === null) { | |
| throw new \Exception(__('수정 전 회원정보가 없습니다.')); | |
| } | |
변경 후MemberAdmin.php
| StringUtils::strIsSet($arrData['maillingFl'], 'n'); | |
| StringUtils::strIsSet($arrData['smsFl'], 'n'); | |
| // validateMemberByAdminModification이 화이트리스트 필터링으로 file 관련 키들을 제거하므로 | |
| // validate 전 백업 후 validate 직후 복원 | |
| $preservedFileKeys = []; | |
| foreach (['comAddiCert', 'companyCertification', 'certificationDeleteSno'] as $fileKey) { | |
| if (array_key_exists($fileKey, $arrData)) { | |
| $preservedFileKeys[$fileKey] = $arrData[$fileKey]; | |
| } | |
| } | |
| $arrData = $this->validateMemberByAdminModification($arrData); | |
| foreach ($preservedFileKeys as $fileKey => $fileVal) { | |
| $arrData[$fileKey] = $fileVal; | |
| } | |
| //@formatter:off | |
| $arrBind = $db->get_binding(DBTableField::tableMember(), $arrData, 'update', gd_array_keys($arrData), ['memNo', 'memId', 'memPw',]); | |
| //@formatter:on | |
| $companyCertificationService->delete($arrData['certificationDeleteSno']); | |
| } | |
| // 추가 첨부 파일 업로드 (수정 흐름) | |
| if ($arrData['memberFl'] == 'business' && !empty($arrData['comAddiCert'])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $arrComAddiCert = \Component\Member\MemberVO::reArrangeComAddiCertFiles($arrData['comAddiCert']); | |
| foreach ($arrComAddiCert as $index => $value) { | |
| // 신규 업로드 파일이 있으면 업로드, 업로드 없이 삭제 식별자만 있으면 기존 추가서류 삭제 | |
| if (!empty($value['tmp_name'])) { | |
| $companyCertificationService->uploadAdditional($value, $arrData['memNo'], $index); | |
| continue; | |
| } | |
| if (!empty($value['DeleteSno'])) { | |
| $companyCertificationService->delete((int)$value['DeleteSno']); | |
| } | |
| } | |
| } | |
| if ($before === null) { | |
| throw new \Exception(__('수정 전 회원정보가 없습니다.')); | |
| } | |
| StringUtils::strIsSet($arrData['maillingFl'], 'n'); | |
| StringUtils::strIsSet($arrData['smsFl'], 'n'); | |
| // validateMemberByAdminModification이 화이트리스트 필터링으로 file 관련 키들을 제거하므로 | |
| // validate 전 백업 후 validate 직후 복원 | |
| $preservedFileKeys = []; | |
| foreach (['comAddiCert', 'companyCertification', 'certificationDeleteSno'] as $fileKey) { | |
| if (array_key_exists($fileKey, $arrData)) { | |
| $preservedFileKeys[$fileKey] = $arrData[$fileKey]; | |
| } | |
| } | |
| $arrData = $this->validateMemberByAdminModification($arrData); | |
| foreach ($preservedFileKeys as $fileKey => $fileVal) { | |
| $arrData[$fileKey] = $fileVal; | |
| } | |
| //@formatter:off | |
| $arrBind = $db->get_binding(DBTableField::tableMember(), $arrData, 'update', gd_array_keys($arrData), ['memNo', 'memId', 'memPw',]); | |
| //@formatter:on | |
| $companyCertificationService->delete($arrData['certificationDeleteSno']); | |
| } | |
| // 추가 첨부 파일 업로드 (수정 흐름) | |
| if ($arrData['memberFl'] == 'business' && !empty($arrData['comAddiCert'])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $arrComAddiCert = \Component\Member\MemberVO::reArrangeComAddiCertFiles($arrData['comAddiCert']); | |
| foreach ($arrComAddiCert as $index => $value) { | |
| // 신규 업로드 파일이 있으면 업로드, 업로드 없이 삭제 식별자만 있으면 기존 추가서류 삭제 | |
| if (!empty($value['tmp_name'])) { | |
| $companyCertificationService->uploadAdditional($value, $arrData['memNo'], $index); | |
| continue; | |
| } | |
| if (!empty($value['DeleteSno'])) { | |
| $companyCertificationService->delete((int)$value['DeleteSno']); | |
| } | |
| } | |
| } | |
| if ($before === null) { | |
| throw new \Exception(__('수정 전 회원정보가 없습니다.')); | |
| } | |
변경 전MemberDAO.php
| { | |
| $this->db->strField = 'm.*, ms.snsJoinFl, IF(ms.connectFl=\'y\', ms.snsTypeFl, \'\') AS snsTypeFl, ms.connectFl, mcc.imageFileNm as companyCertification'; | |
| $this->db->strJoin = ' LEFT JOIN ' . DB_MEMBER_SNS . ' AS ms ON m.memNo = ms.memNo'; | |
| $this->db->strJoin .= ' LEFT JOIN ' . DB_MEMBER_COMPANY_CERTIFICATION . ' AS mcc ON m.memNo = mcc.memNo'; | |
| $this->db->strWhere = 'm.memNo=?'; | |
| $this->db->bind_param_push($bind, $this->fields['memNo'], $memberNo); | |
| $query = $this->db->query_complete(); | |
| { | |
| $this->db->strField = 'm.*, ms.snsJoinFl, IF(ms.connectFl=\'y\', ms.snsTypeFl, \'\') AS snsTypeFl, ms.connectFl, mcc.imageFileNm as companyCertification'; | |
| $this->db->strJoin = ' LEFT JOIN ' . DB_MEMBER_SNS . ' AS ms ON m.memNo = ms.memNo'; | |
| $this->db->strJoin .= ' LEFT JOIN ' . DB_MEMBER_COMPANY_CERTIFICATION . ' AS mcc ON m.memNo = mcc.memNo'; | |
| $this->db->strWhere = 'm.memNo=?'; | |
| $this->db->bind_param_push($bind, $this->fields['memNo'], $memberNo); | |
| $query = $this->db->query_complete(); | |
변경 후MemberDAO.php
| { | |
| $this->db->strField = 'm.*, ms.snsJoinFl, IF(ms.connectFl=\'y\', ms.snsTypeFl, \'\') AS snsTypeFl, ms.connectFl, mcc.imageFileNm as companyCertification'; | |
| $this->db->strJoin = ' LEFT JOIN ' . DB_MEMBER_SNS . ' AS ms ON m.memNo = ms.memNo'; | |
| $this->db->strJoin .= ' LEFT JOIN ' . DB_MEMBER_COMPANY_CERTIFICATION . ' AS mcc ON m.memNo = mcc.memNo AND mcc.documentType = \'registration\''; | |
| $this->db->strWhere = 'm.memNo=?'; | |
| $this->db->bind_param_push($bind, $this->fields['memNo'], $memberNo); | |
| $query = $this->db->query_complete(); | |
| { | |
| $this->db->strField = 'm.*, ms.snsJoinFl, IF(ms.connectFl=\'y\', ms.snsTypeFl, \'\') AS snsTypeFl, ms.connectFl, mcc.imageFileNm as companyCertification'; | |
| $this->db->strJoin = ' LEFT JOIN ' . DB_MEMBER_SNS . ' AS ms ON m.memNo = ms.memNo'; | |
| $this->db->strJoin .= ' LEFT JOIN ' . DB_MEMBER_COMPANY_CERTIFICATION . ' AS mcc ON m.memNo = mcc.memNo AND mcc.documentType = \'registration\''; | |
| $this->db->strWhere = 'm.memNo=?'; | |
| $this->db->bind_param_push($bind, $this->fields['memNo'], $memberNo); | |
| $query = $this->db->query_complete(); | |
변경 전Member.php
| use Bundle\Component\Godo\GodoKakaoServerApi; | |
| use Bundle\Component\Policy\KakaoLoginPolicy; | |
| use Component\Database\DBTableField; | |
| use Component\Member\Exception\LoginException; | |
| use Component\Facebook\Facebook; | |
| use Component\Godo\GodoNaverServerApi; | |
| // 사업자등록증 등록 | |
| if ($params['memberFl'] == 'business' && !empty($params['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->upload($params['comCertification'], $member['memNo']); | |
| } | |
| $session->del(Member::SESSION_JOIN_INFO); | |
| if ($member['mallSno'] == DEFAULT_MALL_NUMBER) { | |
| $this->benefitJoin($vo); | |
| // 사업자등록증 업로드 | |
| if ($vo->getMemberFl() === 'business' && !empty($vo->getCompanyCertification())) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->upload($vo->getCompanyCertification(), $memberNo); | |
| } | |
| } | |
| ); | |
| use Bundle\Component\Godo\GodoKakaoServerApi; | |
| use Bundle\Component\Policy\KakaoLoginPolicy; | |
| use Component\Database\DBTableField; | |
| use Component\Member\Exception\LoginException; | |
| use Component\Facebook\Facebook; | |
| use Component\Godo\GodoNaverServerApi; | |
| // 사업자등록증 등록 | |
| if ($params['memberFl'] == 'business' && !empty($params['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->upload($params['comCertification'], $member['memNo']); | |
| } | |
| $session->del(Member::SESSION_JOIN_INFO); | |
| if ($member['mallSno'] == DEFAULT_MALL_NUMBER) { | |
| * | |
| * @return int|string | |
| */ | |
| public function register(\Component\Member\MemberVO $vo) | |
| { | |
| $vo->databaseFormat(); | |
| $vo->setEntryDt(date('Y-m-d H:i:s')); | |
| $this->benefitJoin($vo); | |
| // 사업자등록증 업로드 | |
| if ($vo->getMemberFl() === 'business' && !empty($vo->getCompanyCertification())) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->upload($vo->getCompanyCertification(), $memberNo); | |
| } | |
| } | |
| ); | |
변경 후Member.php
| use Bundle\Component\Godo\GodoKakaoServerApi; | |
| use Bundle\Component\Policy\KakaoLoginPolicy; | |
| use Component\Database\DBTableField; | |
| use Component\Member\Company\CompanyCertification; | |
| use Component\Member\Exception\LoginException; | |
| use Component\Facebook\Facebook; | |
| use Component\Godo\GodoNaverServerApi; | |
| // 사업자등록증 등록 | |
| if ($params['memberFl'] == 'business' && !empty($params['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| $companyCertificationService->upload($params['comCertification'], $member['memNo']); | |
| } | |
| // 추가 첨부 등록 (comAddiCert) | |
| if ($params['memberFl'] == 'business' && !empty($vo->getComAddiCert())) { | |
| if (!isset($companyCertificationService)) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| } | |
| foreach ($vo->getComAddiCert() as $index => $value) { | |
| $companyCertificationService->uploadAdditional($value, $member['memNo'], $index); | |
| } | |
| } | |
| $session->del(Member::SESSION_JOIN_INFO); | |
| if ($member['mallSno'] == DEFAULT_MALL_NUMBER) { | |
| $this->benefitJoin($vo); | |
| // 사업자등록증 업로드 | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| if ($vo->getMemberFl() === 'business' && !empty($vo->getCompanyCertification())) { | |
| $companyCertificationService->upload($vo->getCompanyCertification(), $memberNo); | |
| } | |
| //추가 서류 업로드 | |
| if ($vo->getMemberFl() === 'business' && !empty($vo->getComAddiCert())) { | |
| foreach ($vo->getComAddiCert() as $index => $value) { | |
| $companyCertificationService->uploadAdditional($value, $memberNo, $index); | |
| } | |
| } | |
| } | |
| ); | |
| use Bundle\Component\Godo\GodoKakaoServerApi; | |
| use Bundle\Component\Policy\KakaoLoginPolicy; | |
| use Component\Database\DBTableField; | |
| use Component\Member\Company\CompanyCertification; | |
| use Component\Member\Exception\LoginException; | |
| use Component\Facebook\Facebook; | |
| use Component\Godo\GodoNaverServerApi; | |
| // 사업자등록증 등록 | |
| if ($params['memberFl'] == 'business' && !empty($params['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| $companyCertificationService->upload($params['comCertification'], $member['memNo']); | |
| } | |
| // 추가 첨부 등록 (comAddiCert) | |
| if ($params['memberFl'] == 'business' && !empty($vo->getComAddiCert())) { | |
| if (!isset($companyCertificationService)) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| } | |
| foreach ($vo->getComAddiCert() as $index => $value) { | |
| $companyCertificationService->uploadAdditional($value, $member['memNo'], $index); | |
| } | |
| } | |
| $session->del(Member::SESSION_JOIN_INFO); | |
| if ($member['mallSno'] == DEFAULT_MALL_NUMBER) { | |
| * | |
| * @return int|string | |
| */ | |
| public function register(MemberVO $vo) | |
| { | |
| $vo->databaseFormat(); | |
| $vo->setEntryDt(date('Y-m-d H:i:s')); | |
| $this->benefitJoin($vo); | |
| // 사업자등록증 업로드 | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| if ($vo->getMemberFl() === 'business' && !empty($vo->getCompanyCertification())) { | |
| $companyCertificationService->upload($vo->getCompanyCertification(), $memberNo); | |
| } | |
| //추가 서류 업로드 | |
| if ($vo->getMemberFl() === 'business' && !empty($vo->getComAddiCert())) { | |
| foreach ($vo->getComAddiCert() as $index => $value) { | |
| $companyCertificationService->uploadAdditional($value, $memberNo, $index); | |
| } | |
| } | |
| } | |
| ); | |
변경 전MemberVO.php
| protected $under14ConsentFl; | |
| protected $companyCertification; | |
| protected $certificationDeleteSno; | |
| function __construct(array $arr = null) | |
| { | |
| if (is_null($arr) === false) { | |
| foreach ($arr as $key => $value) { | |
| $this->$key = $value; | |
| } | |
| } | |
| } | |
| } | |
| public function toChecked() | |
| { | |
| $array = $this->toArray(); | |
| public function adminViewFormat() | |
| { | |
| // 사업자 번호가 DB에 저장될 때 - 가 없이 들어간 경우를 위한 체크 | |
| if (strpos($this->busiNo, '-') == false) { | |
| $this->busiNo = StringUtils::numberToBusiness($this->busiNo); | |
| } | |
| $arrData = $this->toArray(); | |
| if ($index === 'lastNotificationDt') { | |
| continue; | |
| } | |
| if ($index === 'busiNo' && strpos($item, '-') > -1) { | |
| $this->$index = explode('-', $item); | |
| } elseif ($index === 'email' && strpos($item, '@') > -1) { | |
| } | |
| } | |
| } | |
| protected $under14ConsentFl; | |
| protected $companyCertification; | |
| protected $certificationDeleteSno; | |
| function __construct(array $arr = null) | |
| { | |
| if (is_null($arr) === false) { | |
| foreach ($arr as $key => $value) { | |
| $this->$key = $value; | |
| } | |
| } | |
| } | |
| } | |
| public function toChecked() | |
| { | |
| $array = $this->toArray(); | |
| public function adminViewFormat() | |
| { | |
| // 사업자 번호가 DB에 저장될 때 - 가 없이 들어간 경우를 위한 체크 | |
| if (strpos($this->busiNo, '-') == false) { | |
| $this->busiNo = StringUtils::numberToBusiness($this->busiNo); | |
| } | |
| $arrData = $this->toArray(); | |
| if ($index === 'lastNotificationDt') { | |
| continue; | |
| } | |
| if ($index === 'busiNo' && strpos($item, '-') > -1) { | |
| $this->$index = explode('-', $item); | |
| } elseif ($index === 'email' && strpos($item, '@') > -1) { | |
| } | |
| } | |
| } | |
변경 후MemberVO.php
| protected $under14ConsentFl; | |
| protected $companyCertification; | |
| protected $certificationDeleteSno; | |
| protected $comAddiCert; | |
| function __construct(array $arr = null) | |
| { | |
| if (is_null($arr) === false) { | |
| foreach ($arr as $key => $value) { | |
| // 추가 첨부 파일은 PHP $_FILES의 transposed nested 구조를 정상 nested 구조로 변환 | |
| if ($key === 'comAddiCert' && is_array($value)) { | |
| $value = self::reArrangeComAddiCertFiles($value); | |
| } | |
| $this->$key = $value; | |
| } | |
| } | |
| } | |
| } | |
| /** | |
| * 추가 첨부 파일($_FILES['comAddiCert'])의 transposed 구조를 정상 file array로 변환 | |
| * | |
| * @param array $files | |
| * @return array | |
| */ | |
| public static function reArrangeComAddiCertFiles(array $files): array | |
| { | |
| if (!isset($files['name']) || !is_array($files['name'])) { | |
| return $files; | |
| } | |
| $keys = array_keys($files); | |
| $result = []; | |
| foreach ($files['name'] as $index => $fields) { | |
| if (!is_array($fields) || !isset($fields['file'])) { | |
| continue; | |
| } | |
| $fileData = []; | |
| foreach ($keys as $k) { | |
| $value = $files[$k][$index]['file'] ?? null; | |
| if (is_array($value)) { | |
| $value = $value[0] ?? null; | |
| } | |
| $fileData[$k] = [$value]; | |
| } | |
| if ((int)($fileData['error'][0] ?? UPLOAD_ERR_NO_FILE) === UPLOAD_ERR_NO_FILE) { | |
| continue; | |
| } | |
| $result[$index] = $fileData; | |
| } | |
| return $result; | |
| } | |
| public function toChecked() | |
| { | |
| $array = $this->toArray(); | |
| public function adminViewFormat() | |
| { | |
| // 사업자 번호가 DB에 저장될 때 - 가 없이 들어간 경우를 위한 체크 | |
| if (is_string($this->busiNo) && strpos($this->busiNo, '-') == false) { | |
| $this->busiNo = StringUtils::numberToBusiness($this->busiNo); | |
| } | |
| $arrData = $this->toArray(); | |
| if ($index === 'lastNotificationDt') { | |
| continue; | |
| } | |
| // PHP 8: strpos는 string만 허용. 이미 array로 변환된 필드(busiNo, email 등 재진입 케이스) 보호 | |
| if (!is_string($item)) { | |
| continue; | |
| } | |
| if ($index === 'busiNo' && strpos($item, '-') > -1) { | |
| $this->$index = explode('-', $item); | |
| } elseif ($index === 'email' && strpos($item, '@') > -1) { | |
| } | |
| } | |
| /** | |
| * @return mixed | |
| */ | |
| public function getComAddiCert() | |
| { | |
| return $this->comAddiCert; | |
| } | |
| } | |
| protected $under14ConsentFl; | |
| protected $companyCertification; | |
| protected $certificationDeleteSno; | |
| protected $comAddiCert; | |
| function __construct(array $arr = null) | |
| { | |
| if (is_null($arr) === false) { | |
| foreach ($arr as $key => $value) { | |
| // 추가 첨부 파일은 PHP $_FILES의 transposed nested 구조를 정상 nested 구조로 변환 | |
| if ($key === 'comAddiCert' && is_array($value)) { | |
| $value = self::reArrangeComAddiCertFiles($value); | |
| } | |
| $this->$key = $value; | |
| } | |
| } | |
| } | |
| } | |
| /** | |
| * 추가 첨부 파일($_FILES['comAddiCert'])의 transposed 구조를 정상 file array로 변환 | |
| * | |
| * @param array $files | |
| * @return array | |
| */ | |
| public static function reArrangeComAddiCertFiles(array $files): array | |
| { | |
| if (!isset($files['name']) || !is_array($files['name'])) { | |
| return $files; | |
| } | |
| $keys = array_keys($files); | |
| $result = []; | |
| foreach ($files['name'] as $index => $fields) { | |
| if (!is_array($fields) || !isset($fields['file'])) { | |
| continue; | |
| } | |
| $fileData = []; | |
| foreach ($keys as $k) { | |
| $value = $files[$k][$index]['file'] ?? null; | |
| if (is_array($value)) { | |
| $value = $value[0] ?? null; | |
| } | |
| $fileData[$k] = [$value]; | |
| } | |
| if ((int)($fileData['error'][0] ?? UPLOAD_ERR_NO_FILE) === UPLOAD_ERR_NO_FILE) { | |
| continue; | |
| } | |
| $result[$index] = $fileData; | |
| } | |
| return $result; | |
| } | |
| public function toChecked() | |
| { | |
| $array = $this->toArray(); | |
| public function adminViewFormat() | |
| { | |
| // 사업자 번호가 DB에 저장될 때 - 가 없이 들어간 경우를 위한 체크 | |
| if (is_string($this->busiNo) && strpos($this->busiNo, '-') == false) { | |
| $this->busiNo = StringUtils::numberToBusiness($this->busiNo); | |
| } | |
| $arrData = $this->toArray(); | |
| if ($index === 'lastNotificationDt') { | |
| continue; | |
| } | |
| // PHP 8: strpos는 string만 허용. 이미 array로 변환된 필드(busiNo, email 등 재진입 케이스) 보호 | |
| if (!is_string($item)) { | |
| continue; | |
| } | |
| if ($index === 'busiNo' && strpos($item, '-') > -1) { | |
| $this->$index = explode('-', $item); | |
| } elseif ($index === 'email' && strpos($item, '@') > -1) { | |
| } | |
| } | |
| /** | |
| * @return mixed | |
| */ | |
| public function getComAddiCert() | |
| { | |
| return $this->comAddiCert; | |
| } | |
| } | |
변경 전MyPage.php
| use App; | |
| use Component\Database\DBTableField; | |
| use Component\Mail\MailMimeAuto; | |
| use Component\Member\Util\MemberUtil; | |
| use Component\Validator\Validator; | |
| use Component\Agreement\BuyerInform; | |
| if ($result == 1) { | |
| // 사업자등록증 등록/삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->upload($requestParams['comCertification'], $requestParams['memNo']); | |
| } | |
| // 사업자등록증 삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['certificationDeleteSno'])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->delete($requestParams['certificationDeleteSno']); | |
| } | |
| } | |
| $memberWithGroup = $this->memberDao->selectMemberWithGroup($requestParams['memNo'], 'memNo'); | |
| if ($requestParams['comCertification'] != '') { | |
| $v->add('comCertification', ''); | |
| } | |
| if ($v->act($requestParams, true) === false) { | |
| if (gd_array_key_exists('memPw', $v->errors) && gd_array_key_exists('memPwRe', $v->errors)) { | |
| unset($v->errors['memPwRe']); | |
| use App; | |
| use Component\Database\DBTableField; | |
| use Component\Mail\MailMimeAuto; | |
| use Component\Member\Util\MemberUtil; | |
| use Component\Validator\Validator; | |
| use Component\Agreement\BuyerInform; | |
| if ($result == 1) { | |
| // 사업자등록증 등록/삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->upload($requestParams['comCertification'], $requestParams['memNo']); | |
| } | |
| // 사업자등록증 삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['certificationDeleteSno'])) { | |
| $companyCertificationService = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $companyCertificationService->delete($requestParams['certificationDeleteSno']); | |
| } | |
| } | |
| $memberWithGroup = $this->memberDao->selectMemberWithGroup($requestParams['memNo'], 'memNo'); | |
| if ($requestParams['comCertification'] != '') { | |
| $v->add('comCertification', ''); | |
| } | |
| if ($v->act($requestParams, true) === false) { | |
| if (gd_array_key_exists('memPw', $v->errors) && gd_array_key_exists('memPwRe', $v->errors)) { | |
| unset($v->errors['memPwRe']); | |
변경 후MyPage.php
| use App; | |
| use Component\Member\MemberVO; | |
| use Component\Database\DBTableField; | |
| use Component\Mail\MailMimeAuto; | |
| use Component\Member\Company\CompanyCertification; | |
| use Component\Member\Util\MemberUtil; | |
| use Component\Validator\Validator; | |
| use Component\Agreement\BuyerInform; | |
| if ($result == 1) { | |
| // 사업자등록증 등록/삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| $companyCertificationService->upload($requestParams['comCertification'], $requestParams['memNo']); | |
| } | |
| // 사업자등록증 삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['certificationDeleteSno'])) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| $companyCertificationService->delete($requestParams['certificationDeleteSno']); | |
| } | |
| // 추가 첨부 등록 (comAddiCert) | |
| // $requestParams['comAddiCert'] 는 컨트롤러에서 array_merge(POST, FILES) 시 FILES 가 덮어써서 transposed 구조로 들어옴 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['comAddiCert'])) { | |
| if (!isset($companyCertificationService)) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| } | |
| $arrComAddiCert = MemberVO::reArrangeComAddiCertFiles($requestParams['comAddiCert']); | |
| foreach ($arrComAddiCert as $index => $value) { | |
| $companyCertificationService->uploadAdditional($value, $requestParams['memNo'], $index); | |
| } | |
| } | |
| // 추가 첨부 삭제 (comAddiCert[N][DeleteSno]) | |
| // POST 는 array_merge 시 FILES 에 덮여 손실되므로, Request 에서 POST 만 따로 읽는다 | |
| if ($requestParams['memberFl'] == 'business') { | |
| $postComAddiCert = \App::getInstance('request')->post()->all()['comAddiCert'] ?? []; | |
| if (!empty($postComAddiCert) && is_array($postComAddiCert)) { | |
| if (!isset($companyCertificationService)) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| } | |
| foreach ($postComAddiCert as $item) { | |
| if (!empty($item['DeleteSno'])) { | |
| $companyCertificationService->delete((int)$item['DeleteSno']); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| $memberWithGroup = $this->memberDao->selectMemberWithGroup($requestParams['memNo'], 'memNo'); | |
| if ($requestParams['comCertification'] != '') { | |
| $v->add('comCertification', ''); | |
| } | |
| if (!empty($requestParams['comAddiCert'])) { | |
| $v->add('comAddiCert', ''); | |
| } | |
| if ($v->act($requestParams, true) === false) { | |
| if (gd_array_key_exists('memPw', $v->errors) && gd_array_key_exists('memPwRe', $v->errors)) { | |
| unset($v->errors['memPwRe']); | |
| use App; | |
| use Component\Member\MemberVO; | |
| use Component\Database\DBTableField; | |
| use Component\Mail\MailMimeAuto; | |
| use Component\Member\Company\CompanyCertification; | |
| use Component\Member\Util\MemberUtil; | |
| use Component\Validator\Validator; | |
| use Component\Agreement\BuyerInform; | |
| if ($result == 1) { | |
| // 사업자등록증 등록/삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['comCertification']['name'][0])) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| $companyCertificationService->upload($requestParams['comCertification'], $requestParams['memNo']); | |
| } | |
| // 사업자등록증 삭제 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['certificationDeleteSno'])) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| $companyCertificationService->delete($requestParams['certificationDeleteSno']); | |
| } | |
| // 추가 첨부 등록 (comAddiCert) | |
| // $requestParams['comAddiCert'] 는 컨트롤러에서 array_merge(POST, FILES) 시 FILES 가 덮어써서 transposed 구조로 들어옴 | |
| if ($requestParams['memberFl'] == 'business' && !empty($requestParams['comAddiCert'])) { | |
| if (!isset($companyCertificationService)) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| } | |
| $arrComAddiCert = MemberVO::reArrangeComAddiCertFiles($requestParams['comAddiCert']); | |
| foreach ($arrComAddiCert as $index => $value) { | |
| $companyCertificationService->uploadAdditional($value, $requestParams['memNo'], $index); | |
| } | |
| } | |
| // 추가 첨부 삭제 (comAddiCert[N][DeleteSno]) | |
| // POST 는 array_merge 시 FILES 에 덮여 손실되므로, Request 에서 POST 만 따로 읽는다 | |
| if ($requestParams['memberFl'] == 'business') { | |
| $postComAddiCert = \App::getInstance('request')->post()->all()['comAddiCert'] ?? []; | |
| if (!empty($postComAddiCert) && is_array($postComAddiCert)) { | |
| if (!isset($companyCertificationService)) { | |
| $companyCertificationService = \App::getInstance(CompanyCertification::class); | |
| } | |
| foreach ($postComAddiCert as $item) { | |
| if (!empty($item['DeleteSno'])) { | |
| $companyCertificationService->delete((int)$item['DeleteSno']); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| $memberWithGroup = $this->memberDao->selectMemberWithGroup($requestParams['memNo'], 'memNo'); | |
| if ($requestParams['comCertification'] != '') { | |
| $v->add('comCertification', ''); | |
| } | |
| if (!empty($requestParams['comAddiCert'])) { | |
| $v->add('comAddiCert', ''); | |
| } | |
| if ($v->act($requestParams, true) === false) { | |
| if (gd_array_key_exists('memPw', $v->errors) && gd_array_key_exists('memPwRe', $v->errors)) { | |
| unset($v->errors['memPwRe']); | |
변경 전JoinItemPolicy.php
| throw new \Exception(__('회원정보 변경 시 추천인아이디 등록 불가는 추천인아이디 항목을 사용하여야 합니다')); | |
| } | |
| if (isset($getValue['certificationFileSize']) && $getValue['certificationFileSize'] !== '') { | |
| if (!is_int((int)$getValue['certificationFileSize']) || $getValue['certificationFileSize'] < self::MIN_COMPANY_CERTIFICATION_FILE_SIZE || $getValue['certificationFileSize'] > self::MAX_COMPANY_CERTIFICATION_FILE_SIZE) { | |
| throw new \Exception(sprintf(__('업로드 용량은 최소 %dMB 부터 %dMB 까지 정수로 설정할 수 있습니다.'), self::MIN_COMPANY_CERTIFICATION_FILE_SIZE, self::MAX_COMPANY_CERTIFICATION_FILE_SIZE)); | |
| } | |
| $getValue['comCertification']['maxSize'] = $getValue['certificationFileSize']; | |
| } | |
| unset($getValue['certificationFileSize']); | |
| $getValue['memPw']['minlen'] = 10; | |
| return $totalInfo; | |
| } | |
| } | |
| throw new \Exception(__('회원정보 변경 시 추천인아이디 등록 불가는 추천인아이디 항목을 사용하여야 합니다')); | |
| } | |
| if (isset($getValue['certificationFileSize']) && $getValue['certificationFileSize'] !== '') { | |
| if (!is_int((int)$getValue['certificationFileSize']) || $getValue['certificationFileSize'] < self::MIN_COMPANY_CERTIFICATION_FILE_SIZE || $getValue['certificationFileSize'] > self::MAX_COMPANY_CERTIFICATION_FILE_SIZE) { | |
| throw new \Exception(sprintf(__('업로드 용량은 최소 %dMB 부터 %dMB 까지 정수로 설정할 수 있습니다.'), self::MIN_COMPANY_CERTIFICATION_FILE_SIZE, self::MAX_COMPANY_CERTIFICATION_FILE_SIZE)); | |
| } | |
| $getValue['comCertification']['maxSize'] = $getValue['certificationFileSize']; | |
| } | |
| unset($getValue['certificationFileSize']); | |
| $getValue['memPw']['minlen'] = 10; | |
| return $totalInfo; | |
| } | |
| } | |
변경 후JoinItemPolicy.php
| throw new \Exception(__('회원정보 변경 시 추천인아이디 등록 불가는 추천인아이디 항목을 사용하여야 합니다')); | |
| } | |
| if (isset($getValue['certificationFileSize']) && $getValue['certificationFileSize'] !== '') { | |
| $this->validUploadFileSize($getValue); | |
| $getValue['comCertification']['maxSize'] = $getValue['certificationFileSize']; | |
| } | |
| foreach ($getValue['comAddiCert'] as $index => $value) { | |
| if (isset($value['certificationFileSize']) && $value['certificationFileSize'] !== '') { | |
| $this->validUploadFileSize($value); | |
| $getValue["comAddiCert$index"] = $value; | |
| } | |
| } | |
| unset($getValue['comAddiCert']); | |
| unset($getValue['certificationFileSize']); | |
| $getValue['memPw']['minlen'] = 10; | |
| return $totalInfo; | |
| } | |
| private function validUploadFileSize(array $value) | |
| { | |
| if ( | |
| !is_int((int)$value['certificationFileSize']) || | |
| $value['certificationFileSize'] < self::MIN_COMPANY_CERTIFICATION_FILE_SIZE || | |
| $value['certificationFileSize'] > self::MAX_COMPANY_CERTIFICATION_FILE_SIZE | |
| ) { | |
| throw new \Exception(sprintf(__('업로드 용량은 최소 %dMB 부터 %dMB 까지 정수로 설정할 수 있습니다.'), self::MIN_COMPANY_CERTIFICATION_FILE_SIZE, self::MAX_COMPANY_CERTIFICATION_FILE_SIZE)); | |
| } | |
| } | |
| } | |
| throw new \Exception(__('회원정보 변경 시 추천인아이디 등록 불가는 추천인아이디 항목을 사용하여야 합니다')); | |
| } | |
| if (isset($getValue['certificationFileSize']) && $getValue['certificationFileSize'] !== '') { | |
| $this->validUploadFileSize($getValue); | |
| $getValue['comCertification']['maxSize'] = $getValue['certificationFileSize']; | |
| } | |
| foreach ($getValue['comAddiCert'] as $index => $value) { | |
| if (isset($value['certificationFileSize']) && $value['certificationFileSize'] !== '') { | |
| $this->validUploadFileSize($value); | |
| $getValue["comAddiCert$index"] = $value; | |
| } | |
| } | |
| unset($getValue['comAddiCert']); | |
| unset($getValue['certificationFileSize']); | |
| $getValue['memPw']['minlen'] = 10; | |
| return $totalInfo; | |
| } | |
| private function validUploadFileSize(array $value) | |
| { | |
| if ( | |
| !is_int((int)$value['certificationFileSize']) || | |
| $value['certificationFileSize'] < self::MIN_COMPANY_CERTIFICATION_FILE_SIZE || | |
| $value['certificationFileSize'] > self::MAX_COMPANY_CERTIFICATION_FILE_SIZE | |
| ) { | |
| throw new \Exception(sprintf(__('업로드 용량은 최소 %dMB 부터 %dMB 까지 정수로 설정할 수 있습니다.'), self::MIN_COMPANY_CERTIFICATION_FILE_SIZE, self::MAX_COMPANY_CERTIFICATION_FILE_SIZE)); | |
| } | |
| } | |
| } | |
변경 전CompanyCertificationPsController.php
| namespace Bundle\Controller\Admin\Member; | |
| use Bundle\Controller\Admin\Controller; | |
| use Framework\Debug\Exception\AlertOnlyException; | |
| $request = \App::getInstance('request'); | |
| $postData = $request->post()->toArray(); | |
| $service = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| try { | |
| switch ($postData['mode']) { | |
| case 'setting': | |
| $result = $service->setCompanyCertificationFileSize($postData['fileSize']); | |
| $this->json(['result' => $result]); | |
| default: | |
| break; | |
| namespace Bundle\Controller\Admin\Member; | |
| use Bundle\Controller\Admin\Controller; | |
| use Framework\Debug\Exception\AlertOnlyException; | |
| $request = \App::getInstance('request'); | |
| $postData = $request->post()->toArray(); | |
| $service = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| try { | |
| switch ($postData['mode']) { | |
| case 'setting': | |
| $result = $service->setCompanyCertificationFileSize($postData['fileSize']); | |
| $this->json(['result' => $result]); | |
| default: | |
| break; | |
변경 후CompanyCertificationPsController.php
| namespace Bundle\Controller\Admin\Member; | |
| use Component\Member\Company\CompanyCertification; | |
| use Bundle\Controller\Admin\Controller; | |
| use Framework\Debug\Exception\AlertOnlyException; | |
| $request = \App::getInstance('request'); | |
| $postData = $request->post()->toArray(); | |
| /** @var \Bundle\Component\Member\Company\CompanyCertification */ | |
| $service = \App::getInstance(CompanyCertification::class); | |
| try { | |
| switch ($postData['mode']) { | |
| case 'setting': | |
| $result = $service->setCompanyCertificationFileSizeByKey($postData['fileSize'], $postData['key']); | |
| $this->json(['result' => $result]); | |
| default: | |
| break; | |
| namespace Bundle\Controller\Admin\Member; | |
| use Component\Member\Company\CompanyCertification; | |
| use Bundle\Controller\Admin\Controller; | |
| use Framework\Debug\Exception\AlertOnlyException; | |
| $request = \App::getInstance('request'); | |
| $postData = $request->post()->toArray(); | |
| /** @var \Bundle\Component\Member\Company\CompanyCertification */ | |
| $service = \App::getInstance(CompanyCertification::class); | |
| try { | |
| switch ($postData['mode']) { | |
| case 'setting': | |
| $result = $service->setCompanyCertificationFileSizeByKey($postData['fileSize'], $postData['key']); | |
| $this->json(['result' => $result]); | |
| default: | |
| break; | |
변경 전LayerCompanyCertificationSettingController.php
| namespace Bundle\Controller\Admin\Member; | |
| use Bundle\Controller\Admin\Controller; | |
| /** | |
| * 사업자 등록증 설정 관련 컨트롤러 | |
| public function index() | |
| { | |
| try { | |
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $fileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('fileSize', $fileSize); | |
| $this->getView()->setDefine('layout', 'layout_layer.php'); | |
| $this->getView()->setPageName('member/layer_company_certification_setting.php'); | |
| } catch (\Throwable $e) { | |
| \Logger::warning('사업자 등록증 설정 페이지 로딩 중 오류 발생: ' . $e->getMessage()); | |
| throw $e; | |
| } | |
| } | |
| namespace Bundle\Controller\Admin\Member; | |
| use Bundle\Controller\Admin\Controller; | |
| /** | |
| * 사업자 등록증 설정 관련 컨트롤러 | |
| public function index() | |
| { | |
| try { | |
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $fileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('fileSize', $fileSize); | |
| $this->getView()->setDefine('layout', 'layout_layer.php'); | |
| $this->getView()->setPageName('member/layer_company_certification_setting.php'); | |
| } catch (\Throwable $e) { | |
| \Logger::warning('사업자 등록증 설정 페이지 로딩 중 오류 발생: ' . $e->getMessage()); | |
| throw $e; | |
| } | |
| } | |
변경 후LayerCompanyCertificationSettingController.php
| namespace Bundle\Controller\Admin\Member; | |
| use Component\Member\Company\CompanyCertification; | |
| use Bundle\Controller\Admin\Controller; | |
| use Framework\Http\Request; | |
| /** | |
| * 사업자 등록증 설정 관련 컨트롤러 | |
| public function index() | |
| { | |
| try { | |
| /** @var Request $request */ | |
| $request = \App::getInstance('request'); | |
| /** @var \Bundle\Component\Member\Company\CompanyCertification $companyCertification */ | |
| $companyCertification = \App::getInstance(CompanyCertification::class); | |
| $key = $request->get()->get('type') ?? "comCertification"; | |
| $index = $request->get()->get('index') ?? ""; | |
| $fileSize = $companyCertification->getCompanyCertificationFileSizeByKey($key.$index); | |
| $this->setData('fileSize', $fileSize); | |
| $this->setData('key', $key.$index); | |
| $this->getView()->setDefine('layout', 'layout_layer.php'); | |
| $this->getView()->setPageName('member/layer_company_certification_setting.php'); | |
| } catch (\Throwable $e) { | |
| \Logger::warning('사업자 회원 파일등록 페이지 로딩중 오류 발생 : ' . $e->getMessage()); | |
| throw $e; | |
| } | |
| } | |
| namespace Bundle\Controller\Admin\Member; | |
| use Component\Member\Company\CompanyCertification; | |
| use Bundle\Controller\Admin\Controller; | |
| use Framework\Http\Request; | |
| /** | |
| * 사업자 등록증 설정 관련 컨트롤러 | |
| public function index() | |
| { | |
| try { | |
| /** @var Request $request */ | |
| $request = \App::getInstance('request'); | |
| /** @var \Bundle\Component\Member\Company\CompanyCertification $companyCertification */ | |
| $companyCertification = \App::getInstance(CompanyCertification::class); | |
| $key = $request->get()->get('type') ?? "comCertification"; | |
| $index = $request->get()->get('index') ?? ""; | |
| $fileSize = $companyCertification->getCompanyCertificationFileSizeByKey($key.$index); | |
| $this->setData('fileSize', $fileSize); | |
| $this->setData('key', $key.$index); | |
| $this->getView()->setDefine('layout', 'layout_layer.php'); | |
| $this->getView()->setPageName('member/layer_company_certification_setting.php'); | |
| } catch (\Throwable $e) { | |
| \Logger::warning('사업자 회원 파일등록 페이지 로딩중 오류 발생 : ' . $e->getMessage()); | |
| throw $e; | |
| } | |
| } | |
변경 전MemberJoinitemController.php
| */ | |
| namespace Bundle\Controller\Admin\Member; | |
| /** | |
| * Class 회원가입항목설정 | |
| * @package Controller\Admin\Policy | |
| $policy['interestCnt'] = $code->codeFetch('getCodeCount', '01001'); | |
| $policy['jobCnt'] = $code->codeFetch('getCodeCount', '01002'); | |
| /** set view data */ | |
| $this->setData('data', $policy); | |
| $this->setData('mall', ['mallSno' => $mallSno]); | |
| } | |
| } | |
| */ | |
| namespace Bundle\Controller\Admin\Member; | |
| /** | |
| * Class 회원가입항목설정 | |
| * @package Controller\Admin\Policy | |
| $policy['interestCnt'] = $code->codeFetch('getCodeCount', '01001'); | |
| $policy['jobCnt'] = $code->codeFetch('getCodeCount', '01002'); | |
| /** set view data */ | |
| $this->setData('data', $policy); | |
| $this->setData('mall', ['mallSno' => $mallSno]); | |
| } | |
| } | |
변경 후MemberJoinitemController.php
| */ | |
| namespace Bundle\Controller\Admin\Member; | |
| use Component\Member\Company\CompanyCertification; | |
| /** | |
| * Class 회원가입항목설정 | |
| * @package Controller\Admin\Policy | |
| $policy['interestCnt'] = $code->codeFetch('getCodeCount', '01001'); | |
| $policy['jobCnt'] = $code->codeFetch('getCodeCount', '01002'); | |
| // 사업자 추가 제출 서류 최대 개수 | |
| $companyCertification = \App::getInstance(CompanyCertification::class); | |
| /** set view data */ | |
| $this->setData('data', $policy); | |
| $this->setData('mall', ['mallSno' => $mallSno]); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| $this->setData('defaultCertificationFileSize', CompanyCertification::DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE); | |
| } | |
| } | |
| */ | |
| namespace Bundle\Controller\Admin\Member; | |
| use Component\Member\Company\CompanyCertification; | |
| /** | |
| * Class 회원가입항목설정 | |
| * @package Controller\Admin\Policy | |
| $policy['interestCnt'] = $code->codeFetch('getCodeCount', '01001'); | |
| $policy['jobCnt'] = $code->codeFetch('getCodeCount', '01002'); | |
| // 사업자 추가 제출 서류 최대 개수 | |
| $companyCertification = \App::getInstance(CompanyCertification::class); | |
| /** set view data */ | |
| $this->setData('data', $policy); | |
| $this->setData('mall', ['mallSno' => $mallSno]); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| $this->setData('defaultCertificationFileSize', CompanyCertification::DEFAULT_COMPANY_CERTIFICATION_FILE_SIZE); | |
| } | |
| } | |
변경 전MemberModifyController.php
| $certification = $companyCertification->getCertification($memNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('mode', 'modify'); | |
| $this->setData('joinField', \Component\Member\Util\MemberUtil::getJoinField($memberData['mallSno'])); | |
| $this->setData('htmlExtra', \Component\Member\Util\MemberUtil::makeExtraField($memberData)); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } catch (\Exception $e) { | |
| $logger = \App::getInstance('logger'); | |
| $logger->error($e->getTraceAsString()); | |
| $certification = $companyCertification->getCertification($memNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('mode', 'modify'); | |
| $this->setData('joinField', \Component\Member\Util\MemberUtil::getJoinField($memberData['mallSno'])); | |
| $this->setData('htmlExtra', \Component\Member\Util\MemberUtil::makeExtraField($memberData)); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } catch (\Exception $e) { | |
| $logger = \App::getInstance('logger'); | |
| $logger->error($e->getTraceAsString()); | |
변경 후MemberModifyController.php
| $certification = $companyCertification->getCertification($memNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $additionalCertification = $companyCertification->getAdditionalData(); | |
| foreach ($additionalCertification as $key => $value) { | |
| $additionalCertification[$key]['file'] = $companyCertification->getCertificationByMemNoAndType($memNo, $key); | |
| } | |
| $this->setData('mode', 'modify'); | |
| $this->setData('joinField', \Component\Member\Util\MemberUtil::getJoinField($memberData['mallSno'])); | |
| $this->setData('htmlExtra', \Component\Member\Util\MemberUtil::makeExtraField($memberData)); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('additionalCertification',$additionalCertification); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| } catch (\Exception $e) { | |
| $logger = \App::getInstance('logger'); | |
| $logger->error($e->getTraceAsString()); | |
| $certification = $companyCertification->getCertification($memNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $additionalCertification = $companyCertification->getAdditionalData(); | |
| foreach ($additionalCertification as $key => $value) { | |
| $additionalCertification[$key]['file'] = $companyCertification->getCertificationByMemNoAndType($memNo, $key); | |
| } | |
| $this->setData('mode', 'modify'); | |
| $this->setData('joinField', \Component\Member\Util\MemberUtil::getJoinField($memberData['mallSno'])); | |
| $this->setData('htmlExtra', \Component\Member\Util\MemberUtil::makeExtraField($memberData)); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('additionalCertification',$additionalCertification); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| } catch (\Exception $e) { | |
| $logger = \App::getInstance('logger'); | |
| $logger->error($e->getTraceAsString()); | |
변경 전MemberRegisterController.php
| $this->setData('data', $member); | |
| $this->setData('checked', $vo->toChecked()); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } | |
| } | |
| $this->setData('data', $member); | |
| $this->setData('checked', $vo->toChecked()); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } | |
| } | |
변경 후MemberRegisterController.php
| $this->setData('data', $member); | |
| $this->setData('checked', $vo->toChecked()); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('additionalCertification',$companyCertification->getAdditionalData()); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| } | |
| } | |
| $this->setData('data', $member); | |
| $this->setData('checked', $vo->toChecked()); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('additionalCertification',$companyCertification->getAdditionalData()); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| } | |
| } | |
변경 전MemberCrmDetailController.php
| $certification = $companyCertification->getCertification($memberNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| // 설치앱 디바이스 정보 및 설치 혜택 여부 | |
| $this->setMyAppDeviceInfo($memberNo); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } | |
| } | |
| $certification = $companyCertification->getCertification($memberNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| // 설치앱 디바이스 정보 및 설치 혜택 여부 | |
| $this->setMyAppDeviceInfo($memberNo); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } | |
| } | |
변경 후MemberCrmDetailController.php
| $certification = $companyCertification->getCertification($memberNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $additionalCertification = $companyCertification->getAdditionalData(); | |
| foreach ($additionalCertification as $key => $value) { | |
| $additionalCertification[$key]['file'] = $companyCertification->getCertificationByMemNoAndType($memberNo, $key); | |
| } | |
| // 설치앱 디바이스 정보 및 설치 혜택 여부 | |
| $this->setMyAppDeviceInfo($memberNo); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('additionalCertification', $additionalCertification); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| } | |
| } | |
| $certification = $companyCertification->getCertification($memberNo); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $additionalCertification = $companyCertification->getAdditionalData(); | |
| foreach ($additionalCertification as $key => $value) { | |
| $additionalCertification[$key]['file'] = $companyCertification->getCertificationByMemNoAndType($memberNo, $key); | |
| } | |
| // 설치앱 디바이스 정보 및 설치 혜택 여부 | |
| $this->setMyAppDeviceInfo($memberNo); | |
| $this->setData('hidePasswordBlock', $hidePasswordBlock); | |
| $this->setData('certification', $certification); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('additionalCertification', $additionalCertification); | |
| $this->setData('certificationAdditionalFileCount', $companyCertification->getCompanyAddiCertificationFileCount()); | |
| } | |
| } | |
변경 전JoinController.php
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->addScript($scripts); | |
| $this->addCss($styles); | |
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->addScript($scripts); | |
| $this->addCss($styles); | |
변경 후JoinController.php
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('comAddiCerts', $companyCertification->getAdditionalData()); | |
| $this->addScript($scripts); | |
| $this->addCss($styles); | |
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('comAddiCerts', $companyCertification->getAdditionalData()); | |
| $this->addScript($scripts); | |
| $this->addCss($styles); | |
변경 전MyPageController.php
| $this->setData('comCertification', $certification); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } catch (Exception $e) { | |
| throw new AlertBackException($e->getMessage(), $e->getCode(), $e); | |
| } | |
| $this->setData('comCertification', $certification); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| } catch (Exception $e) { | |
| throw new AlertBackException($e->getMessage(), $e->getCode(), $e); | |
| } | |
변경 후MyPageController.php
| $this->setData('comCertification', $certification); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| // 추가 첨부 항목 조회 (정책 + 회원별 등록 파일 정보) | |
| $comAddiCerts = $companyCertification->getAdditionalData(); | |
| foreach ($comAddiCerts as $key => $value) { | |
| $comAddiCerts[$key]['file'] = $companyCertification->getCertificationByMemNoAndType($memberData['memNo'], $key); | |
| } | |
| $this->setData('comAddiCerts', $comAddiCerts); | |
| } catch (Exception $e) { | |
| throw new AlertBackException($e->getMessage(), $e->getCode(), $e); | |
| } | |
| $this->setData('comCertification', $certification); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| // 추가 첨부 항목 조회 (정책 + 회원별 등록 파일 정보) | |
| $comAddiCerts = $companyCertification->getAdditionalData(); | |
| foreach ($comAddiCerts as $key => $value) { | |
| $comAddiCerts[$key]['file'] = $companyCertification->getCertificationByMemNoAndType($memberData['memNo'], $key); | |
| } | |
| $this->setData('comAddiCerts', $comAddiCerts); | |
| } catch (Exception $e) { | |
| throw new AlertBackException($e->getMessage(), $e->getCode(), $e); | |
| } | |
변경 전JoinController.php
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->addScript($scripts); | |
| } | |
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->addScript($scripts); | |
| } | |
변경 후JoinController.php
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('comAddiCerts', $companyCertification->getAdditionalData()); | |
| $this->addScript($scripts); | |
| } | |
| $companyCertification = \App::getInstance(\Component\Member\Company\CompanyCertification::class); | |
| $certificationMaxFileSize = $companyCertification->getCompanyCertificationFileSize(); | |
| $this->setData('certificationMaxFileSize', $certificationMaxFileSize); | |
| $this->setData('comAddiCerts', $companyCertification->getAdditionalData()); | |
| $this->addScript($scripts); | |
| } | |
변경 전CompanyCertificationInsertDTO.php
| */ | |
| namespace Bundle\DTO\Member; | |
| /** | |
| * 사업자 등록증 DB 저장 DTO | |
| */ | |
| class CompanyCertificationInsertDTO extends \Origin\DTO\AbstractDTO | |
| { | |
| private $memNo; | |
| private $imageFileNm; | |
| private $imageFilePath; | |
| private $regDt; | |
| /** | |
| * @param int $memNo | |
| * @param array $result | |
| */ | |
| public function __construct(int $memNo, array $result) | |
| { | |
| $this->memNo = $memNo; | |
| $this->imageFileNm = $result['fileName'] ?? ''; | |
| $this->imageFilePath = $result['filePath'] ?? ''; | |
| $this->regDt = date('Y-m-d H:i:s'); | |
| } | |
| /** | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getRegDt(): string | |
| { | |
| return $this->regDt; | |
| } | |
| } | |
| */ | |
| namespace Bundle\DTO\Member; | |
| /** | |
| * 사업자 등록증 DB 저장 DTO | |
| */ | |
| class CompanyCertificationInsertDTO extends \Origin\DTO\AbstractDTO | |
| { | |
| private $memNo; | |
| private $imageFileNm; | |
| private $imageFilePath; | |
| private $regDt; | |
| /** | |
| * @param int $memNo | |
| * @param array $result | |
| */ | |
| public function __construct(int $memNo, array $result) | |
| { | |
| $this->memNo = $memNo; | |
| $this->imageFileNm = $result['fileName'] ?? ''; | |
| $this->imageFilePath = $result['filePath'] ?? ''; | |
| $this->regDt = date('Y-m-d H:i:s'); | |
| } | |
| /** | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getRegDt(): string | |
| { | |
| return $this->regDt; | |
| } | |
| } | |
변경 후CompanyCertificationInsertDTO.php
| */ | |
| namespace Bundle\DTO\Member; | |
| use Bundle\Enum\Member\Company\DocumentType; | |
| /** | |
| * 사업자 등록증 DB 저장 DTO | |
| */ | |
| class CompanyCertificationInsertDTO extends \Origin\DTO\AbstractDTO | |
| { | |
| private int $memNo; | |
| private string $imageFileNm; | |
| private string $imageFilePath; | |
| private DocumentType $documentType; | |
| /** | |
| * @param int $memNo | |
| * @param array $result fileName, filePath 포함 | |
| * @param string|null $documentType 인증 서류 종류(DocumentType value). null 이면 주 사업자등록증 | |
| */ | |
| public function __construct( | |
| int $memNo, | |
| array $result, | |
| ?string $documentType | |
| ) | |
| { | |
| $this->memNo = $memNo; | |
| $this->imageFileNm = $result['fileName'] ?? ''; | |
| $this->imageFilePath = $result['filePath'] ?? ''; | |
| $this->documentType = $documentType !== null | |
| ? DocumentType::from($documentType) | |
| : DocumentType::REGISTRATION; | |
| } | |
| /** | |
| } | |
| /** | |
| * @return DocumentType | |
| */ | |
| public function getDocumentType(): DocumentType | |
| { | |
| return $this->documentType; | |
| } | |
| /** | |
| * @param DocumentType $documentType | |
| * @return void | |
| */ | |
| public function setDocumentType(DocumentType $documentType): void | |
| { | |
| $this->documentType = $documentType; | |
| } | |
| } | |
| */ | |
| namespace Bundle\DTO\Member; | |
| use Bundle\Enum\Member\Company\DocumentType; | |
| /** | |
| * 사업자 등록증 DB 저장 DTO | |
| */ | |
| class CompanyCertificationInsertDTO extends \Origin\DTO\AbstractDTO | |
| { | |
| private int $memNo; | |
| private string $imageFileNm; | |
| private string $imageFilePath; | |
| private DocumentType $documentType; | |
| /** | |
| * @param int $memNo | |
| * @param array $result fileName, filePath 포함 | |
| * @param string|null $documentType 인증 서류 종류(DocumentType value). null 이면 주 사업자등록증 | |
| */ | |
| public function __construct( | |
| int $memNo, | |
| array $result, | |
| ?string $documentType | |
| ) | |
| { | |
| $this->memNo = $memNo; | |
| $this->imageFileNm = $result['fileName'] ?? ''; | |
| $this->imageFilePath = $result['filePath'] ?? ''; | |
| $this->documentType = $documentType !== null | |
| ? DocumentType::from($documentType) | |
| : DocumentType::REGISTRATION; | |
| } | |
| /** | |
| } | |
| /** | |
| * @return DocumentType | |
| */ | |
| public function getDocumentType(): DocumentType | |
| { | |
| return $this->documentType; | |
| } | |
| /** | |
| * @param DocumentType $documentType | |
| * @return void | |
| */ | |
| public function setDocumentType(DocumentType $documentType): void | |
| { | |
| $this->documentType = $documentType; | |
| } | |
| } | |
변경 전DocumentType.php
변경 후DocumentType.php
| <?php | |
| /* | |
| * Copyright (C) 2025 NHN COMMERCE. - All Rights Reserved | |
| * | |
| * Unauthorized copying or redistribution of this file in source and binary forms via any medium | |
| * is strictly prohibited. | |
| */ | |
| namespace Bundle\Enum\Member\Company; | |
| /** | |
| * 사업자 등록증 인증 서류 종류 | |
| * - backing value : DB(es_memberCompanyCertification.documentType) 저장값 | |
| * | |
| */ | |
| enum DocumentType: string | |
| { | |
| case REGISTRATION = 'registration'; | |
| case ADDITIONAL_CERT_0 = 'comAddiCert0'; | |
| case ADDITIONAL_CERT_1 = 'comAddiCert1'; | |
| case ADDITIONAL_CERT_2 = 'comAddiCert2'; | |
| case ADDITIONAL_CERT_3 = 'comAddiCert3'; | |
| case ADDITIONAL_CERT_4 = 'comAddiCert4'; | |
| } | |
| <?php | |
| /* | |
| * Copyright (C) 2025 NHN COMMERCE. - All Rights Reserved | |
| * | |
| * Unauthorized copying or redistribution of this file in source and binary forms via any medium | |
| * is strictly prohibited. | |
| */ | |
| namespace Bundle\Enum\Member\Company; | |
| /** | |
| * 사업자 등록증 인증 서류 종류 | |
| * - backing value : DB(es_memberCompanyCertification.documentType) 저장값 | |
| * | |
| */ | |
| enum DocumentType: string | |
| { | |
| case REGISTRATION = 'registration'; | |
| case ADDITIONAL_CERT_0 = 'comAddiCert0'; | |
| case ADDITIONAL_CERT_1 = 'comAddiCert1'; | |
| case ADDITIONAL_CERT_2 = 'comAddiCert2'; | |
| case ADDITIONAL_CERT_3 = 'comAddiCert3'; | |
| case ADDITIONAL_CERT_4 = 'comAddiCert4'; | |
| } | |
변경 전CompanyCertificationRepository.php
| { | |
| public function insertCertificationInfo(CompanyCertificationInsertDTO $dto) | |
| { | |
| CompanyCertification::query() | |
| ->insert([ | |
| 'memNo' => $dto->getMemNo(), | |
| 'imageFileNm' => $dto->getImageFileNm(), | |
| 'imageFilePath' => $dto->getImageFilePath(), | |
| 'regDt' => $dto->getRegDt(), | |
| ]); | |
| } | |
| /** | |
| * 사업자 등록증 정보를 memNo로 조회 | |
| * | |
| * @param int $memNo | |
| * @return array | |
| */ | |
| public function findCertificationInfoByMemNo(int $memNo): array | |
| { | |
| $certification = CompanyCertification::query() | |
| ->where('memNo', $memNo) | |
| ->first(); | |
| return $certification ? $certification->toArray() : []; | |
| */ | |
| public function findCertificationInfoBySno(int $sno): array | |
| { | |
| $certification = CompanyCertification::query() | |
| ->where('sno', $sno) | |
| ->first(); | |
| return $certification ? $certification->toArray() : []; | |
| } | |
| */ | |
| public function deleteCertificationInfo(int $sno): void | |
| { | |
| CompanyCertification::query() | |
| ->where('sno', $sno) | |
| ->delete(); | |
| } | |
| } | |
| { | |
| public function insertCertificationInfo(CompanyCertificationInsertDTO $dto) | |
| { | |
| CompanyCertification::query() | |
| ->insert([ | |
| 'memNo' => $dto->getMemNo(), | |
| 'imageFileNm' => $dto->getImageFileNm(), | |
| 'imageFilePath' => $dto->getImageFilePath(), | |
| 'regDt' => $dto->getRegDt(), | |
| ]); | |
| } | |
| /** | |
| * 사업자 등록증 정보를 memNo로 조회 | |
| * | |
| * @param int $memNo | |
| * @return array | |
| */ | |
| public function findCertificationInfoByMemNo(int $memNo): array | |
| { | |
| $certification = CompanyCertification::query() | |
| ->where('memNo', $memNo) | |
| ->first(); | |
| return $certification ? $certification->toArray() : []; | |
| */ | |
| public function findCertificationInfoBySno(int $sno): array | |
| { | |
| $certification = CompanyCertification::query() | |
| ->where('sno', $sno) | |
| ->first(); | |
| return $certification ? $certification->toArray() : []; | |
| } | |
| */ | |
| public function deleteCertificationInfo(int $sno): void | |
| { | |
| CompanyCertification::query() | |
| ->where('sno', $sno) | |
| ->delete(); | |
| } | |
| } | |
변경 후CompanyCertificationRepository.php
| { | |
| public function insertCertificationInfo(CompanyCertificationInsertDTO $dto) | |
| { | |
| // DB 컬럼에는 enum 의 backing value(예: documentType='registration')가 저장되어야 하므로 useEnumName=false 로 직렬화한다. | |
| CompanyCertification::create($dto->toRecursiveArray(false)); | |
| } | |
| /** | |
| * 사업자 등록증(기본 서류) 정보를 memNo 로 조회 | |
| * 기본 인증 서류 종류(registration) 기준으로 조회한다. | |
| * | |
| * @param int $memNo | |
| * @return array | |
| */ | |
| public function findCertificationInfoByMemNo(int $memNo): array | |
| { | |
| return $this->findCertificationInfoByMemNoAndType($memNo, 'registration'); | |
| } | |
| /** | |
| * 사업자 등록증 정보를 memNo 와 인증 서류 종류로 조회 | |
| * | |
| * @param int $memNo | |
| * @param string $type 인증 서류 종류 | |
| * @return array | |
| */ | |
| public function findCertificationInfoByMemNoAndType(int $memNo, string $type): array | |
| { | |
| $certification = CompanyCertification::query() | |
| ->where('memNo', $memNo) | |
| ->where('documentType', $type) | |
| ->first(); | |
| return $certification ? $certification->toArray() : []; | |
| */ | |
| public function findCertificationInfoBySno(int $sno): array | |
| { | |
| $certification = CompanyCertification::find($sno); | |
| return $certification ? $certification->toArray() : []; | |
| } | |
| */ | |
| public function deleteCertificationInfo(int $sno): void | |
| { | |
| CompanyCertification::find($sno)->delete(); | |
| } | |
| } | |
| { | |
| public function insertCertificationInfo(CompanyCertificationInsertDTO $dto) | |
| { | |
| // DB 컬럼에는 enum 의 backing value(예: documentType='registration')가 저장되어야 하므로 useEnumName=false 로 직렬화한다. | |
| CompanyCertification::create($dto->toRecursiveArray(false)); | |
| } | |
| /** | |
| * 사업자 등록증(기본 서류) 정보를 memNo 로 조회 | |
| * 기본 인증 서류 종류(registration) 기준으로 조회한다. | |
| * | |
| * @param int $memNo | |
| * @return array | |
| */ | |
| public function findCertificationInfoByMemNo(int $memNo): array | |
| { | |
| return $this->findCertificationInfoByMemNoAndType($memNo, 'registration'); | |
| } | |
| /** | |
| * 사업자 등록증 정보를 memNo 와 인증 서류 종류로 조회 | |
| * | |
| * @param int $memNo | |
| * @param string $type 인증 서류 종류 | |
| * @return array | |
| */ | |
| public function findCertificationInfoByMemNoAndType(int $memNo, string $type): array | |
| { | |
| $certification = CompanyCertification::query() | |
| ->where('memNo', $memNo) | |
| ->where('documentType', $type) | |
| ->first(); | |
| return $certification ? $certification->toArray() : []; | |
| */ | |
| public function findCertificationInfoBySno(int $sno): array | |
| { | |
| $certification = CompanyCertification::find($sno); | |
| return $certification ? $certification->toArray() : []; | |
| } | |
| */ | |
| public function deleteCertificationInfo(int $sno): void | |
| { | |
| CompanyCertification::find($sno)->delete(); | |
| } | |
| } | |
변경 전gd_member2.js
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else { | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
변경 후gd_member2.js
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| // 추가 첨부(comAddiCertN) 에러 메시지는 폭을 9em 으로 고정 | |
| if (/^comAddiCert\d+-error$/.test(elementId)) { | |
| error.css('width', '9em'); | |
| } | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', ''); | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| // 추가 첨부(comAddiCertN) 에러 메시지는 폭을 9em 으로 고정 | |
| if (/^comAddiCert\d+-error$/.test(elementId)) { | |
| error.css('width', '9em'); | |
| } | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else { | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', ''); | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
변경 전_join_view_business.html
| </label> | |
| <div class="btn_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file" /> | |
| </div> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| <!--{/}--> | |
| </script> | |
| </label> | |
| <div class="btn_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file" /> | |
| </div> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| <!--{/}--> | |
| </script> | |
변경 후_join_view_business.html
| </label> | |
| <div class="btn_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file js_cert_file" /> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comCertification" style="display:none; float:left; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <tr> | |
| <th><span><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></span></th> | |
| <td> | |
| <div class="file_upload_sec certification_box member_warning"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="btn_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_cert_file js_addi_cert_file" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comAddiCert{=substr(.key_, 11)}" style="display:none; float:right; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| <!--{/}--> | |
| // 추가 첨부 파일 변경 시 확장자/용량 검사 | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| // 추가 첨부 삭제 체크 시 confirm | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| // 사업자등록증/추가첨부: 찾아보기로 파일 선택 시 파일명 표시 + '- 삭제' 버튼 노출 | |
| $(document).on('change', '.js_cert_file', function () { | |
| var $textbox = $('label[for="' + this.id + '"]').find('input[type="text"]'); | |
| var $clearBtn = $('.js_cert_clear[data-for="' + this.id + '"]'); | |
| if (this.files.length > 0) { | |
| $textbox.val(this.files[0].name); | |
| $clearBtn.show(); | |
| // '- 삭제' 버튼 폭만큼 텍스트박스를 줄여 같은 줄에 유지 (버튼 밀림 방지) | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| var freeWidth = $textbox.outerWidth() - $clearBtn.outerWidth(true); | |
| if (freeWidth > 0) { | |
| $textbox.css({ 'box-sizing': 'border-box', 'width': freeWidth + 'px' }); | |
| } | |
| } else { | |
| $textbox.val(''); | |
| $clearBtn.hide(); | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| } | |
| }); | |
| // '- 삭제' 클릭 시 첨부 취소 + 텍스트박스 내용 제거 + 폭 원복 | |
| $(document).on('click', '.js_cert_clear', function () { | |
| var id = $(this).data('for'); | |
| $(document.getElementById(id)).val(''); | |
| $('label[for="' + id + '"]').find('input[type="text"]') | |
| .val('').css({ 'width': '', 'box-sizing': '' }); | |
| $(this).hide(); | |
| }); | |
| </script> | |
| </label> | |
| <div class="btn_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file js_cert_file" /> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comCertification" style="display:none; float:left; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <tr> | |
| <th><span><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></span></th> | |
| <td> | |
| <div class="file_upload_sec certification_box member_warning"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="btn_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_cert_file js_addi_cert_file" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comAddiCert{=substr(.key_, 11)}" style="display:none; float:right; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| <!--{/}--> | |
| // 추가 첨부 파일 변경 시 확장자/용량 검사 | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| // 추가 첨부 삭제 체크 시 confirm | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| // 사업자등록증/추가첨부: 찾아보기로 파일 선택 시 파일명 표시 + '- 삭제' 버튼 노출 | |
| $(document).on('change', '.js_cert_file', function () { | |
| var $textbox = $('label[for="' + this.id + '"]').find('input[type="text"]'); | |
| var $clearBtn = $('.js_cert_clear[data-for="' + this.id + '"]'); | |
| if (this.files.length > 0) { | |
| $textbox.val(this.files[0].name); | |
| $clearBtn.show(); | |
| // '- 삭제' 버튼 폭만큼 텍스트박스를 줄여 같은 줄에 유지 (버튼 밀림 방지) | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| var freeWidth = $textbox.outerWidth() - $clearBtn.outerWidth(true); | |
| if (freeWidth > 0) { | |
| $textbox.css({ 'box-sizing': 'border-box', 'width': freeWidth + 'px' }); | |
| } | |
| } else { | |
| $textbox.val(''); | |
| $clearBtn.hide(); | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| } | |
| }); | |
| // '- 삭제' 클릭 시 첨부 취소 + 텍스트박스 내용 제거 + 폭 원복 | |
| $(document).on('click', '.js_cert_clear', function () { | |
| var id = $(this).data('for'); | |
| $(document.getElementById(id)).val(''); | |
| $('label[for="' + id + '"]').find('input[type="text"]') | |
| .val('').css({ 'width': '', 'box-sizing': '' }); | |
| $(this).hide(); | |
| }); | |
| </script> | |
변경 전gd_member2.js
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else { | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
변경 후gd_member2.js
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| // 추가 첨부(comAddiCertN) 에러 메시지는 폭을 9em 으로 고정 | |
| if (/^comAddiCert\d+-error$/.test(elementId)) { | |
| error.css('width', '9em'); | |
| } | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', ''); | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
| errorPlacement: function (error, element) { | |
| try { | |
| var elementId = $(error).attr('id'); | |
| // 추가 첨부(comAddiCertN) 에러 메시지는 폭을 9em 으로 고정 | |
| if (/^comAddiCert\d+-error$/.test(elementId)) { | |
| error.css('width', '9em'); | |
| } | |
| var $error = $('#' + elementId); | |
| if ($error.length === 0) { | |
| if (elementId == 'calendarFl-error') { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else { | |
| $(element).closest('div.member_warning').addClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.file_upload_sec, .certification_box').find('.file_text').css('border', ''); | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } else if ($(element).prop('type') != 'checkbox' && $(element).prop('type') != 'radio') { | |
| $(element).closest('div.member_warning').removeClass('prior_wrong').removeClass('prior_half_pass'); | |
| } | |
| }, | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.closest('td').prev('th').children('span').addClass('important'); | |
| } | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| } | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
변경 전_join_view_business.html
| </label> | |
| <div class="btn_upload_box comCertification_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file" /> | |
| </div> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| $(document).on('click', '.comCertification_upload_box .btn_upload', function (e) { | |
| const $box = $(this).closest('.comCertification_upload_box'); | |
| const $file = $box.find('input[type="file"]'); | |
| $file.val(null); | |
| $file.trigger('click'); | |
| }); | |
| <!--{/}--> | |
| </script> | |
| </label> | |
| <div class="btn_upload_box comCertification_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file" /> | |
| </div> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| $(document).on('click', '.comCertification_upload_box .btn_upload', function (e) { | |
| const $box = $(this).closest('.comCertification_upload_box'); | |
| const $file = $box.find('input[type="file"]'); | |
| $file.val(null); | |
| $file.trigger('click'); | |
| }); | |
| <!--{/}--> | |
| </script> | |
변경 후_join_view_business.html
| </label> | |
| <div class="btn_upload_box comCertification_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file js_cert_file" /> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comCertification" style="display:none; float:left; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <tr> | |
| <th><span><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></span></th> | |
| <td> | |
| <div class="file_upload_sec certification_box member_warning"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="btn_upload_box comCertification_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_cert_file js_addi_cert_file" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comAddiCert{=substr(.key_, 11)}" style="display:none; float:left; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| <!--{/}--> | |
| // 찾아보기 버튼 클릭 시 파일 선택창 열기 (사업자등록증 + 추가첨부 공용 — 동일 .comCertification_upload_box 클래스 사용) | |
| $(document).on('click', '.comCertification_upload_box .btn_upload', function (e) { | |
| const $box = $(this).closest('.comCertification_upload_box'); | |
| const $file = $box.find('input[type="file"]'); | |
| $file.val(null); | |
| $file.trigger('click'); | |
| }); | |
| // 추가 첨부 파일 변경 시 파일명 표시 + 확장자/용량 검사 | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| // 추가 첨부 삭제 체크 시 confirm | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| // 사업자등록증/추가첨부: 찾아보기로 파일 선택 시 파일명 표시 + '- 삭제' 버튼 노출 | |
| $(document).on('change', '.js_cert_file', function () { | |
| var $textbox = $('label[for="' + this.id + '"]').find('input[type="text"]'); | |
| var $clearBtn = $('.js_cert_clear[data-for="' + this.id + '"]'); | |
| if (this.files.length > 0) { | |
| $textbox.val(this.files[0].name); | |
| $clearBtn.show(); | |
| // '- 삭제' 버튼 폭만큼 텍스트박스를 줄여 같은 줄에 유지 (버튼 밀림 방지) | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| var freeWidth = $textbox.outerWidth() - $clearBtn.outerWidth(true); | |
| if (freeWidth > 0) { | |
| $textbox.css({ 'box-sizing': 'border-box', 'width': freeWidth + 'px' }); | |
| } | |
| } else { | |
| $textbox.val(''); | |
| $clearBtn.hide(); | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| } | |
| }); | |
| // '- 삭제' 클릭 시 첨부 취소 + 텍스트박스 내용 제거 + 폭 원복 | |
| $(document).on('click', '.js_cert_clear', function () { | |
| var id = $(this).data('for'); | |
| $(document.getElementById(id)).val(''); | |
| $('label[for="' + id + '"]').find('input[type="text"]') | |
| .val('').css({ 'width': '', 'box-sizing': '' }); | |
| $(this).hide(); | |
| }); | |
| </script> | |
| </label> | |
| <div class="btn_upload_box comCertification_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comCertification" name="comCertification[]" class="file js_cert_file" /> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comCertification" style="display:none; float:left; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <tr> | |
| <th><span><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></span></th> | |
| <td> | |
| <div class="file_upload_sec certification_box member_warning"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="btn_upload_box comCertification_upload_box"> | |
| <button type="button" class="btn_upload" title="{=__('찾아보기')}"><em>{=__('찾아보기')}</em></button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_cert_file js_addi_cert_file" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| <!--{? !isMyPage}--><!-- 가입 시에만 첨부 취소 버튼 노출 (정보수정 시 미노출) --> | |
| <button type="button" class="js_cert_clear" data-for="comAddiCert{=substr(.key_, 11)}" style="display:none; float:left; margin-left:6px; padding:4px 10px; background:#fff; border:1px solid #ccc; cursor:pointer;">- {=__('삭제')}</button> | |
| <!--{/}--> | |
| </div> | |
| </td> | |
| </tr> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </tbody> | |
| </table> | |
| </div> | |
| } | |
| }); | |
| <!--{/}--> | |
| // 찾아보기 버튼 클릭 시 파일 선택창 열기 (사업자등록증 + 추가첨부 공용 — 동일 .comCertification_upload_box 클래스 사용) | |
| $(document).on('click', '.comCertification_upload_box .btn_upload', function (e) { | |
| const $box = $(this).closest('.comCertification_upload_box'); | |
| const $file = $box.find('input[type="file"]'); | |
| $file.val(null); | |
| $file.trigger('click'); | |
| }); | |
| // 추가 첨부 파일 변경 시 파일명 표시 + 확장자/용량 검사 | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| // 추가 첨부 삭제 체크 시 confirm | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| // 사업자등록증/추가첨부: 찾아보기로 파일 선택 시 파일명 표시 + '- 삭제' 버튼 노출 | |
| $(document).on('change', '.js_cert_file', function () { | |
| var $textbox = $('label[for="' + this.id + '"]').find('input[type="text"]'); | |
| var $clearBtn = $('.js_cert_clear[data-for="' + this.id + '"]'); | |
| if (this.files.length > 0) { | |
| $textbox.val(this.files[0].name); | |
| $clearBtn.show(); | |
| // '- 삭제' 버튼 폭만큼 텍스트박스를 줄여 같은 줄에 유지 (버튼 밀림 방지) | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| var freeWidth = $textbox.outerWidth() - $clearBtn.outerWidth(true); | |
| if (freeWidth > 0) { | |
| $textbox.css({ 'box-sizing': 'border-box', 'width': freeWidth + 'px' }); | |
| } | |
| } else { | |
| $textbox.val(''); | |
| $clearBtn.hide(); | |
| $textbox.css({ 'width': '', 'box-sizing': '' }); | |
| } | |
| }); | |
| // '- 삭제' 클릭 시 첨부 취소 + 텍스트박스 내용 제거 + 폭 원복 | |
| $(document).on('click', '.js_cert_clear', function () { | |
| var id = $(this).data('for'); | |
| $(document.getElementById(id)).val(''); | |
| $('label[for="' + id + '"]').find('input[type="text"]') | |
| .val('').css({ 'width': '', 'box-sizing': '' }); | |
| $(this).hide(); | |
| }); | |
| </script> | |
변경 전member.css
| .certification_box {position:relative; padding-right:70px;} | |
| .upload_btn_box {position: relative; display: inline-block;} | |
| .upload_btn_box .file {position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;} | |
| label.check_s[for="certificationDeleteSno"]{ min-height: 23px; line-height: 23px;} | |
| /*** 회원가입 기타 정보 | member/_join_view_other.html ***/ | |
| /* SNS */ | |
| .certification_box {position:relative; padding-right:70px;} | |
| .upload_btn_box {position: relative; display: inline-block;} | |
| .upload_btn_box .file {position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;} | |
| label.check_s[for="certificationDeleteSno"]{ min-height: 23px; line-height: 23px;} | |
| /*** 회원가입 기타 정보 | member/_join_view_other.html ***/ | |
| /* SNS */ | |
변경 후member.css
| .certification_box {position:relative; padding-right:70px;} | |
| .upload_btn_box {position: relative; display: inline-block;} | |
| .upload_btn_box .file {position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;} | |
| label.check_s[for="certificationDeleteSno"], | |
| label.check_s[for^="comAddiCertDeleteSno"]{ min-height: 23px; line-height: 23px;} | |
| /*** 회원가입 기타 정보 | member/_join_view_other.html ***/ | |
| /* SNS */ | |
| .certification_box {position:relative; padding-right:70px;} | |
| .upload_btn_box {position: relative; display: inline-block;} | |
| .upload_btn_box .file {position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;} | |
| label.check_s[for="certificationDeleteSno"], | |
| label.check_s[for^="comAddiCertDeleteSno"]{ min-height: 23px; line-height: 23px;} | |
| /*** 회원가입 기타 정보 | member/_join_view_other.html ***/ | |
| /* SNS */ | |
변경 전gd_member2.js
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $(`.file_text`).css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $(`.file_text`).css('border', '0'); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled', false); | |
| validate.settings.submitHandler = func; | |
| $('.join_ok_btn').attr("disabled", true); | |
| form.submit(); | |
| } else { | |
| go_to_by_scroll($('div.c_red:first', form)); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $(`.file_text`).css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $(`.file_text`).css('border', '0'); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled', false); | |
| validate.settings.submitHandler = func; | |
| $('.join_ok_btn').attr("disabled", true); | |
| form.submit(); | |
| } else { | |
| go_to_by_scroll($('div.c_red:first', form)); | |
변경 후gd_member2.js
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 빨갛게 (전역 .file_text 사용 시 다른 항목 강조를 덮어써 사라짐) | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 복귀 (전역 .file_text 복원 시 다른 항목 강조를 덮어씀) | |
| $(element).closest('.certification_box').find('.file_text').css('border', ''); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.certification_box').find('.file_text').css('border', ''); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| $(form).find('select').prop('disabled', false); | |
| validate.settings.submitHandler = func; | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled', false); | |
| $('.join_ok_btn').attr("disabled", true); | |
| validate.settings.submitHandler = func; | |
| form.submit(); | |
| } else { | |
| go_to_by_scroll($('div.c_red:first', form)); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 빨갛게 (전역 .file_text 사용 시 다른 항목 강조를 덮어써 사라짐) | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 복귀 (전역 .file_text 복원 시 다른 항목 강조를 덮어씀) | |
| $(element).closest('.certification_box').find('.file_text').css('border', ''); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.certification_box').find('.file_text').css('border', ''); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| $(form).find('select').prop('disabled', false); | |
| validate.settings.submitHandler = func; | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled', false); | |
| $('.join_ok_btn').attr("disabled", true); | |
| validate.settings.submitHandler = func; | |
| form.submit(); | |
| } else { | |
| go_to_by_scroll($('div.c_red:first', form)); | |
변경 전_join_view_business.html
| </div> | |
| </div> | |
| <!--{/}--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{/}--> | |
| </script> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{/}--> | |
| </script> | |
변경 후_join_view_business.html
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <div class="input_wrap"> | |
| <div class="input_title"><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></div> | |
| <div class="input_content"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div class="form_element"> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <div class="certification_box"> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="upload_btn_box"> | |
| <button type="button" class="zipcode_btn" title="{=__('찾아보기')}">{=__('찾아보기')}</button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_addi_cert_file" accept="image/*, application/pdf" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| <!--{/}--> | |
| // 파일 선택시 파일명 표시 (사업자등록증/추가첨부 공용 — comCertification if 영향 받지 않도록 밖에 둠) | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{? !isMyPage}--> | |
| // 가입 시: 첨부된 파일의 텍스트박스 클릭 → 삭제 확인 후 첨부/텍스트박스 비움 | |
| $(document).on('click', '.file_text', function (e) { | |
| if (!$(this).val()) { return; } // 미첨부: 기본 동작(찾아보기) 허용 | |
| e.preventDefault(); // 첨부됨: 재선택(파일창) 차단 후 삭제 확인 | |
| if (confirm('첨부 파일을 삭제하시겠습니까?')) { | |
| var forId = $(this).closest('label').attr('for'); | |
| var fileInput = forId ? document.getElementById(forId) : null; | |
| if (fileInput) { fileInput.value = ''; } | |
| $(this).val(''); | |
| } | |
| }); | |
| <!--{/}--> | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 표시 핸들러가 먼저 채운 파일명을 검증 실패 시 함께 비우기 위해 textbox 참조 | |
| const $fileText = $('label[for="' + this.id + '"]').find('.file_text'); | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| </script> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <div class="input_wrap"> | |
| <div class="input_title"><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></div> | |
| <div class="input_content"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div class="form_element"> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <div class="certification_box"> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="upload_btn_box"> | |
| <button type="button" class="zipcode_btn" title="{=__('찾아보기')}">{=__('찾아보기')}</button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_addi_cert_file" accept="image/*, application/pdf" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| <!--{/}--> | |
| // 파일 선택시 파일명 표시 (사업자등록증/추가첨부 공용 — comCertification if 영향 받지 않도록 밖에 둠) | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{? !isMyPage}--> | |
| // 가입 시: 첨부된 파일의 텍스트박스 클릭 → 삭제 확인 후 첨부/텍스트박스 비움 | |
| $(document).on('click', '.file_text', function (e) { | |
| if (!$(this).val()) { return; } // 미첨부: 기본 동작(찾아보기) 허용 | |
| e.preventDefault(); // 첨부됨: 재선택(파일창) 차단 후 삭제 확인 | |
| if (confirm('첨부 파일을 삭제하시겠습니까?')) { | |
| var forId = $(this).closest('label').attr('for'); | |
| var fileInput = forId ? document.getElementById(forId) : null; | |
| if (fileInput) { fileInput.value = ''; } | |
| $(this).val(''); | |
| } | |
| }); | |
| <!--{/}--> | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 표시 핸들러가 먼저 채운 파일명을 검증 실패 시 함께 비우기 위해 textbox 참조 | |
| const $fileText = $('label[for="' + this.id + '"]').find('.file_text'); | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| </script> | |
변경 전my_page.html
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |
변경 후my_page.html
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page join" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page join" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |
변경 전member.css
| opacity: 0; | |
| cursor: pointer; | |
| } | |
| label.check_s[for="certificationDeleteSno"]{ | |
| min-height: 23px; | |
| line-height: 23px; | |
| } | |
| opacity: 0; | |
| cursor: pointer; | |
| } | |
| label.check_s[for="certificationDeleteSno"]{ | |
| min-height: 23px; | |
| line-height: 23px; | |
| } | |
변경 후member.css
| opacity: 0; | |
| cursor: pointer; | |
| } | |
| label.check_s[for="certificationDeleteSno"], | |
| label.check_s[for^="comAddiCertDeleteSno"]{ | |
| min-height: 23px; | |
| line-height: 23px; | |
| } | |
| opacity: 0; | |
| cursor: pointer; | |
| } | |
| label.check_s[for="certificationDeleteSno"], | |
| label.check_s[for^="comAddiCertDeleteSno"]{ | |
| min-height: 23px; | |
| line-height: 23px; | |
| } | |
변경 전gd_member2.js
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $('.file_text').css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $(`.file_text`).css('border', '1px solid #d0d0d0'); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled',false); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $('.file_text').css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == $(element).get(0).id) { | |
| // 사업자등록증 별도 하이라이트 처리 | |
| $(`.file_text`).css('border', '1px solid #d0d0d0'); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled',false); | |
변경 후gd_member2.js
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 빨갛게 (전역 .file_text 사용 시 다른 항목 강조를 덮어써 사라짐) | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 복귀 (전역 .file_text 복원 시 다른 항목 강조를 덮어씀) | |
| $(element).closest('.certification_box').find('.file_text').css('border', '1px solid #d0d0d0'); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.certification_box').find('.file_text').css('border', '1px solid #d0d0d0'); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled',false); | |
| if(is_my_page && isBusiness) { | |
| var $certificationDeleteSno = $('input[name="certificationDeleteSno"]'); | |
| var $comCertification = $('input[name="comCertification[]"]'); | |
| // 사업자등록증 입력 항목이 없으면 빈 selection 에 .rules() 가 호출돼 터지므로 가드 | |
| if ($comCertification.length > 0) { | |
| var isComCertificationRequired = $comCertification.rules().required; | |
| var isFileEmpty = !$comCertification.val(); | |
| var isDeleteChecked = $certificationDeleteSno.is(':checked'); | |
| var hasDeleteSno = !!$certificationDeleteSno.val(); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| }, | |
| highlight: function (element) { | |
| this.errorList[0].element.focus(); | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '3px solid #fa2828'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 빨갛게 (전역 .file_text 사용 시 다른 항목 강조를 덮어써 사라짐) | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| // 추가 첨부 항목: 같은 row 의 .file_text 만 빨갛게 | |
| $(element).closest('.certification_box').find('.file_text').css('border', '3px solid #fa2828'); | |
| } else { | |
| $(element).css('border', '3px solid #fa2828'); | |
| } | |
| }, | |
| unhighlight: function (element) { | |
| var elemId = $(element).get(0).id || ''; | |
| if(element.type == 'radio') { | |
| $(element).parent().css('border', '0'); | |
| } else if ('comCertification' == elemId) { | |
| // 사업자등록증: 같은 row 의 .file_text 만 복귀 (전역 .file_text 복원 시 다른 항목 강조를 덮어씀) | |
| $(element).closest('.certification_box').find('.file_text').css('border', '1px solid #d0d0d0'); | |
| } else if (/^comAddiCert\d+$/.test(elemId)) { | |
| $(element).closest('.certification_box').find('.file_text').css('border', '1px solid #d0d0d0'); | |
| } else { | |
| $(element).css('border', '1px solid #d0d0d0'); | |
| } | |
| } | |
| if (item.require === 'y') { | |
| settings.rules[idx].required = true; | |
| var $markTarget; | |
| // 추가 첨부 (comAddiCertN) 정책 키는 실제 input name 이 comAddiCert[N][file] 형태이므로 별도 매칭 | |
| var addiCertMatch = idx.match(/^comAddiCert(\d+)$/); | |
| if (addiCertMatch) { | |
| var addiCertRuleKey = 'comAddiCert[' + addiCertMatch[1] + '][file]'; | |
| $markTarget = $('input[name="' + addiCertRuleKey + '"]'); | |
| settings.rules[addiCertRuleKey] = {required: true}; | |
| } else { | |
| $markTarget = $('input[name="' + idx + '"]'); | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('select[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('textarea[name="' + idx + '"]'); | |
| } | |
| if ($markTarget.length < 1) { | |
| $markTarget = $('input[name="' + idx + '[]"]'); | |
| settings.rules[idx + '[]'] = {required: true}; | |
| } | |
| } | |
| $markTarget.removeClass('ignore'); | |
| $markTarget.closest('div.input_content').prev('div').addClass('required'); | |
| if (isComCertificationRequired && hasDeleteSno && isFileEmpty && !isDeleteChecked) { | |
| $comCertification.rules("remove"); | |
| } | |
| // 추가 첨부 항목도 row 별로 동일 우회 적용 | |
| $('input.js_addi_cert_file').each(function () { | |
| var $addiInput = $(this); | |
| var matched = ($addiInput.attr('name') || '').match(/^comAddiCert\[(\d+)\]\[file\]$/); | |
| if (!matched) return; | |
| var $addiDelBox = $('input[name="comAddiCert[' + matched[1] + '][DeleteSno]"]'); | |
| var rules = $addiInput.rules(); | |
| var addiRequired = !!(rules && rules.required); | |
| var addiFileEmpty = !$addiInput.val(); | |
| var addiDeleteChecked = $addiDelBox.is(':checked'); | |
| var addiHasDeleteSno = !!$addiDelBox.val(); | |
| if (addiRequired && addiHasDeleteSno && addiFileEmpty && !addiDeleteChecked) { | |
| $addiInput.rules("remove"); | |
| } | |
| }); | |
| $(form).find('select').prop('disabled',false); | |
| validate.settings.submitHandler = func; | |
| } | |
| if (validate.form()) { | |
| $(form).find('select').prop('disabled',false); | |
변경 전_join_view_business.html
| </div> | |
| </div> | |
| <!--{/}--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{/}--> | |
| </script> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{/}--> | |
| </script> | |
변경 후_join_view_business.html
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <div class="input_wrap"> | |
| <div class="input_title"><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></div> | |
| <div class="input_content"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div class="form_element"> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <div class="certification_box"> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="upload_btn_box"> | |
| <button type="button" class="zipcode_btn" title="{=__('찾아보기')}">{=__('찾아보기')}</button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_addi_cert_file" accept="image/*, application/pdf" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| <!--{/}--> | |
| // 파일 선택시 파일명 표시 (사업자등록증/추가첨부 공용 — comCertification if 영향 받지 않도록 밖에 둠) | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{? !isMyPage}--> | |
| // 가입 시: 첨부된 파일의 텍스트박스 클릭 → 삭제 확인 후 첨부/텍스트박스 비움 | |
| $(document).on('click', '.file_text', function (e) { | |
| if (!$(this).val()) { return; } // 미첨부: 기본 동작(찾아보기) 허용 | |
| e.preventDefault(); // 첨부됨: 재선택(파일창) 차단 후 삭제 확인 | |
| if (confirm('첨부 파일을 삭제하시겠습니까?')) { | |
| var forId = $(this).closest('label').attr('for'); | |
| var fileInput = forId ? document.getElementById(forId) : null; | |
| if (fileInput) { fileInput.value = ''; } | |
| $(this).val(''); | |
| } | |
| }); | |
| <!--{/}--> | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 표시 핸들러가 먼저 채운 파일명을 검증 실패 시 함께 비우기 위해 textbox 참조 | |
| const $fileText = $('label[for="' + this.id + '"]').find('.file_text'); | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| </script> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ @ comAddiCerts }--> | |
| <!--{? .value_.use == 'y'}--> | |
| <div class="input_wrap"> | |
| <div class="input_title"><label for="comAddiCert{=substr(.key_, 11)}">{=.value_.name}</label></div> | |
| <div class="input_content"> | |
| <!--{? .value_.file.imageFileNm}--> | |
| <div class="form_element"> | |
| <a href="../member/company_certification.php?mode=download&sno={.value_.file.sno}" class="link_file_down">{=.value_.file.imageFileNm}</a> | |
| <input type="checkbox" id="comAddiCertDeleteSno{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][DeleteSno]" class="js_addi_cert_delete" value="{.value_.file.sno}" /> | |
| <label for="comAddiCertDeleteSno{=substr(.key_, 11)}" class="check_s">{=__('삭제')}</label> | |
| </div> | |
| <!--{/}--> | |
| <div class="certification_box"> | |
| <label for="comAddiCert{=substr(.key_, 11)}"> | |
| <input type="text" class="file_text" title="{=__('파일 첨부하기')}" readonly="readonly"/> | |
| </label> | |
| <div class="upload_btn_box"> | |
| <button type="button" class="zipcode_btn" title="{=__('찾아보기')}">{=__('찾아보기')}</button> | |
| <input type="file" id="comAddiCert{=substr(.key_, 11)}" name="comAddiCert[{=substr(.key_, 11)}][file]" class="file js_addi_cert_file" accept="image/*, application/pdf" data-max-size="{.value_.certificationFileSize}"/> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!--{/}--> | |
| <!--{ / }--> | |
| </div> | |
| <!--{/}--> | |
| <script type="text/javascript"> | |
| } | |
| } | |
| }); | |
| <!--{/}--> | |
| // 파일 선택시 파일명 표시 (사업자등록증/추가첨부 공용 — comCertification if 영향 받지 않도록 밖에 둠) | |
| $(document).on('change', '.upload_btn_box .file', function(){ | |
| var i = $(this).val(); | |
| $('label[for=' + $(this).attr('id') + ']').find('.file_text').val(i); | |
| }); | |
| <!--{? !isMyPage}--> | |
| // 가입 시: 첨부된 파일의 텍스트박스 클릭 → 삭제 확인 후 첨부/텍스트박스 비움 | |
| $(document).on('click', '.file_text', function (e) { | |
| if (!$(this).val()) { return; } // 미첨부: 기본 동작(찾아보기) 허용 | |
| e.preventDefault(); // 첨부됨: 재선택(파일창) 차단 후 삭제 확인 | |
| if (confirm('첨부 파일을 삭제하시겠습니까?')) { | |
| var forId = $(this).closest('label').attr('for'); | |
| var fileInput = forId ? document.getElementById(forId) : null; | |
| if (fileInput) { fileInput.value = ''; } | |
| $(this).val(''); | |
| } | |
| }); | |
| <!--{/}--> | |
| $(document).on('change', '.js_addi_cert_file', function (e) { | |
| const $input = $(this); | |
| const file = this.files[0]; | |
| if (!file) return; | |
| const maxSize = parseInt($input.data('max-size'), 10) || 2; | |
| const allowedExt = ['pdf', 'jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']; | |
| // 표시 핸들러가 먼저 채운 파일명을 검증 실패 시 함께 비우기 위해 textbox 참조 | |
| const $fileText = $('label[for="' + this.id + '"]').find('.file_text'); | |
| // 확장자 검사 | |
| const ext = file.name.split('.').pop().toLowerCase(); | |
| if (!allowedExt.includes(ext)) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('등록이 불가한 파일 형식입니다.')); | |
| return; | |
| } | |
| // 파일 크기 검사 | |
| const fileSizeMB = file.size / (1024 * 1024); | |
| if (fileSizeMB > maxSize) { | |
| e.target.value = ''; | |
| $fileText.val(''); | |
| alert(__('파일은 최대 %1$sMB 이하로만 등록 가능합니다.', maxSize.toString())); | |
| } | |
| }); | |
| $(document).on('change', '.js_addi_cert_delete', function (e) { | |
| const $box = $(this); | |
| const $label = $('label[for="' + $box.attr('id') + '"]'); | |
| if ($box.is(':checked')) { | |
| const confirmDelete = confirm('등록된 첨부파일을 삭제하시겠습니까?\n회원정보 최종 저장 시 삭제되며, 복구가 불가합니다.'); | |
| if (!confirmDelete) { | |
| $label.removeClass('on'); | |
| $box.prop('checked', false); | |
| } | |
| } | |
| }); | |
| </script> | |
변경 전my_page.html
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |
변경 후my_page.html
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page join" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |
| {*** 회원정보 변경 | mypage/my_page.php ***} | |
| { # header } | |
| <div class="my_page join" id="memberjoin"> | |
| <form id="formJoin" name="formJoin" action="{mypageActionUrl}" method="post" enctype="multipart/form-data"> | |
| <input type="hidden" name="memNo" value="{data.memNo}"/> | |
| <input type="hidden" name="memberFl" value="{data.memberFl}"/> | |