diff --git a/assets/css/debug-tools.css b/assets/css/debug-tools.css index 8c2fc30e7..b6b3e95c4 100644 --- a/assets/css/debug-tools.css +++ b/assets/css/debug-tools.css @@ -1,8 +1,10 @@ form#wpo-wcpdf-settings { margin-left: 0 !important; + min-height: 600px; } #debug-tools { - width: 50%; + width: 100%; + margin-top: 2em; } #debug-tools .wrapper { @@ -34,6 +36,19 @@ form#wpo-wcpdf-settings { max-width: 25rem; } +#debug-tools #danger_zone { + margin-top: 20px; + background-color: #fcf9e8; +} + +#debug-tools #danger_zone .notice { + margin: 0; +} + +#debug-tools .add-info { + margin-left: 6px; +} + #document_custom_redirect_page, #document_custom_redirect_page + .description { display: none; diff --git a/assets/css/debug-tools.min.css b/assets/css/debug-tools.min.css index 2db55e4a9..9700fcf46 100644 --- a/assets/css/debug-tools.min.css +++ b/assets/css/debug-tools.min.css @@ -1 +1 @@ -form#wpo-wcpdf-settings{margin-left:0!important}#debug-tools{width:50%}#debug-tools .wrapper{width:auto;border:1px solid #ccc}#debug-tools .wrapper .tool{padding:20px}#debug-tools .wrapper .tool:not(:last-child){border-bottom:1px solid #ccc}#debug-tools .wrapper .tool h4{margin:0}#debug-tools .wrapper .tool input[type=file]{font-size:14px;line-height:2;color:#2c3338;border:1px solid #8c8f94;box-shadow:none;border-radius:3px;padding:0 24px 0 8px;min-height:30px;max-width:25rem}#document_custom_redirect_page,#document_custom_redirect_page+.description{display:none} \ No newline at end of file +form#wpo-wcpdf-settings{margin-left:0!important;min-height:600px}#debug-tools{width:100%;margin-top:2em}#debug-tools .wrapper{width:auto;border:1px solid #ccc}#debug-tools .wrapper .tool{padding:20px}#debug-tools .wrapper .tool:not(:last-child){border-bottom:1px solid #ccc}#debug-tools .wrapper .tool h4{margin:0}#debug-tools .wrapper .tool input[type=file]{font-size:14px;line-height:2;color:#2c3338;border:1px solid #8c8f94;box-shadow:none;border-radius:3px;padding:0 24px 0 8px;min-height:30px;max-width:25rem}#debug-tools #danger_zone{margin-top:20px;background-color:#fcf9e8}#debug-tools #danger_zone .notice{margin:0}#debug-tools .add-info{margin-left:6px}#document_custom_redirect_page,#document_custom_redirect_page+.description{display:none} \ No newline at end of file diff --git a/assets/css/settings-styles.css b/assets/css/settings-styles.css index 4478e6f3d..561c7e711 100644 --- a/assets/css/settings-styles.css +++ b/assets/css/settings-styles.css @@ -220,6 +220,10 @@ table.wcpdf_documents_settings_list td.title { color: #222; } +.wcpdf_advanced_numbers_choose_table { + margin-top: 20px; +} + .wcpdf_document_settings_document_output_formats { margin-bottom: 30px; } @@ -263,7 +267,7 @@ body.woocommerce_page_wpo_wcpdf_options_page { margin: 15px 0 0; } -.nav-tab-wrapper a.nav-tab { +.nav-tab-wrapper:not( .wcpdf_debug_settings_sections > .nav-tab-wrapper) a.nav-tab { background: transparent; border: none; border-bottom: 3px solid transparent; @@ -272,7 +276,7 @@ body.woocommerce_page_wpo_wcpdf_options_page { font-size: 15px; } -.nav-tab-wrapper a.nav-tab.nav-tab-active { +.nav-tab-wrapper:not( .wcpdf_debug_settings_sections > .nav-tab-wrapper) a.nav-tab.nav-tab-active { border-bottom: 3px solid #51266b; } @@ -435,6 +439,10 @@ body.woocommerce_page_wpo_wcpdf_options_page { font-size: 12px; } +#wpo-wcpdf-settings .system-status-table { + margin-top: 2em; +} + #wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar { flex: 0 0 100%; } diff --git a/assets/css/settings-styles.min.css b/assets/css/settings-styles.min.css index 88fad4061..cdc2cfc6b 100644 --- a/assets/css/settings-styles.min.css +++ b/assets/css/settings-styles.min.css @@ -1 +1 @@ -span.wpo-warning{display:inline-block;border:1px solid red;border-left:4px solid red;padding:5px 15px;background-color:#fff}.wcpdf-extensions-ad{position:relative;min-height:90px;border:1px solid #3d5c99;background-color:#ebf5ff;padding:15px;padding-left:100px;margin-top:15px}img.wpo-helper{position:absolute;bottom:0;left:3px}.wcpdf-extensions-ad h3{margin:0}.wcpdf-extensions-ad ul{margin:0;margin-left:1.5em}.wcpdf-extensions li{margin:0}.wcpdf-extensions li ul{list-style-type:square;margin-top:.5em;margin-bottom:.5em}.wcpdf-extensions>li:before{content:"";border-color:transparent transparent transparent #111;border-style:solid;border-width:.35em .35em .35em .45em;display:block;height:0;width:0;left:-1em;top:.9em;position:relative}.wcpdf-extensions li:not(.expanded){cursor:pointer}.wcpdf-extensions .expanded:before{border-color:#111 transparent transparent transparent;left:-1.17em;border-width:.45em .45em .35em .35em!important}.wcpdf-extensions .more{padding:10px;background-color:#fff;border:1px solid #ccc;border-radius:5px}.wcpdf-extensions table td{vertical-align:top}.dropbox-logo{margin-bottom:-10px;margin-right:10px}.cloud-logo{margin-bottom:-10px;margin-top:-5px;margin-right:10px}#img-header_logo{max-height:200px;width:auto;max-width:100%}.multiple-text-input label{padding-right:1em}table.multiple-text-input td{padding:0}table.wcpdf_documents_settings_list{width:100%;border-collapse:collapse;border-spacing:0;background-color:#fff;border-top:2px solid #000}table.wcpdf_documents_settings_list tr.odd{background-color:#ebf5ff}table.wcpdf_documents_settings_list td{padding:5px}table.wcpdf_documents_settings_list a{text-decoration:none}table.wcpdf_documents_settings_list td.settings-icon{text-align:right}table.wcpdf_documents_settings_list td.title{font-weight:700}.wcpdf-settings-sections ul{height:3em}.wcpdf-settings-sections ul li{float:left;margin-right:10px}.wcpdf-settings-sections ul li a{text-decoration:none;display:inline-block;padding:.8em 1em;color:#50575e;border:1px solid #c3c4c7;box-sizing:border-box}.wcpdf-settings-sections ul li a.active{border:2px solid #51266b;padding:calc(.8em - 1px) calc(1em - 1px);color:#000}.wcpdf_document_settings_sections{position:relative}.wcpdf_document_settings_sections>h2{cursor:pointer;padding:1em .8em;margin:0;border:1px solid #eaeaea}.wcpdf_document_settings_sections ul{background:#fff;list-style:none;margin:0;padding:0;width:100%;display:block;height:auto;display:none;box-sizing:border-box;position:absolute;border-left:1px solid #eaeaea;border-right:1px solid #eaeaea;z-index:1000;box-shadow:0 35px 35px -8px rgba(0,0,0,.1);-webkit-box-shadow:0 35px 35px -8px rgba(0,0,0,.1)}.wcpdf_document_settings_sections ul.active{display:block}.wcpdf_document_settings_sections ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.wcpdf_document_settings_sections ul li:hover{cursor:pointer;background:#51266b;color:#fff}.wcpdf_document_settings_sections ul li:hover a{color:#fff}.wcpdf_document_settings_sections ul li a{color:#000;text-decoration:none;padding:1.2em 1.6em;display:block}.wcpdf_document_settings_sections .arrow-down{font-size:.7em;color:#999;margin-left:8px;font-weight:400;float:right}.wcpdf_document_settings_sections p:hover,.wcpdf_document_settings_sections p:hover>.arrow-down{color:#222}.wcpdf_document_settings_document_output_formats{margin-bottom:30px}.edit-next-number{opacity:.5}.edit-next-number:hover{opacity:1;cursor:pointer}.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow,.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3{border-color:#51266b;background:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3:before{color:#51266b}body.woocommerce_page_wpo_wcpdf_options_page{background:#fff}.wrap [class$=icon32]+h2{font-size:18px;padding:1em}.wrap .notice{margin:15px 0 0}.nav-tab-wrapper a.nav-tab{background:0 0;border:none;border-bottom:3px solid transparent;padding:1em 0;margin:0 1.2em;font-size:15px}.nav-tab-wrapper a.nav-tab.nav-tab-active{border-bottom:3px solid #51266b}#wpo-wcpdf-preview-wrapper{width:100%;height:auto;position:relative;display:flex;align-items:flex-start}#wpo-wcpdf-preview-wrapper .preview-document,#wpo-wcpdf-preview-wrapper .sidebar{transition:.3s ease-in-out}#wpo-wcpdf-preview-wrapper .sidebar{height:auto;padding:4em 0 0 0;box-sizing:border-box;background:0 0;flex:0 0 35%;overflow-x:hidden}#wpo-wcpdf-preview-wrapper .sidebar>form{background:0 0!important;overflow:visible;padding:0;margin-left:2em;box-sizing:border-box;width:calc(100% - 4em);max-width:50vw}#wpo-wcpdf-preview-wrapper .sidebar>form.editor{max-width:none}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block;width:100%;padding:0}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{padding-bottom:.6em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td{padding-bottom:2.4em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td p.description,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>p.description{font-size:.85em;padding-top:.7em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input[type=url],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>textarea,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>input[type=url],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>textarea{max-width:none;width:100%}#wpo-wcpdf-preview-wrapper input[type=text][size],#wpo-wcpdf-preview-wrapper input[type=url][size]{width:auto!important;max-width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input#next_invoice_number{width:auto!important}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table{display:table}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody{display:table-row-group}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tr{display:table-row}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{display:table-cell;padding:15px 10px 15px 0;width:auto}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{width:300px!important}#wpo-wcpdf-settings .form-table .ui-tabs-nav{padding-left:0!important;margin-left:0!important}#wpo-wcpdf-settings .translations input,#wpo-wcpdf-settings .translations textarea{width:100%}#wpo-wcpdf-settings .wcpdf-attachment-settings-hint{border-left:4px solid #51266b}#wpo-wcpdf-settings .notice-info.inline{border-left-color:#51266b}#wpo-wcpdf-settings table#document-link-access-type{margin-top:-15px}#wpo-wcpdf-settings table#document-link-access-type td.option{padding-left:0}#wpo-wcpdf-settings table#document-link-access-type td{padding-top:0;padding-bottom:6px;font-size:12px}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar{flex:0 0 100%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .sidebar{flex:0 0 95%;margin-left:-95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .sidebar{flex:0 0 35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .sidebar{margin-left:-35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .sidebar{transition-delay:.4s}#wpo-wcpdf-preview-wrapper .preview-document{padding:0;box-sizing:border-box;position:sticky;top:2.4em;flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .preview-document{flex:0 0 60%;margin-right:-60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .preview-document{flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .preview-document{transition-delay:.4s}.preview-document .preview{width:100%;box-sizing:border-box;padding-right:5%}.preview-document .preview>#preview-ubl{width:100%;height:100%;overflow-wrap:anywhere;background-color:#222;color:#fff;padding:2em}.preview-document .preview>#preview-canvas{display:block;max-width:800px;max-height:85vh;width:auto!important;margin:0 auto;background:#fff;box-shadow:0 0 35px -8px rgba(0,0,0,.12);-webkit-box-shadow:0 0 35px -8px rgba(0,0,0,.12)}#wpo-wcpdf-preview-wrapper[data-preview-states="2"] #preview-canvas{max-height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=sidebar] #preview-canvas{max-height:170vh;transition:max-height .4s ease-in-out .3s}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] #preview-canvas{transition:max-height .4s ease-in-out 0s}.preview-document .preview-data-wrapper{width:100%;height:4em}.preview-document .preview-data-wrapper .preview-document-type,.preview-document .preview-data-wrapper .preview-order-data{float:right}.preview-document .preview-data-wrapper .preview-document-type{margin-right:30px}.preview-document .preview-data-wrapper .preview-document-type ul>li{text-decoration:none;color:initial;padding:1.4em 1.6em}.preview-document .preview-data-wrapper .preview-document-type ul>li:hover{color:#fff!important}.preview-document .preview-data-wrapper .save-settings{padding:1em 0 0 0;float:right;overflow:hidden;position:relative}.preview-document .preview-data-wrapper .save-settings p{padding:0;margin:0 0 0 2em;position:relative;margin-right:-200px;transition:margin-right .3s ease-out}.preview-document .preview-data-wrapper .save-settings p:after{content:'';display:block;pointer-events:none;position:absolute;box-sizing:border-box;border-radius:3px;right:0;top:0;background:0 0;width:100%;height:100%;z-index:10;border:0 solid #fff;animation:border-pulse 4s infinite}@keyframes border-pulse{0%{border-color:rgba(255,255,255,0);border-width:8px}50%{border-color:#fff;border-width:0}}.preview-document .preview-data-wrapper .save-settings p input:focus{outline-width:0;box-shadow:none}.preview-document .preview-data p{padding:1.4em 0;margin:0;color:#666;text-align:right;cursor:pointer;font-weight:lighter;float:right}.preview-document .preview-data p.order-search{display:none}.preview-document .preview-data input{float:right;margin:1em 0 0 1em;padding:.1em .5em;width:20ch;margin-right:-25ch;display:none}.preview-document .preview-data input.active{margin-right:0;display:inline-block}.preview-document .preview-data ul{position:absolute;right:0;top:4em;background:#fff;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);list-style:none;margin:0;padding:0;min-width:24em;display:block;height:0;overflow:hidden}.preview-document .preview-data ul.active{height:auto;z-index:1}.preview-document .preview-data ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.preview-document .preview-data ul li:hover{cursor:pointer;background:#51266b;color:#fff}.preview-document .preview-data ul li a,.preview-document .preview-data.preview-order-data ul li{display:block;padding:1.4em 1.6em}.preview-document .preview-data .arrow-down{font-size:.8em;color:#999;margin-left:8px}.preview-document .preview-data p:hover,.preview-document .preview-data p:hover>.arrow-down{color:#222}.preview-document .preview-data #preview-order-search-results{display:none;position:absolute;right:0;top:4em;width:300px;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);padding:20px 0;background-color:#fff;z-index:99}.preview-document .preview-data #preview-order-search-results a{display:block;border-left:1px solid #999;border-right:1px solid #999;border-top:1px solid #999;color:#000;padding:10px;margin:0 20px;text-decoration:none;cursor:pointer}.preview-document .preview-data #preview-order-search-results a:last-child{border-bottom:1px solid #999}.preview-document .preview-data #preview-order-search-results a:hover{background-color:#51266b;color:#fff}.preview-document .preview-data #preview-order-search-results .order-number{font-weight:700}.preview-document .preview-data #preview-order-search-results .date,.preview-document .preview-data #preview-order-search-results .total{margin-top:6px;display:inline-block}.preview-document .preview-data #preview-order-search-results .total{float:right}.preview-document .preview-data #preview-order-search-results .error{margin:0 20px}.preview-document .preview-order-search-wrapper{position:relative;float:right}.preview-document .preview-order-search-wrapper img.preview-order-search-clear{position:absolute;width:30px;height:16px;top:22px;right:6px;display:none;cursor:pointer}#wpo-wcpdf-preview-wrapper .gutter{flex:0 0 5%;position:sticky;top:2.4em;height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .gutter .slide-left,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .gutter .slide-left{float:right}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter .slide-left{border:none}#wpo-wcpdf-preview-wrapper .slider{box-sizing:border-box;padding-top:2.4em;color:#999;font-weight:700;cursor:pointer;font-size:.7em;line-height:1em;width:50%;height:100%;float:left}#wpo-wcpdf-preview-wrapper .slider.slide-left{text-align:right;padding-right:10px;border-right:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right{text-align:left;padding-left:10px;border-left:1px solid #ccc;display:none}#wpo-wcpdf-preview-wrapper .gutter-arrow{width:0;height:0;border-top:3px solid transparent;border-bottom:3px solid transparent;display:block}#wpo-wcpdf-preview-wrapper .arrow-left{border-right:7px solid #999;float:right}#wpo-wcpdf-preview-wrapper .arrow-right{border-left:7px solid #999}#wpo-wcpdf-preview-wrapper .slider:hover>.arrow-left{border-right:7px solid #222}#wpo-wcpdf-preview-wrapper .slider:hover>.arrow-right{border-left:7px solid #222}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{position:absolute;top:1.55em;right:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{position:absolute;top:1.55em;left:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .gutter{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter{height:100vh}#wpo-wcpdf-preview-wrapper[data-preview-state=full] .slide-right:after{display:inline-block}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .slide-left:after{display:inline-block}#wpo-wcpdf-preview-wrapper.static .gutter,#wpo-wcpdf-preview-wrapper.static .preview-document{position:static!important}#wpo-wcpdf-preview-wrapper.static .sidebar{height:170vh!important;overflow:hidden}#wpo-wcpdf-preview-wrapper input.readonly,#wpo-wcpdf-preview-wrapper input[readonly],#wpo-wcpdf-preview-wrapper textarea.readonly,#wpo-wcpdf-preview-wrapper textarea[readonly]{background-color:#f8f8f8}#wpo-wcpdf-preview-wrapper[data-preview-state=sidebar] .select2.select2-container{width:100%!important}.wcpdf_ubl_settings_sections{margin-bottom:4em}sup.wcpdf_beta{background-color:#51266b;color:#fff;font-size:7pt;padding:1px 2px;border-radius:2px}@media screen and (min-width:1920px){.preview-document .preview>#preview-canvas{max-width:900px}}@media screen and (max-width:1200px){.preview-document .preview>#preview-canvas{max-width:680px}.nav-tab-wrapper a.nav-tab{padding:1em 2em;margin:0 .5em .5em 0;border:1px solid #ccc;box-sizing:border-box;height:4em}.nav-tab-wrapper a.nav-tab.nav-tab-active{border:3px solid #51266b}}@media screen and (max-width:960px){.preview-document .preview>#preview-canvas{width:80vw!important}#wpo-wcpdf-preview-wrapper .sidebar>form{max-width:100%}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .select2.select2-container{width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block!important}.preview-document .preview-data-wrapper{height:6em}.preview-document .preview-data p{padding:2.2em 0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after,#wpo-wcpdf-preview-wrapper .slider.slide-right:after{top:1.5em;padding:1em;background:#fff;border:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{left:0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{right:0}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(2),#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(3){float:left;margin-bottom:10px}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td .woocommerce-help-tip:after{padding:.5em .8em;font-size:1.2em;line-height:inherit}}div.upgrade-table-description{padding:0 0 3em 1em}div.upgrade-table-description h1{font-family:serif;letter-spacing:-1px;font-size:3em}div.upgrade-table-description p{font-size:1.1em}#upgrade-table{width:100%;border-collapse:collapse;font-size:1.2em;margin-bottom:3em}#upgrade-table td,#upgrade-table th{padding:.8em 2em;border-bottom:1px solid #ccc;text-align:center}#upgrade-table th{font-weight:400;font-size:1.1em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:200px}#upgrade-table tr:last-child td{border:none}#upgrade-table td.feature-label{text-align:left;padding-left:1em;font-weight:700;width:500px}#upgrade-table td.feature-label span.description{display:inline-block;padding-top:10px;font-size:.8em;line-height:1.4em;font-weight:400;color:#555}#upgrade-table td span.feature-available{display:inline-block;width:24px;height:24px;background-repeat:no-repeat;background-size:cover}#upgrade-table a,div.upgrade-table-description a{color:#6e1edc;white-space:nowrap}#upgrade-table .upgrade-links h4{margin:1em 0 .5em 0}#upgrade-table .upgrade-links p{margin:0;font-style:oblique;font-size:.8em}#upgrade-table .upgrade-links a.upgrade_button{display:inline-block;background:#fff;padding:1em 3em 1em 2em;border-radius:12px;border:1px solid #6e1edc;text-decoration:none;margin:2em 0;position:relative}#upgrade-table .upgrade-links a.upgrade_button:after{content:' \2192';display:block;position:absolute;right:1.8em;top:1.1em;transition:.5s}#upgrade-table .upgrade-links a.upgrade_button:hover:after{right:1.1em;font-weight:700}#upgrade-table .upgrade-links a.upgrade_button:focus,#upgrade-table .upgrade-links a.upgrade_button:hover{background:#6e1edc;color:#fcfbf7}@media screen and (max-width:1100px){#upgrade-table{font-size:1em;line-height:1.2em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:25%;padding:.8em 1em}#upgrade-table td.last,#upgrade-table th.last{width:0;padding:0}#upgrade-table td.feature-label span.description{padding-top:6px}}@media screen and (max-width:767px){#upgrade-table td.feature-label span.description{display:none}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:20%}#upgrade-table td.first{width:40%}}@media screen and (max-width:649px){div.upgrade-table-description{padding-left:.8em}div.upgrade-table-description p{font-size:1em}#upgrade-table{font-size:.8em}#upgrade-table td,#upgrade-table th{padding:.5em .8em!important}#upgrade-table td span.feature-available{width:18px;height:18px}#upgrade-table .upgrade-links a{white-space:normal;padding:.6em .8em;border-radius:6px}#upgrade-table .upgrade-links a:after{display:none}} \ No newline at end of file +span.wpo-warning{display:inline-block;border:1px solid red;border-left:4px solid red;padding:5px 15px;background-color:#fff}.wcpdf-extensions-ad{position:relative;min-height:90px;border:1px solid #3d5c99;background-color:#ebf5ff;padding:15px;padding-left:100px;margin-top:15px}img.wpo-helper{position:absolute;bottom:0;left:3px}.wcpdf-extensions-ad h3{margin:0}.wcpdf-extensions-ad ul{margin:0;margin-left:1.5em}.wcpdf-extensions li{margin:0}.wcpdf-extensions li ul{list-style-type:square;margin-top:.5em;margin-bottom:.5em}.wcpdf-extensions>li:before{content:"";border-color:transparent transparent transparent #111;border-style:solid;border-width:.35em .35em .35em .45em;display:block;height:0;width:0;left:-1em;top:.9em;position:relative}.wcpdf-extensions li:not(.expanded){cursor:pointer}.wcpdf-extensions .expanded:before{border-color:#111 transparent transparent transparent;left:-1.17em;border-width:.45em .45em .35em .35em!important}.wcpdf-extensions .more{padding:10px;background-color:#fff;border:1px solid #ccc;border-radius:5px}.wcpdf-extensions table td{vertical-align:top}.dropbox-logo{margin-bottom:-10px;margin-right:10px}.cloud-logo{margin-bottom:-10px;margin-top:-5px;margin-right:10px}#img-header_logo{max-height:200px;width:auto;max-width:100%}.multiple-text-input label{padding-right:1em}table.multiple-text-input td{padding:0}table.wcpdf_documents_settings_list{width:100%;border-collapse:collapse;border-spacing:0;background-color:#fff;border-top:2px solid #000}table.wcpdf_documents_settings_list tr.odd{background-color:#ebf5ff}table.wcpdf_documents_settings_list td{padding:5px}table.wcpdf_documents_settings_list a{text-decoration:none}table.wcpdf_documents_settings_list td.settings-icon{text-align:right}table.wcpdf_documents_settings_list td.title{font-weight:700}.wcpdf-settings-sections ul{height:3em}.wcpdf-settings-sections ul li{float:left;margin-right:10px}.wcpdf-settings-sections ul li a{text-decoration:none;display:inline-block;padding:.8em 1em;color:#50575e;border:1px solid #c3c4c7;box-sizing:border-box}.wcpdf-settings-sections ul li a.active{border:2px solid #51266b;padding:calc(.8em - 1px) calc(1em - 1px);color:#000}.wcpdf_document_settings_sections{position:relative}.wcpdf_document_settings_sections>h2{cursor:pointer;padding:1em .8em;margin:0;border:1px solid #eaeaea}.wcpdf_document_settings_sections ul{background:#fff;list-style:none;margin:0;padding:0;width:100%;display:block;height:auto;display:none;box-sizing:border-box;position:absolute;border-left:1px solid #eaeaea;border-right:1px solid #eaeaea;z-index:1000;box-shadow:0 35px 35px -8px rgba(0,0,0,.1);-webkit-box-shadow:0 35px 35px -8px rgba(0,0,0,.1)}.wcpdf_document_settings_sections ul.active{display:block}.wcpdf_document_settings_sections ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.wcpdf_document_settings_sections ul li:hover{cursor:pointer;background:#51266b;color:#fff}.wcpdf_document_settings_sections ul li:hover a{color:#fff}.wcpdf_document_settings_sections ul li a{color:#000;text-decoration:none;padding:1.2em 1.6em;display:block}.wcpdf_document_settings_sections .arrow-down{font-size:.7em;color:#999;margin-left:8px;font-weight:400;float:right}.wcpdf_document_settings_sections p:hover,.wcpdf_document_settings_sections p:hover>.arrow-down{color:#222}.wcpdf_advanced_numbers_choose_table{margin-top:20px}.wcpdf_document_settings_document_output_formats{margin-bottom:30px}.edit-next-number{opacity:.5}.edit-next-number:hover{opacity:1;cursor:pointer}.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow,.wpo-wcpdf-pointer.wp-pointer-top .wp-pointer-arrow-inner{border-bottom-color:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3{border-color:#51266b;background:#51266b}.wpo-wcpdf-pointer .wp-pointer-content h3:before{color:#51266b}body.woocommerce_page_wpo_wcpdf_options_page{background:#fff}.wrap [class$=icon32]+h2{font-size:18px;padding:1em}.wrap .notice{margin:15px 0 0}.nav-tab-wrapper:not(.wcpdf_debug_settings_sections>.nav-tab-wrapper) a.nav-tab{background:0 0;border:none;border-bottom:3px solid transparent;padding:1em 0;margin:0 1.2em;font-size:15px}.nav-tab-wrapper:not(.wcpdf_debug_settings_sections>.nav-tab-wrapper) a.nav-tab.nav-tab-active{border-bottom:3px solid #51266b}#wpo-wcpdf-preview-wrapper{width:100%;height:auto;position:relative;display:flex;align-items:flex-start}#wpo-wcpdf-preview-wrapper .preview-document,#wpo-wcpdf-preview-wrapper .sidebar{transition:.3s ease-in-out}#wpo-wcpdf-preview-wrapper .sidebar{height:auto;padding:4em 0 0 0;box-sizing:border-box;background:0 0;flex:0 0 35%;overflow-x:hidden}#wpo-wcpdf-preview-wrapper .sidebar>form{background:0 0!important;overflow:visible;padding:0;margin-left:2em;box-sizing:border-box;width:calc(100% - 4em);max-width:50vw}#wpo-wcpdf-preview-wrapper .sidebar>form.editor{max-width:none}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block;width:100%;padding:0}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{padding-bottom:.6em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td{padding-bottom:2.4em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td p.description,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>p.description{font-size:.85em;padding-top:.7em}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input[type=url],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>textarea,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>input[type=text],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>input[type=url],#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>select,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td>textarea{max-width:none;width:100%}#wpo-wcpdf-preview-wrapper input[type=text][size],#wpo-wcpdf-preview-wrapper input[type=url][size]{width:auto!important;max-width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td>input#next_invoice_number{width:auto!important}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table{display:table}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody{display:table-row-group}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tbody tr,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table tr{display:table-row}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{display:table-cell;padding:15px 10px 15px 0;width:auto}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar .form-table>tbody>tr>th{width:300px!important}#wpo-wcpdf-settings .form-table .ui-tabs-nav{padding-left:0!important;margin-left:0!important}#wpo-wcpdf-settings .translations input,#wpo-wcpdf-settings .translations textarea{width:100%}#wpo-wcpdf-settings .wcpdf-attachment-settings-hint{border-left:4px solid #51266b}#wpo-wcpdf-settings .notice-info.inline{border-left-color:#51266b}#wpo-wcpdf-settings table#document-link-access-type{margin-top:-15px}#wpo-wcpdf-settings table#document-link-access-type td.option{padding-left:0}#wpo-wcpdf-settings table#document-link-access-type td{padding-top:0;padding-bottom:6px;font-size:12px}#wpo-wcpdf-settings .system-status-table{margin-top:2em}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .sidebar{flex:0 0 100%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .sidebar{flex:0 0 95%;margin-left:-95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .sidebar{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .sidebar{flex:0 0 35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .sidebar{margin-left:-35%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .sidebar{transition-delay:.4s}#wpo-wcpdf-preview-wrapper .preview-document{padding:0;box-sizing:border-box;position:sticky;top:2.4em;flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .preview-document{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .preview-document{flex:0 0 60%;margin-right:-60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .preview-document{flex:0 0 60%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=full] .preview-document{flex:0 0 95%}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] .preview-document{transition-delay:.4s}.preview-document .preview{width:100%;box-sizing:border-box;padding-right:5%}.preview-document .preview>#preview-ubl{width:100%;height:100%;overflow-wrap:anywhere;background-color:#222;color:#fff;padding:2em}.preview-document .preview>#preview-canvas{display:block;max-width:800px;max-height:85vh;width:auto!important;margin:0 auto;background:#fff;box-shadow:0 0 35px -8px rgba(0,0,0,.12);-webkit-box-shadow:0 0 35px -8px rgba(0,0,0,.12)}#wpo-wcpdf-preview-wrapper[data-preview-states="2"] #preview-canvas{max-height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=sidebar] #preview-canvas{max-height:170vh;transition:max-height .4s ease-in-out .3s}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-from-preview-state=full] #preview-canvas{transition:max-height .4s ease-in-out 0s}.preview-document .preview-data-wrapper{width:100%;height:4em}.preview-document .preview-data-wrapper .preview-document-type,.preview-document .preview-data-wrapper .preview-order-data{float:right}.preview-document .preview-data-wrapper .preview-document-type{margin-right:30px}.preview-document .preview-data-wrapper .preview-document-type ul>li{text-decoration:none;color:initial;padding:1.4em 1.6em}.preview-document .preview-data-wrapper .preview-document-type ul>li:hover{color:#fff!important}.preview-document .preview-data-wrapper .save-settings{padding:1em 0 0 0;float:right;overflow:hidden;position:relative}.preview-document .preview-data-wrapper .save-settings p{padding:0;margin:0 0 0 2em;position:relative;margin-right:-200px;transition:margin-right .3s ease-out}.preview-document .preview-data-wrapper .save-settings p:after{content:'';display:block;pointer-events:none;position:absolute;box-sizing:border-box;border-radius:3px;right:0;top:0;background:0 0;width:100%;height:100%;z-index:10;border:0 solid #fff;animation:border-pulse 4s infinite}@keyframes border-pulse{0%{border-color:rgba(255,255,255,0);border-width:8px}50%{border-color:#fff;border-width:0}}.preview-document .preview-data-wrapper .save-settings p input:focus{outline-width:0;box-shadow:none}.preview-document .preview-data p{padding:1.4em 0;margin:0;color:#666;text-align:right;cursor:pointer;font-weight:lighter;float:right}.preview-document .preview-data p.order-search{display:none}.preview-document .preview-data input{float:right;margin:1em 0 0 1em;padding:.1em .5em;width:20ch;margin-right:-25ch;display:none}.preview-document .preview-data input.active{margin-right:0;display:inline-block}.preview-document .preview-data ul{position:absolute;right:0;top:4em;background:#fff;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);list-style:none;margin:0;padding:0;min-width:24em;display:block;height:0;overflow:hidden}.preview-document .preview-data ul.active{height:auto;z-index:1}.preview-document .preview-data ul li{box-sizing:border-box;padding:0;margin-bottom:0;border-bottom:1px solid #eaeaea;font-size:1.1em}.preview-document .preview-data ul li:hover{cursor:pointer;background:#51266b;color:#fff}.preview-document .preview-data ul li a,.preview-document .preview-data.preview-order-data ul li{display:block;padding:1.4em 1.6em}.preview-document .preview-data .arrow-down{font-size:.8em;color:#999;margin-left:8px}.preview-document .preview-data p:hover,.preview-document .preview-data p:hover>.arrow-down{color:#222}.preview-document .preview-data #preview-order-search-results{display:none;position:absolute;right:0;top:4em;width:300px;box-shadow:0 0 25px -10px rgba(0,0,0,.2);-webkit-box-shadow:0 0 25px -10px rgba(0,0,0,.2);padding:20px 0;background-color:#fff;z-index:99}.preview-document .preview-data #preview-order-search-results a{display:block;border-left:1px solid #999;border-right:1px solid #999;border-top:1px solid #999;color:#000;padding:10px;margin:0 20px;text-decoration:none;cursor:pointer}.preview-document .preview-data #preview-order-search-results a:last-child{border-bottom:1px solid #999}.preview-document .preview-data #preview-order-search-results a:hover{background-color:#51266b;color:#fff}.preview-document .preview-data #preview-order-search-results .order-number{font-weight:700}.preview-document .preview-data #preview-order-search-results .date,.preview-document .preview-data #preview-order-search-results .total{margin-top:6px;display:inline-block}.preview-document .preview-data #preview-order-search-results .total{float:right}.preview-document .preview-data #preview-order-search-results .error{margin:0 20px}.preview-document .preview-order-search-wrapper{position:relative;float:right}.preview-document .preview-order-search-wrapper img.preview-order-search-clear{position:absolute;width:30px;height:16px;top:22px;right:6px;display:none;cursor:pointer}#wpo-wcpdf-preview-wrapper .gutter{flex:0 0 5%;position:sticky;top:2.4em;height:170vh}#wpo-wcpdf-preview-wrapper[data-preview-states="2"][data-preview-state=closed] .gutter .slide-left,#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=closed] .gutter .slide-left{float:right}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter .slide-left{border:none}#wpo-wcpdf-preview-wrapper .slider{box-sizing:border-box;padding-top:2.4em;color:#999;font-weight:700;cursor:pointer;font-size:.7em;line-height:1em;width:50%;height:100%;float:left}#wpo-wcpdf-preview-wrapper .slider.slide-left{text-align:right;padding-right:10px;border-right:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right{text-align:left;padding-left:10px;border-left:1px solid #ccc;display:none}#wpo-wcpdf-preview-wrapper .gutter-arrow{width:0;height:0;border-top:3px solid transparent;border-bottom:3px solid transparent;display:block}#wpo-wcpdf-preview-wrapper .arrow-left{border-right:7px solid #999;float:right}#wpo-wcpdf-preview-wrapper .arrow-right{border-left:7px solid #999}#wpo-wcpdf-preview-wrapper .slider:hover>.arrow-left{border-right:7px solid #222}#wpo-wcpdf-preview-wrapper .slider:hover>.arrow-right{border-left:7px solid #222}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{position:absolute;top:1.55em;right:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{position:absolute;top:1.55em;left:2em;font-size:1.4em;display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="1"] .gutter{display:none}#wpo-wcpdf-preview-wrapper[data-preview-states="3"][data-preview-state=sidebar] .gutter{height:100vh}#wpo-wcpdf-preview-wrapper[data-preview-state=full] .slide-right:after{display:inline-block}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .slide-left:after{display:inline-block}#wpo-wcpdf-preview-wrapper.static .gutter,#wpo-wcpdf-preview-wrapper.static .preview-document{position:static!important}#wpo-wcpdf-preview-wrapper.static .sidebar{height:170vh!important;overflow:hidden}#wpo-wcpdf-preview-wrapper input.readonly,#wpo-wcpdf-preview-wrapper input[readonly],#wpo-wcpdf-preview-wrapper textarea.readonly,#wpo-wcpdf-preview-wrapper textarea[readonly]{background-color:#f8f8f8}#wpo-wcpdf-preview-wrapper[data-preview-state=sidebar] .select2.select2-container{width:100%!important}.wcpdf_ubl_settings_sections{margin-bottom:4em}sup.wcpdf_beta{background-color:#51266b;color:#fff;font-size:7pt;padding:1px 2px;border-radius:2px}@media screen and (min-width:1920px){.preview-document .preview>#preview-canvas{max-width:900px}}@media screen and (max-width:1200px){.preview-document .preview>#preview-canvas{max-width:680px}.nav-tab-wrapper a.nav-tab{padding:1em 2em;margin:0 .5em .5em 0;border:1px solid #ccc;box-sizing:border-box;height:4em}.nav-tab-wrapper a.nav-tab.nav-tab-active{border:3px solid #51266b}}@media screen and (max-width:960px){.preview-document .preview>#preview-canvas{width:80vw!important}#wpo-wcpdf-preview-wrapper .sidebar>form{max-width:100%}#wpo-wcpdf-preview-wrapper[data-preview-state=closed] .select2.select2-container{width:100%!important}#wpo-wcpdf-preview-wrapper .sidebar .form-table,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tbody>tr>th,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>td,#wpo-wcpdf-preview-wrapper .sidebar .form-table>tr>th{display:block!important}.preview-document .preview-data-wrapper{height:6em}.preview-document .preview-data p{padding:2.2em 0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after,#wpo-wcpdf-preview-wrapper .slider.slide-right:after{top:1.5em;padding:1em;background:#fff;border:1px solid #ccc}#wpo-wcpdf-preview-wrapper .slider.slide-right:after{left:0}#wpo-wcpdf-preview-wrapper .slider.slide-left:after{right:0}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(2),#wpo-wcpdf-preview-wrapper .multiple-text-input tr td:nth-child(3){float:left;margin-bottom:10px}#wpo-wcpdf-preview-wrapper .multiple-text-input tr td .woocommerce-help-tip:after{padding:.5em .8em;font-size:1.2em;line-height:inherit}}div.upgrade-table-description{padding:0 0 3em 1em}div.upgrade-table-description h1{font-family:serif;letter-spacing:-1px;font-size:3em}div.upgrade-table-description p{font-size:1.1em}#upgrade-table{width:100%;border-collapse:collapse;font-size:1.2em;margin-bottom:3em}#upgrade-table td,#upgrade-table th{padding:.8em 2em;border-bottom:1px solid #ccc;text-align:center}#upgrade-table th{font-weight:400;font-size:1.1em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:200px}#upgrade-table tr:last-child td{border:none}#upgrade-table td.feature-label{text-align:left;padding-left:1em;font-weight:700;width:500px}#upgrade-table td.feature-label span.description{display:inline-block;padding-top:10px;font-size:.8em;line-height:1.4em;font-weight:400;color:#555}#upgrade-table td span.feature-available{display:inline-block;width:24px;height:24px;background-repeat:no-repeat;background-size:cover}#upgrade-table a,div.upgrade-table-description a{color:#6e1edc;white-space:nowrap}#upgrade-table .upgrade-links h4{margin:1em 0 .5em 0}#upgrade-table .upgrade-links p{margin:0;font-style:oblique;font-size:.8em}#upgrade-table .upgrade-links a.upgrade_button{display:inline-block;background:#fff;padding:1em 3em 1em 2em;border-radius:12px;border:1px solid #6e1edc;text-decoration:none;margin:2em 0;position:relative}#upgrade-table .upgrade-links a.upgrade_button:after{content:' \2192';display:block;position:absolute;right:1.8em;top:1.1em;transition:.5s}#upgrade-table .upgrade-links a.upgrade_button:hover:after{right:1.1em;font-weight:700}#upgrade-table .upgrade-links a.upgrade_button:focus,#upgrade-table .upgrade-links a.upgrade_button:hover{background:#6e1edc;color:#fcfbf7}@media screen and (max-width:1100px){#upgrade-table{font-size:1em;line-height:1.2em}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:25%;padding:.8em 1em}#upgrade-table td.last,#upgrade-table th.last{width:0;padding:0}#upgrade-table td.feature-label span.description{padding-top:6px}}@media screen and (max-width:767px){#upgrade-table td.feature-label span.description{display:none}#upgrade-table td:not(.last),#upgrade-table th:not(.last){width:20%}#upgrade-table td.first{width:40%}}@media screen and (max-width:649px){div.upgrade-table-description{padding-left:.8em}div.upgrade-table-description p{font-size:1em}#upgrade-table{font-size:.8em}#upgrade-table td,#upgrade-table th{padding:.5em .8em!important}#upgrade-table td span.feature-available{width:18px;height:18px}#upgrade-table .upgrade-links a{white-space:normal;padding:.6em .8em;border-radius:6px}#upgrade-table .upgrade-links a:after{display:none}} \ No newline at end of file diff --git a/assets/js/debug-script.js b/assets/js/debug-script.js index ff228c934..5c7bfc2c7 100644 --- a/assets/js/debug-script.js +++ b/assets/js/debug-script.js @@ -93,4 +93,103 @@ jQuery( function( $ ) { } } ).trigger( 'change' ); + // danger zone enabled notice + if ( true === wpo_wcpdf_debug.danger_zone['enabled'] ) { + let notice = '

' + wpo_wcpdf_debug.danger_zone['message'] + '

'; + $( "input#enable_danger_zone_tools" ).closest( 'td' ).find( '.description' ).append( notice ); + } + + // number search + $( document.body ).on( 'click', '#wpo-wcpdf-settings a.number-search-button', function( e ) { + e.preventDefault(); + + let search_val = $( this ).closest( 'div' ).find( ':input[name="number_search_input"]' ).val(); + window.location.href = window.location.href + '&s=' + search_val; + } ); + + // datepicker + $( '#renumber-date-from, #renumber-date-to, #delete-date-from, #delete-date-to' ).datepicker( { dateFormat: 'yy-mm-dd' } ); + + // danger zone tools + $( '#wpo-wcpdf-settings .number-tools-btn' ).click( function( event ) { + event.preventDefault(); + + let documentType = ''; + let dateFrom = ''; + let dateTo = ''; + let deleteOrRenumber = ''; + let pageCount = 1; + let documentCount = 0; + + if ( 'renumber-documents-btn' === this.id ) { + documentType = $( '#renumber-document-type' ).val(); + dateFrom = $( '#renumber-date-from' ).val(); + dateTo = $( '#renumber-date-to' ).val(); + deleteOrRenumber = 'renumber'; + + } else if ( 'delete-documents-btn' === this.id ) { + documentType = $( '#delete-document-type' ).val(); + dateFrom = $( '#delete-date-from' ).val(); + dateTo = $( '#delete-date-to' ).val(); + deleteOrRenumber = 'delete'; + } + + if ( '' === documentType || 'undefined' === documentType ) { + alert( wpo_wcpdf_debug.select_document_type ); + return; + } + + if ( 'renumber' === deleteOrRenumber ) { + $( '.renumber-spinner' ).css( 'visibility', 'visible' ); + } else if ( 'delete' === deleteOrRenumber ) { + $( '.delete-spinner' ).css( 'visibility', 'visible' ); + } + + $( '#renumber-documents-btn, #delete-documents-btn' ).attr( 'disabled', true ); + $( '#renumber-document-type, #renumber-date-from, #renumber-date-to, #delete-document-type, #delete-date-from, #delete-date-to' ).prop( 'disabled', true ); + + // first call + renumberOrDeleteDocuments( documentType, dateFrom, dateTo, pageCount, documentCount, deleteOrRenumber ); + } ); + + function renumberOrDeleteDocuments( documentType, dateFrom, dateTo, pageCount, documentCount, deleteOrRenumber ) { + let data = { + 'action': 'wpo_wcpdf_danger_zone_tools', + 'delete_or_renumber': deleteOrRenumber, + 'document_type': documentType, + 'date_from': dateFrom, + 'date_to': dateTo, + 'page_count': pageCount, + 'document_count': documentCount, + 'nonce': wpo_wcpdf_debug.nonce, + }; + + $.ajax( { + type: 'POST', + url: wpo_wcpdf_debug.ajaxurl, + data: data, + dataType: 'json', + success: function( response ) { + if ( false === response.data.finished ) { + // update page count and document count + pageCount = response.data.pageCount; + documentCount = response.data.documentCount; + + // recall function + renumberOrDeleteDocuments( documentType, dateFrom, dateTo, pageCount, documentCount, deleteOrRenumber ); + + } else { + $( '.renumber-spinner, .delete-spinner' ).css( 'visibility', 'hidden' ); + $( '#renumber-documents-btn, #delete-documents-btn' ).removeAttr( 'disabled' ); + $( '#renumber-document-type, #renumber-date-from, #renumber-date-to, #delete-document-type, #delete-date-from, #delete-date-to' ).prop( 'disabled', false ); + let message = response.data.message; + alert( documentCount + message ); + } + }, + error: function( xhr, ajaxOptions, thrownError ) { + alert( xhr.status + ':'+ thrownError ); + } + } ); + } + } ); \ No newline at end of file diff --git a/assets/js/debug-script.min.js b/assets/js/debug-script.min.js index 0a5b4404d..bdbb2b6de 100644 --- a/assets/js/debug-script.min.js +++ b/assets/js/debug-script.min.js @@ -1 +1 @@ -jQuery(function(a){function b(b,c,d){let e=d.find(".notice");switch(e.hide(),e.removeClass("notice-error"),e.removeClass("notice-success"),b){case"export-settings":if(c.success&&c.data.filename&&c.data.settings){d.find(".download_file").remove();let b={type:d.find("select[name=\"type\"").val(),settings:c.data.settings};b="data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(b)),d.append(a("
"+c.data.filename+"
"))}else!c.success&&c.data.message&&(e.addClass("notice-error"),e.find("p").text(c.data.message),e.show());break;case"import-settings":case"reset-settings":c.success&&c.data.message?e.addClass("notice-success"):!c.success&&c.data.message&&e.addClass("notice-error"),e.find("p").text(c.data.message),e.show()}}a(".wpo_wcpdf_debug_tools_form a.submit").on("click",function(c){c.preventDefault();let d=a(this).closest("form"),e=d.find("input[name=\"debug_tool\"]").val(),f=new FormData(d[0]);f.append("action","wpo_wcpdf_debug_tools"),f.append("nonce",wpo_wcpdf_debug.nonce),d.closest(".tool").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});let g=!1;g="reset-settings"!==e||window.confirm(wpo_wcpdf_debug.confirm_reset),g&&a.ajax({url:wpo_wcpdf_debug.ajaxurl,data:f,type:"POST",cache:!1,processData:!1,contentType:!1,success(a){b(e,a,d)},error(){}}),d.closest(".tool").unblock()}),a("[name='wpo_wcpdf_settings_debug[document_access_denied_redirect_page]']").on("change",function(){let b=a(this).closest("table").find("#document_custom_redirect_page"),c=b.closest("td").find(".description");"custom_page"===a(this).val()?(b.show(),c.show()):(b.hide(),c.hide())}).trigger("change")}); \ No newline at end of file +jQuery(function(a){function b(b,c,d){let e=d.find(".notice");switch(e.hide(),e.removeClass("notice-error"),e.removeClass("notice-success"),b){case"export-settings":if(c.success&&c.data.filename&&c.data.settings){d.find(".download_file").remove();let b={type:d.find("select[name=\"type\"").val(),settings:c.data.settings};b="data:text/plain;charset=utf-8,"+encodeURIComponent(JSON.stringify(b)),d.append(a("
"+c.data.filename+"
"))}else!c.success&&c.data.message&&(e.addClass("notice-error"),e.find("p").text(c.data.message),e.show());break;case"import-settings":case"reset-settings":c.success&&c.data.message?e.addClass("notice-success"):!c.success&&c.data.message&&e.addClass("notice-error"),e.find("p").text(c.data.message),e.show()}}function c(b,d,e,f,g,h){let i={action:"wpo_wcpdf_danger_zone_tools",delete_or_renumber:h,document_type:b,date_from:d,date_to:e,page_count:f,document_count:g,nonce:wpo_wcpdf_debug.nonce};a.ajax({type:"POST",url:wpo_wcpdf_debug.ajaxurl,data:i,dataType:"json",success:function(i){if(!1===i.data.finished)f=i.data.pageCount,g=i.data.documentCount,c(b,d,e,f,g,h);else{a(".renumber-spinner, .delete-spinner").css("visibility","hidden"),a("#renumber-documents-btn, #delete-documents-btn").removeAttr("disabled"),a("#renumber-document-type, #renumber-date-from, #renumber-date-to, #delete-document-type, #delete-date-from, #delete-date-to").prop("disabled",!1);let b=i.data.message;alert(g+b)}},error:function(a,b,c){alert(a.status+":"+c)}})}if(a(".wpo_wcpdf_debug_tools_form a.submit").on("click",function(c){c.preventDefault();let d=a(this).closest("form"),e=d.find("input[name=\"debug_tool\"]").val(),f=new FormData(d[0]);f.append("action","wpo_wcpdf_debug_tools"),f.append("nonce",wpo_wcpdf_debug.nonce),d.closest(".tool").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});let g=!1;g="reset-settings"!==e||window.confirm(wpo_wcpdf_debug.confirm_reset),g&&a.ajax({url:wpo_wcpdf_debug.ajaxurl,data:f,type:"POST",cache:!1,processData:!1,contentType:!1,success(a){b(e,a,d)},error(){}}),d.closest(".tool").unblock()}),a("[name='wpo_wcpdf_settings_debug[document_access_denied_redirect_page]']").on("change",function(){let b=a(this).closest("table").find("#document_custom_redirect_page"),c=b.closest("td").find(".description");"custom_page"===a(this).val()?(b.show(),c.show()):(b.hide(),c.hide())}).trigger("change"),!0===wpo_wcpdf_debug.danger_zone.enabled){let b="

"+wpo_wcpdf_debug.danger_zone.message+"

";a("input#enable_danger_zone_tools").closest("td").find(".description").append(b)}a(document.body).on("click","#wpo-wcpdf-settings a.number-search-button",function(b){b.preventDefault();let c=a(this).closest("div").find(":input[name=\"number_search_input\"]").val();window.location.href=window.location.href+"&s="+c}),a("#renumber-date-from, #renumber-date-to, #delete-date-from, #delete-date-to").datepicker({dateFormat:"yy-mm-dd"}),a("#wpo-wcpdf-settings .number-tools-btn").click(function(b){b.preventDefault();let d="",e="",f="",g="";return"renumber-documents-btn"===this.id?(d=a("#renumber-document-type").val(),e=a("#renumber-date-from").val(),f=a("#renumber-date-to").val(),g="renumber"):"delete-documents-btn"===this.id&&(d=a("#delete-document-type").val(),e=a("#delete-date-from").val(),f=a("#delete-date-to").val(),g="delete"),""===d||"undefined"===d?void alert(wpo_wcpdf_debug.select_document_type):void("renumber"===g?a(".renumber-spinner").css("visibility","visible"):"delete"===g&&a(".delete-spinner").css("visibility","visible"),a("#renumber-documents-btn, #delete-documents-btn").attr("disabled",!0),a("#renumber-document-type, #renumber-date-from, #renumber-date-to, #delete-document-type, #delete-date-from, #delete-date-to").prop("disabled",!0),c(d,e,f,1,0,g))})}); \ No newline at end of file diff --git a/includes/class-wcpdf-assets.php b/includes/class-wcpdf-assets.php index 32d91ae2d..50a920090 100644 --- a/includes/class-wcpdf-assets.php +++ b/includes/class-wcpdf-assets.php @@ -228,27 +228,45 @@ public function backend_scripts_styles ( $hook ) { // status/debug page scripts if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'wpo_wcpdf_options_page' && isset( $_REQUEST['tab'] ) && $_REQUEST['tab'] == 'debug' ) { + wp_enqueue_style( + 'wpo-wcpdf-jquery-ui-styles', + 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' + ); + + wp_enqueue_script( 'jquery-ui-datepicker' ); wp_enqueue_style( 'wpo-wcpdf-debug-tools-styles', WPO_WCPDF()->plugin_url() . '/assets/css/debug-tools'.$suffix.'.css', WPO_WCPDF_VERSION ); + wp_enqueue_script( 'wpo-wcpdf-debug', WPO_WCPDF()->plugin_url() . '/assets/js/debug-script'.$suffix.'.js', - [ 'jquery', 'jquery-blockui' ], + array( 'jquery', 'jquery-blockui', 'jquery-ui-datepicker' ), WPO_WCPDF_VERSION ); + wp_localize_script( 'wpo-wcpdf-debug', 'wpo_wcpdf_debug', - [ - 'ajaxurl' => admin_url( 'admin-ajax.php' ), - 'nonce' => wp_create_nonce( 'wpo_wcpdf_debug_nonce' ), - 'download_label' => __( 'Download', 'woocommerce-pdf-invoices-packing-slips' ), - 'confirm_reset' => __( 'Are you sure you want to reset this settings? This cannot be undone.', 'woocommerce-pdf-invoices-packing-slips' ), - ] + array( + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'nonce' => wp_create_nonce( 'wpo_wcpdf_debug_nonce' ), + 'download_label' => __( 'Download', 'woocommerce-pdf-invoices-packing-slips' ), + 'confirm_reset' => __( 'Are you sure you want to reset this settings? This cannot be undone.', 'woocommerce-pdf-invoices-packing-slips' ), + 'select_document_type' => __( 'Please select a document type', 'woocommerce-pdf-invoices-packing-slips' ), + 'danger_zone' => array( + 'enabled' => isset( WPO_WCPDF()->settings->debug_settings['enable_danger_zone_tools'] ) ? true : false, + 'message' => sprintf( + /* translators: tags */ + __( 'Enabled: %sclick here%s to start using the tools.', 'woocommerce-pdf-invoices-packing-slips' ), + '', + '' + ), + ), + ) ); } diff --git a/includes/class-wcpdf-documents.php b/includes/class-wcpdf-documents.php index ccc142cf3..5f633219b 100644 --- a/includes/class-wcpdf-documents.php +++ b/includes/class-wcpdf-documents.php @@ -106,6 +106,17 @@ public function get_document( $document_type, $order ) { return false; } + + public function get_document_titles() { + $documents = $this->get_documents(); + $document_titles = array(); + + foreach ( $documents as $document ) { + $document_titles[ $document->get_type() ] = $document->get_title(); + } + + return $document_titles; + } } diff --git a/includes/class-wcpdf-install.php b/includes/class-wcpdf-install.php index 96bca2541..619201927 100644 --- a/includes/class-wcpdf-install.php +++ b/includes/class-wcpdf-install.php @@ -72,8 +72,8 @@ public function do_install() { update_option( $version_setting, WPO_WCPDF_VERSION ); } - // deactivate ubl addon - add_action( 'admin_init', array( WPO_WCPDF(), 'deactivate_ubl_addon') ); + // deactivate legacy addons + add_action( 'admin_init', array( WPO_WCPDF(), 'deactivate_legacy_addons') ); } diff --git a/includes/class-wcpdf-main.php b/includes/class-wcpdf-main.php index 091f12794..56754df69 100644 --- a/includes/class-wcpdf-main.php +++ b/includes/class-wcpdf-main.php @@ -51,7 +51,7 @@ public function __construct() { add_filter( 'wpo_wcpdf_pdf_filters', array( $this, 'pdf_currency_filters' ) ); add_filter( 'wpo_wcpdf_html_filters', array( $this, 'html_currency_filters' ) ); - // scheduled attachments cleanup (following settings on Status tab) + // scheduled attachments cleanup (following settings on Advanced tab) add_action( 'wp_scheduled_delete', array( $this, 'schedule_temporary_files_cleanup' ) ); // remove private data diff --git a/includes/class-wcpdf-settings.php b/includes/class-wcpdf-settings.php index b4f991530..173285f0a 100644 --- a/includes/class-wcpdf-settings.php +++ b/includes/class-wcpdf-settings.php @@ -162,7 +162,7 @@ function check_auto_increment_increment() { $row = $wpdb->get_row( "SHOW VARIABLES LIKE 'auto_increment_increment'" ); if ( ! empty( $row ) && ! empty( $row->Value ) && $row->Value != 1 ) { /* translators: database row value */ - $error = wp_kses_post( sprintf( __( "Warning! Your database has an AUTO_INCREMENT step size of %d, your invoice numbers may not be sequential. Enable the 'Calculate document numbers (slow)' setting in the Status tab to use an alternate method." , 'woocommerce-pdf-invoices-packing-slips' ), intval( $row->Value ) ) ); + $error = wp_kses_post( sprintf( __( "Warning! Your database has an AUTO_INCREMENT step size of %d, your invoice numbers may not be sequential. Enable the 'Calculate document numbers (slow)' setting in the Advanced tab to use an alternate method." , 'woocommerce-pdf-invoices-packing-slips' ), intval( $row->Value ) ) ); printf( '

%s

', $error ); } } @@ -190,7 +190,7 @@ public function settings_page() { // add status and upgrade tabs last in row $settings_tabs['debug'] = array( - 'title' => __( 'Status', 'woocommerce-pdf-invoices-packing-slips' ), + 'title' => __( 'Advanced', 'woocommerce-pdf-invoices-packing-slips' ), 'preview_states' => 1, ); @@ -204,7 +204,7 @@ public function settings_page() { $active_tab = isset( $_GET[ 'tab' ] ) ? sanitize_text_field( $_GET[ 'tab' ] ) : $default_tab; $active_section = isset( $_GET[ 'section' ] ) ? sanitize_text_field( $_GET[ 'section' ] ) : ''; - include( 'views/wcpdf-settings-page.php' ); + include( 'views/settings-page.php' ); } public function maybe_disable_preview_on_settings_tabs( $settings_tabs ) { diff --git a/includes/documents/abstract-wcpdf-order-document-methods.php b/includes/documents/abstract-wcpdf-order-document-methods.php index 5853a02f8..090bb4cb9 100644 --- a/includes/documents/abstract-wcpdf-order-document-methods.php +++ b/includes/documents/abstract-wcpdf-order-document-methods.php @@ -871,7 +871,7 @@ public function get_thumbnail ( $product ) { * which turns the function 'imagecreatefromwebp()' inexistent, * leading to display an error in DOMPDF. * - * Check 'System configuration' in the Status tab for 'webp' support. + * Check 'System configuration' in the Advanced tab for 'webp' support. */ if ( 'webp' === wp_check_filetype( $thumbnail_path )['ext'] && ! function_exists( 'imagecreatefromwebp' ) ) { $thumbnail = ''; diff --git a/includes/settings/class-wcpdf-settings-callbacks.php b/includes/settings/class-wcpdf-settings-callbacks.php index b4f52e2e1..07a493604 100644 --- a/includes/settings/class-wcpdf-settings-callbacks.php +++ b/includes/settings/class-wcpdf-settings-callbacks.php @@ -453,7 +453,7 @@ public function media_upload( $args ) { if ( 'webp' === wp_check_filetype( $attachment_src )['ext'] && ! function_exists( 'imagecreatefromwebp' ) ) { printf( '

%s

', - wp_kses_post( 'File type webp is not supported by your server! Please check your System Configurations under the Status tab.', 'woocommerce-pdf-invoices-packing-slips' ) + wp_kses_post( 'File type webp is not supported by your server! Please check your System Configurations under the Advanced tab.', 'woocommerce-pdf-invoices-packing-slips' ) ); } diff --git a/includes/settings/class-wcpdf-settings-debug.php b/includes/settings/class-wcpdf-settings-debug.php index 542b2cace..c130bef1f 100644 --- a/includes/settings/class-wcpdf-settings-debug.php +++ b/includes/settings/class-wcpdf-settings-debug.php @@ -1,6 +1,8 @@ sections = array( + 'settings' => __( 'Settings', 'woocommerce-pdf-invoices-packing-slips' ), + 'status' => __( 'Status', 'woocommerce-pdf-invoices-packing-slips' ), + 'tools' => __( 'Tools', 'woocommerce-pdf-invoices-packing-slips' ), + 'numbers' => __( 'Numbers', 'woocommerce-pdf-invoices-packing-slips' ), + ); + add_action( 'admin_init', array( $this, 'init_settings' ) ); add_action( 'wpo_wcpdf_settings_output_debug', array( $this, 'output' ), 10, 1 ); - add_action( 'wpo_wcpdf_after_settings_page', array( $this, 'debug_tools' ), 10, 2 ); - - add_action( 'wpo_wcpdf_after_settings_page', array( $this, 'dompdf_status' ), 20, 2 ); - add_action( 'wp_ajax_wpo_wcpdf_debug_tools', array( $this, 'ajax_debug_tools' ) ); + add_action( 'wp_ajax_wpo_wcpdf_debug_tools', array( $this, 'ajax_process_settings_debug_tools' ) ); + add_action( 'wp_ajax_wpo_wcpdf_danger_zone_tools', array( $this, 'ajax_process_danger_zone_tools' ) ); } - public function output( $section ) { - settings_fields( "wpo_wcpdf_settings_debug" ); - do_settings_sections( "wpo_wcpdf_settings_debug" ); + public function output( $active_section ) { + $active_section = ! empty( $active_section ) ? $active_section : 'settings'; + + ?> +
+ +
+ display_settings(); + break; + case 'status': + $this->display_status(); + break; + case 'tools': + $this->process_debug_tools(); + $this->display_tools(); + break; + case 'numbers': + $this->display_numbers(); + break; + } + } + + public function display_settings() { + settings_fields( 'wpo_wcpdf_settings_debug' ); + do_settings_sections( 'wpo_wcpdf_settings_debug' ); submit_button(); } + + public function display_status() { + include( WPO_WCPDF()->plugin_path() . '/includes/views/advanced-status.php' ); + } - public function debug_tools( $tab, $section ) { - if ( $tab !== 'debug' ) { - return; - } - ?> -

-
-
- -
-

-

-
- - - - plugin_path() . '/includes/views/advanced-tools.php' ); + } + + public function display_numbers() { + global $wpdb; - if ( ! empty( WPO_WCPDF()->main->get_random_string() ) ) { - $old_path = WPO_WCPDF()->main->get_tmp_base(); - } else { - $old_path = WPO_WCPDF()->main->get_tmp_base( false ); - } - - WPO_WCPDF()->main->generate_random_string(); - $new_path = WPO_WCPDF()->main->get_tmp_base(); - WPO_WCPDF()->main->copy_directory( $old_path, $new_path ); - WPO_WCPDF()->main->maybe_reinstall_fonts( true ); - /* translators: directory path */ - printf('

%s

', sprintf( esc_html__( 'Temporary folder moved to %s', 'woocommerce-pdf-invoices-packing-slips' ), ''.$new_path.'' ) ); - } - ?> -
-
-
-

-

-
- - - - get_number_store_tables(); + $invoice_number_store_doc_types = WPO_WCPDF()->settings->debug->get_additional_invoice_number_store_document_types(); + $store_name = 'invoice_number'; + + if ( isset( $_GET['table_name'] ) ) { + $selected_table_name = esc_attr( $_GET['table_name'] ); + } else { + $_GET['table_name'] = $selected_table_name = apply_filters( 'wpo_wcpdf_number_store_table_name', "{$wpdb->prefix}wcpdf_{$store_name}", $store_name, null ); // i.e. wp_wcpdf_invoice_number or wp_wcpdf_invoice_number_2021 + } + + if ( ! isset( $number_store_tables[ $_GET['table_name'] ] ) ) { + $_GET['table_name'] = $selected_table_name = null; + } + + $document_type = WPO_WCPDF()->settings->debug->get_document_type_from_store_table_name( esc_attr( $_GET['table_name'] ) ); - WPO_WCPDF()->main->maybe_reinstall_fonts( true ); - printf('

%s

', esc_html__( 'Fonts reinstalled!', 'woocommerce-pdf-invoices-packing-slips' ) ); - } - ?> -
-
- settings->yearly_reset_action_is_scheduled() ) : ?> -
-

-

-
- - - - prepare_items(); + + include( WPO_WCPDF()->plugin_path() . '/includes/views/advanced-numbers.php' ); + } + + private function get_number_store_tables() { + global $wpdb; + + $tables = $wpdb->get_results( "SHOW TABLES LIKE '{$wpdb->prefix}wcpdf_%'" ); + $document_titles = WPO_WCPDF()->documents->get_document_titles(); + $table_names = array(); + + foreach ( $tables as $table ) { + foreach ( $table as $table_name ) { + if ( ! empty ( $table_name ) ) { + // strip the default prefix + $store_name = $full_store_name = substr( $table_name, strpos( $table_name, 'wcpdf_' ) + strlen( 'wcpdf_' ) ); + + // strip year suffix, if present + if ( is_numeric( substr( $full_store_name, -4 ) ) ) { + $store_name = trim( substr( $full_store_name, 0, -4 ), '_' ); + } + + if ( empty( $store_name ) || empty( $full_store_name ) ) { + continue; + } + + // strip '_number' and other remaining suffixes + $suffix = substr( $full_store_name, strpos( $full_store_name, '_number' ) + strlen( '_number' ) ); + $clean_suffix = ! empty( $suffix ) ? trim( str_replace( '_number', '', $suffix ), '_' ) : $suffix; + $name = substr( $store_name, 0, strpos( $store_name, '_number' ) ); + $title = ''; + + if ( ! empty( $name ) ) { + $title = ! empty( $document_titles[ $name ] ) ? $document_titles[ $name ] : ucwords( str_replace( array( "__", "_", "-" ), ' ', $name ) ); + } + + if ( ! empty ( $suffix ) ) { + $title = "{$title} ({$clean_suffix})"; + } + + $table_names[ $table_name ] = $title; + } + } + } - WPO_WCPDF()->settings->schedule_yearly_reset_numbers(); - printf( '

%s

', esc_html__( 'Yearly reset numbering system rescheduled!', 'woocommerce-pdf-invoices-packing-slips' ) ); - } - ?> -
-
- -
-

-

-
- - - - main->temporary_files_cleanup( time() ); - printf( '

%2$s

', key( $output ), reset( $output ) ); - } - ?> -
-
-
-

-

- -
-
-

-

-
- -
- - -
-
- -
-
-
-
-

-

-
- -
- - -
-
- -
-
-
-
-

-

-
- -
- - -
-
- -
-
-
- -
-
-
- documents->get_documents(); + + foreach ( $documents as $document ) { + if ( in_array( $document->get_type(), array( 'proforma', 'credit-note' ) ) && $document->is_enabled() && is_callable( array( $document, 'get_number_sequence' ) ) ) { + $number_sequence = $document->get_number_sequence( '', $document ); + if ( 'invoice_number' === $number_sequence ) { + $additional_doc_types[] = $document->get_type(); + } + } + } + + return $additional_doc_types; + } + + public function process_debug_tools() { + if ( isset( $_REQUEST['wpo_wcpdf_debug_tools_action'] ) && is_callable( array( $this, $_REQUEST['wpo_wcpdf_debug_tools_action'] ) ) ) { + if ( check_admin_referer( 'wpo_wcpdf_debug_tools_action', 'security' ) ) { + // generate_random_string, install_fonts, reschedule_yearly_reset, clear_tmp + call_user_func( array( $this, $_REQUEST['wpo_wcpdf_debug_tools_action'] ) ); + } + } + } + + private function generate_random_string() { + if ( ! empty( WPO_WCPDF()->main->get_random_string() ) ) { + $old_path = WPO_WCPDF()->main->get_tmp_base(); + } else { + $old_path = WPO_WCPDF()->main->get_tmp_base( false ); } - if ( empty( $data['debug_tool'] ) || ! in_array( $data['debug_tool'], $debug_tools ) ) { + WPO_WCPDF()->main->generate_random_string(); + $new_path = WPO_WCPDF()->main->get_tmp_base(); + WPO_WCPDF()->main->copy_directory( $old_path, $new_path ); + WPO_WCPDF()->main->maybe_reinstall_fonts( true ); + + /* translators: directory path */ + printf( '

%s

', sprintf( esc_html__( 'Temporary folder moved to %s', 'woocommerce-pdf-invoices-packing-slips' ), ''.$new_path.'' ) ); + } + + private function install_fonts() { + WPO_WCPDF()->main->maybe_reinstall_fonts( true ); + printf( '

%s

', esc_html__( 'Fonts reinstalled!', 'woocommerce-pdf-invoices-packing-slips' ) ); + } + + private function reschedule_yearly_reset() { + WPO_WCPDF()->settings->schedule_yearly_reset_numbers(); + printf( '

%s

', esc_html__( 'Yearly reset numbering system rescheduled!', 'woocommerce-pdf-invoices-packing-slips' ) ); + } + + private function clear_tmp() { + $output = WPO_WCPDF()->main->temporary_files_cleanup( time() ); + printf( '

%2$s

', key( $output ), reset( $output ) ); + } + + public function ajax_process_settings_debug_tools() { + check_ajax_referer( 'wpo_wcpdf_debug_nonce', 'nonce' ); + + $data = stripslashes_deep( $_REQUEST ); + + if ( empty( $data['action'] ) || 'wpo_wcpdf_debug_tools' !== $data['action'] || empty( $data['debug_tool'] ) ) { return; } - $debug_tool = esc_attr( $data['debug_tool'] ); + $debug_tool = str_replace( '-', '_', esc_attr( $data['debug_tool'] ) ); - switch ( $debug_tool ) { - case 'export-settings': - $this->export_settings( $data ); - break; - case 'import-settings': - $this->import_settings( $data ); - break; - case 'reset-settings': - $this->reset_settings( $data ); - break; + if ( is_callable( array( $this, $debug_tool ) ) ) { + // export_settings, import_settings, reset_settings + call_user_func_array( array( $this, $debug_tool ), array( $data ) ); } wp_die(); } - public function export_settings( $data ) { + private function export_settings( $data ) { extract( $data ); if ( empty( $type ) ) { @@ -290,7 +305,7 @@ public function export_settings( $data ) { wp_send_json_success( compact( 'filename', 'settings' ) ); } - public function import_settings( $data ) { + private function import_settings( $data ) { extract( $data ); $file_data = []; @@ -372,7 +387,7 @@ public function import_settings( $data ) { } } - public function reset_settings( $data ) { + private function reset_settings( $data ) { extract( $data ); if ( empty( $type ) ) { @@ -456,6 +471,113 @@ public function reset_settings( $data ) { } } + public function ajax_process_danger_zone_tools() { + check_ajax_referer( 'wpo_wcpdf_debug_nonce', 'nonce' ); + + $request = stripslashes_deep( $_REQUEST ); + + if ( ! isset( $request['document_type'] ) || ! isset( $request['date_from'] ) || ! isset( $request['date_to'] ) ) { + $message = __( 'One or more request parameters missing.', 'woocommerce-pdf-invoices-packing-slips' ); + wp_send_json_error( compact( $message ) ); + } + + $from_date = date_i18n( 'Y-m-d', strtotime( $request['date_from'] ) ); + $to_date = date_i18n( 'Y-m-d', strtotime( $request['date_to'] ) ); + $document_type = esc_attr( $request['document_type'] ); + $document_types = ! empty( $document_type ) && ( 'all' !== $document_type ) ? array( $document_type ) : array(); + $document_title = ! empty( $document_type ) && ( 'all' !== $document_type ) ? ' ' . ucwords( str_replace( '-', ' ', $document_type ) ) . ' ' : ' '; + $page_count = absint( $request['page_count'] ); + $document_count = absint( $request['document_count'] ); + $delete_or_renumber = esc_attr( $request['delete_or_renumber'] ); + $message = ( 'delete' === $delete_or_renumber ) ? $document_title . __( 'documents deleted.', 'woocommerce-pdf-invoices-packing-slips' ) : $document_title . __( 'documents renumbered.', 'woocommerce-pdf-invoices-packing-slips' ); + $finished = false; + + $args = array( + 'return' => 'ids', + 'type' => 'shop_order', + 'limit' => -1, + 'order' => 'ASC', + 'paginate' => true, + 'posts_per_page' => 50, + 'page' => $page_count, + 'date_created' => $from_date . '...' . $to_date, + ); + + $results = wc_get_orders( $args ); + $order_ids = $results->orders; + + if ( ! empty( $order_ids ) && ! empty( $document_type ) ) { + foreach ( $order_ids as $order_id ) { + $order = wc_get_order( $order_id ); + + if ( empty( $order ) ) { + continue; + } + + if ( 'all' === $document_type ) { + $documents = WPO_WCPDF()->documents->get_documents( 'all' ); + foreach ( $documents as $document ) { + $document_types[] = $document->get_type(); + } + } + + foreach ( $document_types as $type ) { + $document = wcpdf_get_document( $type, $order ); + $return = $this->renumber_or_delete_document( $document, $delete_or_renumber ); + if ( $return ) { + $document_count++; + } + } + } + $page_count++; + + // no more order IDs + } else { + $finished = true; + } + + $response = array( + 'finished' => $finished, + 'pageCount' => $page_count, + 'documentCount' => $document_count, + 'message' => $message, + ); + + wp_send_json_success( $response ); + } + + private function renumber_or_delete_document( $document, $delete_or_renumber ) { + $return = false; + + if ( $document && $document->exists() ) { + switch ( $delete_or_renumber ) { + case 'renumber': + if ( is_callable( array( $document, 'init_number' ) ) ) { + $document->init_number(); + $return = true; + } elseif ( 'packing-slip' === $document->get_type() && is_callable( array( WPO_WCPDF_Pro()->functions, 'init_packing_slip_number' ) ) ) { + WPO_WCPDF_Pro()->functions->init_packing_slip_number( $document ); + $return = true; + } + + if ( $return ) { + $document->save(); + } + break; + case 'delete': + if ( is_callable( array( $document, 'delete' ) ) ) { + $document->delete(); + $return = true; + } + break; + default: + break; + } + } + + return $return; + } + public function get_setting_types() { $setting_types = [ 'general' => __( 'General', 'woocommerce-pdf-invoices-packing-slips' ), @@ -482,12 +604,6 @@ public function get_setting_types() { return apply_filters( 'wpo_wcpdf_setting_types', $setting_types ); } - public function dompdf_status( $tab, $section ) { - if ( $tab === 'debug' ) { - include( WPO_WCPDF()->plugin_path() . '/includes/views/dompdf-status.php' ); - } - } - public function init_settings() { // Register settings. $page = $option_group = $option_name = 'wpo_wcpdf_settings_debug'; @@ -496,7 +612,7 @@ public function init_settings() { array( 'type' => 'section', 'id' => 'debug_settings', - 'title' => __( 'Debug settings', 'woocommerce-pdf-invoices-packing-slips' ), + 'title' => '', 'callback' => 'section', ), array( @@ -593,7 +709,7 @@ public function init_settings() { 'id' => 'enable_debug', 'description' => __( "Enable this option to output plugin errors if you're getting a blank page or other PDF generation issues", 'woocommerce-pdf-invoices-packing-slips' ) . '
' . __( 'Caution! This setting may reveal errors (from other plugins) in other places on your site too, therefor this is not recommended to leave it enabled on live sites.', 'woocommerce-pdf-invoices-packing-slips' ) . ' ' . - __( 'You can also add &debug=true to the URL to apply this on a per-order basis.', 'woocommerce-pdf-invoices-packing-slips' ), + __( 'You can also add &debug=true to the URL to apply this on a per-order basis.', 'woocommerce-pdf-invoices-packing-slips' ), ) ), array( @@ -623,7 +739,7 @@ public function init_settings() { 'option_name' => $option_name, 'id' => 'html_output', 'description' => __( 'Send the template output as HTML to the browser instead of creating a PDF.', 'woocommerce-pdf-invoices-packing-slips' ) . ' ' . - __( 'You can also add &output=html to the URL to apply this on a per-order basis.', 'woocommerce-pdf-invoices-packing-slips' ), + __( 'You can also add &output=html to the URL to apply this on a per-order basis.', 'woocommerce-pdf-invoices-packing-slips' ), ) ), array( @@ -650,6 +766,18 @@ public function init_settings() { 'description' => __( 'Disables the document preview on the plugin settings pages.', 'woocommerce-pdf-invoices-packing-slips' ), ) ), + array( + 'type' => 'setting', + 'id' => 'enable_danger_zone_tools', + 'title' => __( 'Enable danger zone tools', 'woocommerce-pdf-invoices-packing-slips' ), + 'callback' => 'checkbox', + 'section' => 'debug_settings', + 'args' => array( + 'option_name' => $option_name, + 'id' => 'enable_danger_zone_tools', + 'description' => __( 'Enables the danger zone tools. The actions performed by these tools are irreversible!', 'woocommerce-pdf-invoices-packing-slips' ), + ) + ), ); // allow plugins to alter settings fields diff --git a/includes/tables/class-wcpdf-number-store-list-table.php b/includes/tables/class-wcpdf-number-store-list-table.php new file mode 100644 index 000000000..39b4c32f3 --- /dev/null +++ b/includes/tables/class-wcpdf-number-store-list-table.php @@ -0,0 +1,300 @@ + 'number', + 'plural' => 'numbers', + 'ajax' => false + ) ); + + $this->process_bulk_action(); + } + + /** + * This function renders most of the columns in the list table. + * + * @since 2.0 + * + * @param object $item Contains all the data of the numbers + * @param string $column_name The name of the column + * + * @return string Column Name + */ + public function column_default( $item, $column_name ) { + switch ( $column_name ) { + case 'number' : + $value = $item->id; + break; + case 'type' : + $value = isset( $item->document_title ) ? esc_attr( $item->document_title ) : '-'; + break; + case 'calculated_number' : + $value = isset( $item->calculated_number ) ? $item->calculated_number : '-'; + break; + case 'date' : + $value = $item->date; + break; + case 'order' : + if ( ! empty( $item->order_id ) ) { + $order = $this->get_base_order( wc_get_order( $item->order_id ) ); + $order_number = is_callable( array( $order, 'get_order_number' ) ) ? $order->get_order_number() : $item->order_id; + $order_id = is_callable( array( $order, 'get_id' ) ) ? $order->get_id() : $item->order_id; + $url = sprintf( 'post.php?post=%s&action=edit', $order_id ); + $value = sprintf( '#%s', $url, $order_number ); + + if ( absint( $order_id ) !== absint( $item->order_id ) ) { + $value .= sprintf( ' (%s #%s)', __( 'Refund:', 'woocommerce-pdf-invoices-packing-slips' ), $item->order_id ); + } + } else { + $value = '-'; + } + break; + case 'order_status' : + $order = $this->get_base_order( wc_get_order( $item->order_id ) ); + + if ( ! empty( $order ) ) { + $value = sprintf( + '%s', + esc_attr( sanitize_html_class( 'status-' . $order->get_status() ) ), + esc_html( wc_get_order_status_name( $order->get_status() ) ) + ); + } else { + $value = '' . __( 'Unknown', 'woocommerce-pdf-invoices-packing-slips' ) . ''; + } + break; + default: + $value = isset( $item->$column_name ) ? $item->$column_name : null; + break; + } + + if ( empty( $value ) ) { + $value = '-'; + } + + return apply_filters( 'wpo_wcpdf_number_tools_column_content_' . $column_name, $value, $item ); + } + + /** + * Retrieve the table columns + * + * @since 2.0 + * @return array $columns Array of all the list table columns + */ + public function get_columns() { + $columns = array( + 'number' => __( 'Number', 'woocommerce-pdf-invoices-packing-slips' ), + 'type' => __( 'Type', 'woocommerce-pdf-invoices-packing-slips' ), + 'calculated_number' => __( 'Calculated', 'woocommerce-pdf-invoices-packing-slips' ), + 'date' => __( 'Date', 'woocommerce-pdf-invoices-packing-slips' ), + 'order' => __( 'Order', 'woocommerce-pdf-invoices-packing-slips' ), + 'order_status' => __( 'Order Status', 'woocommerce-pdf-invoices-packing-slips' ), + ); + + $table_name = isset( $_GET['table_name'] ) ? sanitize_text_field( $_GET['table_name'] ) : null; + $document_type = WPO_WCPDF()->settings->debug->get_document_type_from_store_table_name( $table_name ); + + if ( empty( $document_type ) || 'invoice' !== $document_type ) { + unset( $columns['type'] ); + } + + if ( ! isset( WPO_WCPDF()->settings->debug_settings['calculate_document_numbers'] ) ) { + unset( $columns['calculated_number'] ); + } + + return apply_filters( 'wpo_wcpdf_number_tools_columns', $columns ); + } + + /** + * Get the sortable columns + * + * @since 2.0 + * @return array Array of all the sortable columns + */ + public function get_sortable_columns() { + return array( + 'number' => array( 'id', true ), + ); + } + + /** + * Retrieve the bulk actions + * + * @access public + * @since 2.0 + * @return array Array of the bulk actions + */ + public function get_bulk_actions() { + return array(); + } + + /** + * Retrieve the current page number + * + * @since 2.0 + * @return int Current page number + */ + public function get_paged() { + return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; + } + + /** + * Retrieves the search query string + * + * @since 2.0 + * @return mixed string If search is present, false otherwise + */ + public function get_search() { + return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; + } + + /** + * Build all the number data + * + * @since 2.0 + * @global object $wpdb Used to query the database using the WordPress + * Database API + * @return array $numbers All the data for number list table + */ + public function get_numbers() { + global $wpdb; + + $results = array(); + $paged = $this->get_paged(); + $offset = $this->per_page * ( $paged - 1 ); + $search = $this->get_search(); + $table_name = isset( $_GET['table_name'] ) ? sanitize_text_field( $_GET['table_name'] ) : null; + $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; + $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; + $document_type = WPO_WCPDF()->settings->debug->get_document_type_from_store_table_name( $table_name ); + $invoice_number_store_doc_types = WPO_WCPDF()->settings->debug->get_additional_invoice_number_store_document_types(); + + if ( 'invoice' !== $document_type && in_array( $document_type, $invoice_number_store_doc_types ) ) { + return array(); // using `invoice_number` + } + + if ( ! empty( $table_name ) ) { + if ( $search ) { + $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table_name WHERE `id` LIKE '$search' OR `order_id` LIKE '$search' ORDER BY $orderby $order LIMIT %d OFFSET %d", $this->per_page, $offset ) ); + } else { + $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $table_name ORDER BY $orderby $order LIMIT %d OFFSET %d", $this->per_page, $offset ) ); + } + } else { + $results = array(); + } + + // add document title or 'Deleted' + if ( ! empty( $results ) && ! empty( $document_type ) ) { + foreach ( $results as $key => $result ) { + $result = (array) $result; + $document_types = array( $document_type ); + $order_id = isset( $result['order_id'] ) ? absint( $result['order_id'] ) : 0; + + if ( 0 === $order_id ) { + continue; + } + + if ( 'invoice' === $document_type && ! empty( $invoice_number_store_doc_types ) ) { + $document_types = array_merge( $document_types, $invoice_number_store_doc_types ); + } + + foreach ( $document_types as $doc_type ) { + $document = wcpdf_get_document( $doc_type, wc_get_order( $order_id ) ); + + if ( $document && is_callable( array( $document, 'get_number' ) ) ) { + $number_obj = $document->get_number(); + + if ( ! empty( $number_obj ) && ! empty( $number_obj->number ) ) { + if ( isset( $result['id'] ) && absint( $result['id'] ) === absint( $number_obj->number ) ) { + $results[ $key ]->document_title = $document->get_title(); + } + } + } + } + } + } + + return $results; + } + + /** + * Setup the final data for the table + * + * @since 2.0 + * @uses self::get_columns() + * @uses WP_List_Table::get_sortable_columns() + * @uses self::get_pagenum() + * @return void + */ + public function prepare_items() { + $this->_column_headers = array( + $this->get_columns(), + array(), + $this->get_sortable_columns() + ); + + $this->items = $this->get_numbers(); + $total_items = count( $this->items ); + $per_page = apply_filters( 'wpo_wcpdf_number_store_list_table_per_page', $this->per_page ); + + // Setup pagination + $this->set_pagination_args( array( + 'total_pages' => ceil( $total_items / $per_page ), + 'total_items' => $total_items, + 'per_page' => $per_page + ) ); + } + + /** + * Get the parent order for refunds + * + * @since 2.4 + * @param $order WC_Order + * @return $order WC_Order + */ + public function get_base_order( $order ) { + if ( is_callable( array( $order, 'get_type' ) ) && 'shop_order_refund' === $order->get_type() ) { + return wc_get_order( $order->get_parent_id() ); + } else { + return $order; + } + } + +} + +endif; // class_exists diff --git a/includes/views/advanced-numbers.php b/includes/views/advanced-numbers.php new file mode 100644 index 000000000..88a80ddac --- /dev/null +++ b/includes/views/advanced-numbers.php @@ -0,0 +1,47 @@ + + +
+ ' . esc_html( $choose_table_title ) . ''; + ?> + + +
+

+
+ +

+ next %s number value in the settings).', 'woocommerce-pdf-invoices-packing-slips' ), + $choose_table_title + ); + ?> +

+

+ + display(); ?> + +
+

+
+ +
\ No newline at end of file diff --git a/includes/views/advanced-status.php b/includes/views/advanced-status.php new file mode 100644 index 000000000..108cc5cc4 --- /dev/null +++ b/includes/views/advanced-status.php @@ -0,0 +1,344 @@ + array( + 'required' => __( '7.2+ (7.4 or higher recommended)', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => PHP_VERSION, + 'result' => version_compare( PHP_VERSION, '7.2', '>' ), + ), + 'DOMDocument extension' => array( + 'required' => true, + 'value' => phpversion( 'DOM' ), + 'result' => class_exists( 'DOMDocument' ), + ), + 'MBString extension' => array( + 'required' => true, + 'value' => phpversion( 'mbstring' ), + 'result' => function_exists( 'mb_send_mail' ), + 'fallback' => __( 'Recommended, will use fallback functions', 'woocommerce-pdf-invoices-packing-slips' ), + ), + 'GD' => array( + 'required' => true, + 'value' => phpversion( 'gd' ), + 'result' => function_exists( 'imagecreate' ), + 'fallback' => __( 'Required if you have images in your documents', 'woocommerce-pdf-invoices-packing-slips' ), + ), + 'WebP Support' => array( + 'required' => __( 'Required when using .webp images', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => null, + 'result' => function_exists( 'imagecreatefromwebp' ), + 'fallback' => __( 'Required if you have .webp images in your documents', 'woocommerce-pdf-invoices-packing-slips' ), + ), + // "PCRE" => array( + // "required" => true, + // "value" => phpversion("pcre"), + // "result" => function_exists("preg_match") && @preg_match("/./u", "a"), + // "failure" => "PCRE is required with Unicode support (the \"u\" modifier)", + // ), + 'Zlib' => array( + 'required' => __( 'To compress PDF documents', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => phpversion( 'zlib' ), + 'result' => function_exists( 'gzcompress' ), + 'fallback' => __( 'Recommended to compress PDF documents', 'woocommerce-pdf-invoices-packing-slips' ), + ), + 'opcache' => array( + 'required' => __( 'For better performances', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => null, + 'result' => false, + 'fallback' => __( 'Recommended for better performances', 'woocommerce-pdf-invoices-packing-slips' ), + ), + 'GMagick or IMagick' => array( + 'required' => __( 'Better with transparent PNG images', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => null, + 'result' => extension_loaded( 'gmagick' ) || extension_loaded( 'imagick' ), + 'fallback' => __( 'Recommended for better performances', 'woocommerce-pdf-invoices-packing-slips' ), + ), + 'glob()' => array( + 'required' => __( 'Required to detect custom templates and to clear the temp folder periodically', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => null, + 'result' => function_exists( 'glob' ), + 'fallback' => __( 'Check PHP disable_functions', 'woocommerce-pdf-invoices-packing-slips' ), + ), + 'WP Memory Limit' => array( + /* translators: tags */ + 'required' => sprintf( __( 'Recommended: 128MB (more for plugin-heavy setups
See: %1$sIncreasing the WordPress Memory Limit%2$s', 'woocommerce-pdf-invoices-packing-slips' ), '
', '' ), + 'value' => sprintf( 'WordPress: %s, PHP: %s', WP_MEMORY_LIMIT, $php_mem_limit ), + 'result' => $memory_limit > 67108864, + ), + 'allow_url_fopen' => array ( + 'required' => __( 'Allow remote stylesheets and images', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => null, + 'result' => ini_get( 'allow_url_fopen' ), + 'fallback' => __( 'allow_url_fopen disabled', 'woocommerce-pdf-invoices-packing-slips' ), + ), + 'base64_decode' => array ( + 'required' => __( 'To compress and decompress font data', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => null, + 'result' => function_exists( 'base64_decode' ), + 'fallback' => __( 'base64_decode disabled', 'woocommerce-pdf-invoices-packing-slips' ), + ), +) ); + +if ( ( $xc = extension_loaded( 'xcache' ) ) || ( $apc = extension_loaded( 'apc' ) ) || ( $zop = extension_loaded( 'Zend OPcache' ) ) || ( $op = extension_loaded( 'opcache' ) ) ) { + $server_configs['opcache']['result'] = true; + $server_configs['opcache']['value'] = ( + $xc ? 'XCache '.phpversion( 'xcache' ) : ( + $apc ? 'APC '.phpversion( 'apc' ) : ( + $zop ? 'Zend OPCache '.phpversion( 'Zend OPcache' ) : 'PHP OPCache '.phpversion( 'opcache' ) + ) + ) + ); +} +if ( ( $gm = extension_loaded( 'gmagick' ) ) || ( $im = extension_loaded( 'imagick' ) ) ) { + $server_configs['GMagick or IMagick']['value'] = ( $im ? 'IMagick '.phpversion( 'imagick' ) : 'GMagick '.phpversion( 'gmagick' ) ); +} + +if ( ! $server_configs['PHP version']['result'] ) { + /* translators: tags */ + $server_configs['PHP version']['required'] .= '
' . sprintf( __( 'Download %1$sthis addon%2$s to enable backwards compatibility.', 'woocommerce-pdf-invoices-packing-slips' ), '
', '' ); +} + +?> + + + + + + + + + + + + + + + $server_config ) : + if ( $server_config['result'] ) { + $background = '#68de7c'; // green + $color = 'black'; + } elseif ( isset( $server_config['fallback'] ) ) { + $background = '#f2d675'; // yellow + $color = 'black'; + } else { + $background = '#ffabaf'; // red + $color = 'black'; + } + ?> + + + + + + + +
 
+ %s. %s', esc_html__( 'No', 'woocommerce-pdf-invoices-packing-slips' ), esc_html( $server_config['fallback'] ) ); + } + if ( isset( $server_config['failure'] ) ) { + printf( '
%s
', wp_kses_post( $server_config['failure'] ) ); + } + } + ?> +
+ + + + + + + + + + + + + + documents->get_documents( 'all' ) as $document ) : + $is_reset_enabled = isset( $document->settings['reset_number_yearly'] ) ? true : false; + $is_enabled = $document->is_enabled() ? true : false; + ?> + + + + + + + + settings->maybe_schedule_yearly_reset_numbers() ) : + if ( function_exists( 'as_get_scheduled_actions' ) ) { + $scheduled_actions = as_get_scheduled_actions( array( + 'hook' => 'wpo_wcpdf_schedule_yearly_reset_numbers', + 'status' => \ActionScheduler_Store::STATUS_PENDING, + ) ); + + $yearly_reset = array( + 'required' => __( 'Required to reset documents numeration', 'woocommerce-pdf-invoices-packing-slips' ), + 'fallback' => __( 'Yearly reset action not found', 'woocommerce-pdf-invoices-packing-slips' ), + ); + + if ( ! empty( $scheduled_actions ) ) { + $total_actions = count( $scheduled_actions ); + if ( $total_actions === 1 ) { + $action = reset( $scheduled_actions ); + $action_date = is_callable( array( $action->get_schedule(), 'get_date' ) ) ? $action->get_schedule()->get_date() : $action->get_schedule()->get_next( as_get_datetime_object() ); + /* translators: action date */ + $yearly_reset['value'] = sprintf( + __( 'Scheduled to: %s' ), date( wcpdf_date_format( null, 'yearly_reset_schedule' ), + $action_date->getTimeStamp() ) + ); + $yearly_reset['result'] = true; + } else { + /* translators: total actions */ + $yearly_reset['value'] = sprintf( + /* translators: total scheduled actions */ + __( 'Only 1 scheduled action should exist, but %s were found', 'woocommerce-pdf-invoices-packing-slips' ), + $total_actions + ); + $yearly_reset['result'] = false; + } + } else { + $yearly_reset['value'] = sprintf( + /* translators: tags */ + __( 'Scheduled action not found. Please reschedule it %shere%s.', 'woocommerce-pdf-invoices-packing-slips' ), + '', + '' + ); + $yearly_reset['result'] = false; + } + } + + $label = __( 'Yearly reset', 'woocommerce-pdf-invoices-packing-slips' ); + + if ( $yearly_reset['result'] ) { + $background = '#68de7c'; // green + $color = 'black'; + } else { + $background = '#ffabaf'; // red + $color = 'black'; + } + ?> + + + + + + + +
 
get_title() ); ?>
+ +
+ + __( 'Writable', 'woocommerce-pdf-invoices-packing-slips' ), + 'failed' => __( 'Not writable', 'woocommerce-pdf-invoices-packing-slips' ), + ); + + $permissions = array( + 'WCPDF_TEMP_DIR' => array ( + 'description' => __( 'Central temporary plugin folder', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => WPO_WCPDF()->main->get_tmp_path(), + 'status' => is_writable( WPO_WCPDF()->main->get_tmp_path() ) ? 'ok' : 'failed', + 'status_message' => is_writable( WPO_WCPDF()->main->get_tmp_path() ) ? $status['ok'] : $status['failed'], + ), + 'WCPDF_ATTACHMENT_DIR' => array ( + 'description' => __( 'Temporary attachments folder', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => trailingslashit( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ), + 'status' => is_writable( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ) ? 'ok' : 'failed', + 'status_message' => is_writable( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ) ? $status['ok'] : $status['failed'], + ), + 'DOMPDF_TEMP_DIR' => array ( + 'description' => __( 'Temporary DOMPDF folder', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => trailingslashit(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )), + 'status' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )) ? 'ok' : 'failed', + 'status_message' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )) ? $status['ok'] : $status['failed'], + ), + 'DOMPDF_FONT_DIR' => array ( + 'description' => __( 'DOMPDF fonts folder (needs to be writable for custom/remote fonts)', 'woocommerce-pdf-invoices-packing-slips' ), + 'value' => trailingslashit(WPO_WCPDF()->main->get_tmp_path( 'fonts' )), + 'status' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'fonts' )) ? 'ok' : 'failed', + 'status_message' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'fonts' )) ? $status['ok'] : $status['failed'], + ), + ); + + $upload_dir = wp_upload_dir(); + $upload_base = trailingslashit( $upload_dir['basedir'] ); +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
','\\' ), wp_kses_post( $permission['value'] ) ) : ''; ?>
+ '.WPO_WCPDF()->main->get_tmp_path().'', + ''.$upload_base.'', + 'UPLOADS', + 'wpo_wcpdf_tmp_path', + 'attachments', + 'dompdf', + 'fonts' + ); + ?> +
+ '.WPO_WCPDF()->plugin_path() . "/vendor/dompdf/dompdf/lib/fonts/".'' + ); + ?> +
diff --git a/includes/views/advanced-tools.php b/includes/views/advanced-tools.php new file mode 100644 index 000000000..881e4eeff --- /dev/null +++ b/includes/views/advanced-tools.php @@ -0,0 +1,215 @@ + + +
+
+ + +
+

+

+
+ + + +
+
+ + +
+

+

+
+ + + +
+
+ + + settings->yearly_reset_action_is_scheduled() ) : ?> +
+

+

+
+ + + +
+
+ + + +
+

+

+
+ + + +
+
+ + +
+

+

+ +
+ + +
+

+

+
+ +
+ + +
+
+ +
+
+
+ + +
+

+

+
+ +
+ + +
+
+ +
+
+
+ + +
+

+

+
+ +
+ + +
+
+ +
+
+
+ + +
+ + settings->debug_settings['enable_danger_zone_tools'] ) ) : ?> + documents->get_documents( 'all' ); ?> +
+
+
+

DANGER ZONE: Create a backup before using these tools, the actions they perform are irreversible!', 'woocommerce-pdf-invoices-packing-slips' ); ?>

+
+
+ +
+

+

+

+ next document number setting %s to the number you want to use for the first document. ', 'woocommerce-pdf-invoices-packing-slips' ), + 'WooCommerce > PDF Invoices > Documents > Select document' + ); + ?> +

+ + + + + + + + + + + + + + + + + +
+ +
  + +
+
+
+ + +
+

+

+ + + + + + + + + + + + + + + + + +
+ +
  + +
+
+
+ +
+ + +
\ No newline at end of file diff --git a/includes/views/dompdf-status.php b/includes/views/dompdf-status.php deleted file mode 100644 index 181405d4f..000000000 --- a/includes/views/dompdf-status.php +++ /dev/null @@ -1,317 +0,0 @@ - array( - 'required' => __( '7.2+ (7.4 or higher recommended)', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => PHP_VERSION, - 'result' => version_compare( PHP_VERSION, '7.2', '>' ), - ), - 'DOMDocument extension' => array( - 'required' => true, - 'value' => phpversion('DOM'), - 'result' => class_exists('DOMDocument'), - ), - 'MBString extension' => array( - 'required' => true, - 'value' => phpversion('mbstring'), - 'result' => function_exists('mb_send_mail'), - 'fallback' => __( 'Recommended, will use fallback functions', 'woocommerce-pdf-invoices-packing-slips' ), - ), - 'GD' => array( - 'required' => true, - 'value' => phpversion('gd'), - 'result' => function_exists('imagecreate'), - 'fallback' => __( 'Required if you have images in your documents', 'woocommerce-pdf-invoices-packing-slips' ), - ), - 'WebP Support' => array( - 'required' => __( 'Required when using .webp images', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => null, - 'result' => function_exists('imagecreatefromwebp'), - 'fallback' => __( 'Required if you have .webp images in your documents', 'woocommerce-pdf-invoices-packing-slips' ), - ), - // "PCRE" => array( - // "required" => true, - // "value" => phpversion("pcre"), - // "result" => function_exists("preg_match") && @preg_match("/./u", "a"), - // "failure" => "PCRE is required with Unicode support (the \"u\" modifier)", - // ), - 'Zlib' => array( - 'required' => __( 'To compress PDF documents', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => phpversion('zlib'), - 'result' => function_exists('gzcompress'), - 'fallback' => __( 'Recommended to compress PDF documents', 'woocommerce-pdf-invoices-packing-slips' ), - ), - 'opcache' => array( - 'required' => __( 'For better performances', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => null, - 'result' => false, - 'fallback' => __( 'Recommended for better performances', 'woocommerce-pdf-invoices-packing-slips' ), - ), - 'GMagick or IMagick' => array( - 'required' => __( 'Better with transparent PNG images', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => null, - 'result' => extension_loaded('gmagick') || extension_loaded('imagick'), - 'fallback' => __( 'Recommended for better performances', 'woocommerce-pdf-invoices-packing-slips' ), - ), - 'glob()' => array( - 'required' => __( 'Required to detect custom templates and to clear the temp folder periodically', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => null, - 'result' => function_exists('glob'), - 'fallback' => __( 'Check PHP disable_functions', 'woocommerce-pdf-invoices-packing-slips' ), - ), - 'WP Memory Limit' => array( - /* translators: tags */ - 'required' => sprintf( __( 'Recommended: 128MB (more for plugin-heavy setups
See: %1$sIncreasing the WordPress Memory Limit%2$s', 'woocommerce-pdf-invoices-packing-slips' ), '
', '' ), - 'value' => sprintf('WordPress: %s, PHP: %s', WP_MEMORY_LIMIT, $php_mem_limit ), - 'result' => $memory_limit > 67108864, - ), - 'allow_url_fopen' => array ( - 'required' => __( 'Allow remote stylesheets and images', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => null, - 'result' => ini_get('allow_url_fopen'), - 'fallback' => __( 'allow_url_fopen disabled', 'woocommerce-pdf-invoices-packing-slips' ), - ), - 'base64_decode' => array ( - 'required' => __( 'To compress and decompress font data', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => null, - 'result' => function_exists('base64_decode'), - 'fallback' => __( 'base64_decode disabled', 'woocommerce-pdf-invoices-packing-slips' ), - ), -) ); - -if ( ( $xc = extension_loaded('xcache') ) || ( $apc = extension_loaded('apc') ) || ( $zop = extension_loaded('Zend OPcache') ) || ( $op = extension_loaded('opcache') ) ) { - $server_configs['opcache']['result'] = true; - $server_configs['opcache']['value'] = ( - $xc ? 'XCache '.phpversion('xcache') : ( - $apc ? 'APC '.phpversion('apc') : ( - $zop ? 'Zend OPCache '.phpversion('Zend OPcache') : 'PHP OPCache '.phpversion('opcache') - ) - ) - ); -} -if ( ( $gm = extension_loaded('gmagick') ) || ( $im = extension_loaded('imagick') ) ) { - $server_configs['GMagick or IMagick']['value'] = ($im ? 'IMagick '.phpversion('imagick') : 'GMagick '.phpversion('gmagick')); -} - -if( ! $server_configs['PHP version']['result'] ) { - /* translators: tags */ - $server_configs['PHP version']['required'] .= '
' . sprintf( __( 'Download %1$sthis addon%2$s to enable backwards compatibility.', 'woocommerce-pdf-invoices-packing-slips' ), '
', '' ); -} - -?> - -

- - - - - - - - $server_config ) { - if ( $server_config['result'] ) { - $background = '#9e4'; - $color = 'black'; - } elseif ( isset( $server_config['fallback'] ) ) { - $background = '#FCC612'; - $color = 'black'; - } else { - $background = '#f43'; - $color = 'white'; - } - ?> - - - - - - - -
 
- %s. %s', esc_html__( 'No', 'woocommerce-pdf-invoices-packing-slips' ), esc_html( $server_config['fallback'] ) ); - } - if ( isset( $server_config['failure'] ) ) { - printf( '
%s
', wp_kses_post( $server_config['failure'] ) ); - } - } - ?> -
- -
-

- - - - - - - documents->get_documents( 'all' ) as $document ) : - $is_reset_enabled = isset( $document->settings['reset_number_yearly'] ) ? true : false; - $is_enabled = $document->is_enabled() ? true : false; - ?> - - - - - - - settings->maybe_schedule_yearly_reset_numbers() ) : - if ( function_exists( 'as_get_scheduled_actions' ) ) { - $scheduled_actions = as_get_scheduled_actions( array( - 'hook' => 'wpo_wcpdf_schedule_yearly_reset_numbers', - 'status' => \ActionScheduler_Store::STATUS_PENDING, - ) ); - - $yearly_reset = array( - 'required' => __( 'Required to reset documents numeration', 'woocommerce-pdf-invoices-packing-slips' ), - 'fallback' => __( 'Yearly reset action not found', 'woocommerce-pdf-invoices-packing-slips' ), - ); - - if ( ! empty( $scheduled_actions ) ) { - $total_actions = count( $scheduled_actions ); - if ( $total_actions === 1 ) { - $action = reset( $scheduled_actions ); - $action_date = is_callable( array( $action->get_schedule(), 'get_date' ) ) ? $action->get_schedule()->get_date() : $action->get_schedule()->get_next( as_get_datetime_object() ); - /* translators: action date */ - $yearly_reset['value'] = sprintf( - __( 'Scheduled to: %s' ), date( wcpdf_date_format( null, 'yearly_reset_schedule' ), - $action_date->getTimeStamp() ) - ); - $yearly_reset['result'] = true; - } else { - /* translators: total actions */ - $yearly_reset['value'] = sprintf( - /* translators: total scheduled actions */ - __( 'Only 1 scheduled action should exist, but %s were found', 'woocommerce-pdf-invoices-packing-slips' ), - $total_actions - ); - $yearly_reset['result'] = false; - } - } else { - $yearly_reset['value'] = __( 'Scheduled action not found', 'woocommerce-pdf-invoices-packing-slips' ); - $yearly_reset['result'] = false; - } - } - - $label = __( 'Yearly reset', 'woocommerce-pdf-invoices-packing-slips' ); - - if ( $yearly_reset['result'] ) { - $background = '#9e4'; - $color = 'black'; - } else { - $background = '#f43'; - $color = 'white'; - } - ?> - - - - - - - -
 
get_title() ); ?>
- -
- - __( 'Writable', 'woocommerce-pdf-invoices-packing-slips' ), - 'failed' => __( 'Not writable', 'woocommerce-pdf-invoices-packing-slips' ), - ); - - $permissions = array( - 'WCPDF_TEMP_DIR' => array ( - 'description' => __( 'Central temporary plugin folder', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => WPO_WCPDF()->main->get_tmp_path(), - 'status' => is_writable( WPO_WCPDF()->main->get_tmp_path() ) ? 'ok' : 'failed', - 'status_message' => is_writable( WPO_WCPDF()->main->get_tmp_path() ) ? $status['ok'] : $status['failed'], - ), - 'WCPDF_ATTACHMENT_DIR' => array ( - 'description' => __( 'Temporary attachments folder', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => trailingslashit( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ), - 'status' => is_writable( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ) ? 'ok' : 'failed', - 'status_message' => is_writable( WPO_WCPDF()->main->get_tmp_path( 'attachments' ) ) ? $status['ok'] : $status['failed'], - ), - 'DOMPDF_TEMP_DIR' => array ( - 'description' => __( 'Temporary DOMPDF folder', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => trailingslashit(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )), - 'status' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )) ? 'ok' : 'failed', - 'status_message' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'dompdf' )) ? $status['ok'] : $status['failed'], - ), - 'DOMPDF_FONT_DIR' => array ( - 'description' => __( 'DOMPDF fonts folder (needs to be writable for custom/remote fonts)', 'woocommerce-pdf-invoices-packing-slips' ), - 'value' => trailingslashit(WPO_WCPDF()->main->get_tmp_path( 'fonts' )), - 'status' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'fonts' )) ? 'ok' : 'failed', - 'status_message' => is_writable(WPO_WCPDF()->main->get_tmp_path( 'fonts' )) ? $status['ok'] : $status['failed'], - ), - ); - - $upload_dir = wp_upload_dir(); - $upload_base = trailingslashit( $upload_dir['basedir'] ); -?> -
-

- - - - - - - - - - - - - - - -
','\\' ), wp_kses_post( $permission['value'] ) ) : ''; ?>
- -

- '.WPO_WCPDF()->main->get_tmp_path().'', - ''.$upload_base.'', - 'UPLOADS', - 'wpo_wcpdf_tmp_path', - 'attachments', - 'dompdf', - 'fonts' - ); - ?> -

- '.WPO_WCPDF()->plugin_path() . "/vendor/dompdf/dompdf/lib/fonts/".'' - ); - ?> -

diff --git a/includes/views/wcpdf-extensions.php b/includes/views/extensions.php similarity index 100% rename from includes/views/wcpdf-extensions.php rename to includes/views/extensions.php diff --git a/includes/views/wcpdf-settings-page.php b/includes/views/settings-page.php similarity index 99% rename from includes/views/wcpdf-settings-page.php rename to includes/views/settings-page.php index 76d5d1182..2366f04c5 100644 --- a/includes/views/wcpdf-settings-page.php +++ b/includes/views/settings-page.php @@ -48,7 +48,7 @@ } if ( ! $hide_ad && ! ( class_exists( 'WooCommerce_PDF_IPS_Pro' ) && class_exists( 'WooCommerce_PDF_IPS_Templates' ) && class_exists( 'WooCommerce_Ext_PrintOrders' ) ) ) { - include('wcpdf-extensions.php'); + include( 'extensions.php' ); } $preview_states = isset( $settings_tabs[$active_tab]['preview_states'] ) ? $settings_tabs[$active_tab]['preview_states'] : 1; diff --git a/readme.txt b/readme.txt index bdd8e87e4..6be157a20 100644 --- a/readme.txt +++ b/readme.txt @@ -88,7 +88,7 @@ You're more than welcome! This plugin is hosted on github, where you can post is https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips = How can I display the HTML/CSS source for debugging/developing templates? = -There's a setting on the Status tab of the settings page that allows you to toggle HTML output. Don't forget to turn if off after you're done testing! +There's a setting on the Advanced tab of the settings page that allows you to toggle HTML output. Don't forget to turn if off after you're done testing! == Screenshots == @@ -291,7 +291,7 @@ There's a setting on the Status tab of the settings page that allows you to togg * Fix: fatal error caused by list_files() function missing = 3.1.0 (2022-09-06) = -* New: custom document links feature available from the Status settings page. Changes the document links to a prettier URL scheme +* New: custom document links feature available from the Status tab debug settings page. Changes the document links to a prettier URL scheme * New: action hooks before and after the shop logo: `wpo_wcpdf_before_shop_logo` and `wpo_wcpdf_after_shop_logo` * Fix: replaces WP_Filesystem with PHP functions to delete temporary files * Marked tested up to WooCommerce 6.8 diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 3a480cbdb..e49390484 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -246,6 +246,7 @@ 'WPO\\WC\\PDF_Invoices\\Settings\\Settings_UBL' => $baseDir . '/includes/settings/class-wcpdf-settings-ubl.php', 'WPO\\WC\\PDF_Invoices\\Settings\\Settings_Upgrade' => $baseDir . '/includes/settings/class-wcpdf-settings-upgrade.php', 'WPO\\WC\\PDF_Invoices\\Setup_Wizard' => $baseDir . '/includes/class-wcpdf-setup-wizard.php', + 'WPO\\WC\\PDF_Invoices\\Tables\\Number_Store_List_Table' => $baseDir . '/includes/tables/class-wcpdf-number-store-list-table.php', 'WPO\\WC\\PDF_Invoices\\Updraft_Semaphore_3_0' => $baseDir . '/includes/class-wcpdf-updraft-semaphore.php', 'WPO\\WC\\UBL\\Builders\\Builder' => $baseDir . '/ubl/Builders/Builder.php', 'WPO\\WC\\UBL\\Builders\\SabreBuilder' => $baseDir . '/ubl/Builders/SabreBuilder.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 29ee36da2..84f4bbdbe 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -331,6 +331,7 @@ class ComposerStaticInit1066d81cd8f355258ef5165247019e8a 'WPO\\WC\\PDF_Invoices\\Settings\\Settings_UBL' => __DIR__ . '/../..' . '/includes/settings/class-wcpdf-settings-ubl.php', 'WPO\\WC\\PDF_Invoices\\Settings\\Settings_Upgrade' => __DIR__ . '/../..' . '/includes/settings/class-wcpdf-settings-upgrade.php', 'WPO\\WC\\PDF_Invoices\\Setup_Wizard' => __DIR__ . '/../..' . '/includes/class-wcpdf-setup-wizard.php', + 'WPO\\WC\\PDF_Invoices\\Tables\\Number_Store_List_Table' => __DIR__ . '/../..' . '/includes/tables/class-wcpdf-number-store-list-table.php', 'WPO\\WC\\PDF_Invoices\\Updraft_Semaphore_3_0' => __DIR__ . '/../..' . '/includes/class-wcpdf-updraft-semaphore.php', 'WPO\\WC\\UBL\\Builders\\Builder' => __DIR__ . '/../..' . '/ubl/Builders/Builder.php', 'WPO\\WC\\UBL\\Builders\\SabreBuilder' => __DIR__ . '/../..' . '/ubl/Builders/SabreBuilder.php', diff --git a/woocommerce-pdf-invoices-packingslips.php b/woocommerce-pdf-invoices-packingslips.php index cccb9d6e9..6b08bf878 100644 --- a/woocommerce-pdf-invoices-packingslips.php +++ b/woocommerce-pdf-invoices-packingslips.php @@ -23,6 +23,7 @@ class WPO_WCPDF { public $version = '3.7.1'; public $plugin_basename; + public $legacy_addons; public $third_party_plugins; public $order_util; public $settings; @@ -55,6 +56,10 @@ public static function instance() { */ public function __construct() { $this->plugin_basename = plugin_basename(__FILE__); + $this->legacy_addons = apply_filters( 'wpo_wcpdf_legacy_addons', array( + 'ubl-woocommerce-pdf-invoices.php' => 'UBL Invoices for WooCommerce', + 'woocommerce-pdf-ips-number-tools.php' => 'PDF Invoices & Packing Slips for WooCommerce - Number Tools', + ) ); $this->define( 'WPO_WCPDF_VERSION', $this->version ); @@ -68,10 +73,10 @@ public function __construct() { add_action( 'admin_notices', array( $this, 'nginx_detected' ) ); add_action( 'admin_notices', array( $this, 'mailpoet_mta_detected' ) ); add_action( 'admin_notices', array( $this, 'rtl_detected' ) ); - add_action( 'admin_notices', array( $this, 'ubl_addon_active' ) ); + add_action( 'admin_notices', array( $this, 'legacy_addon_notices' ) ); - // deactivate ubl extension if activated - register_activation_hook( __FILE__, array( $this, 'deactivate_ubl_addon' ) ); + // deactivate legacy extensions if activated + register_activation_hook( __FILE__, array( $this, 'deactivate_legacy_addons' ) ); } private function autoloaders() { @@ -169,7 +174,7 @@ public function load_classes() { add_action( 'admin_notices', array ( $this, 'required_php_version' ) ); } - add_action( 'admin_init', array( $this, 'deactivate_ubl_addon') ); + add_action( 'admin_init', array( $this, 'deactivate_legacy_addons') ); // all systems ready - GO! $this->includes(); @@ -495,49 +500,71 @@ public function get_active_plugins() { return $active_plugins; } - public function deactivate_ubl_addon() { - $legacy_addon = $this->ubl_addon_detected(); - if ( ! empty( $legacy_addon ) ) { - deactivate_plugins( $legacy_addon ); - set_transient( 'wpo_wcpdf_ubl_addon_detected', 'yes', DAY_IN_SECONDS ); + public function deactivate_legacy_addons() { + foreach ( $this->legacy_addons as $filename => $name ) { + $legacy_addon = $this->legacy_addon_detected( $filename ); + + if ( ! empty( $legacy_addon ) ) { + deactivate_plugins( $legacy_addon ); + $transient_name = $this->get_legacy_addon_transient_name( $filename ); + set_transient( $transient_name, 'yes', DAY_IN_SECONDS ); + } } } - public function ubl_addon_detected() { + public function legacy_addon_detected( $filename ) { $active_plugins = $this->get_active_plugins(); - $ubl_addon = ''; + $legacy_addon = ''; foreach ( $active_plugins as $plugin ) { - if ( strpos( $plugin, 'ubl-woocommerce-pdf-invoices.php' ) !== false ) { - $ubl_addon = $plugin; + if ( false !== strpos( $plugin, $filename ) ) { + $legacy_addon = $plugin; break; } } - return $ubl_addon; + return $legacy_addon; } - public function ubl_addon_active() { - if ( get_transient( 'wpo_wcpdf_ubl_addon_detected' ) ) { - ob_start(); - ?> -
-

-

-
- legacy_addons as $filename => $name ) { + $transient_name = $this->get_legacy_addon_transient_name( $filename ); + $query_arg = "{$transient_name}_notice"; + + if ( get_transient( $transient_name ) ) { + ob_start(); + ?> +
+

+ ' . esc_attr( $name ) . '' + ); + ?> +

+

+
+