diff --git a/core/asset/js/backend.min.js b/core/asset/js/backend.min.js index e888f9b..b4bf2d8 100644 --- a/core/asset/js/backend.min.js +++ b/core/asset/js/backend.min.js @@ -1 +1 @@ -window.eoxiaJS.wpshop={},window.eoxiaJS.wpshopFrontend={},window.eoxiaJS.wpshop.init=function(){jQuery(".wps-sync").length&&jQuery(".wps-sync").each(function(){var e={action:"check_sync_status",wp_id:jQuery(this).find(".button-synchro").data("wp-id"),type:jQuery(this).find(".button-synchro").data("type")};window.eoxiaJS.loader.display(jQuery(this));var o=jQuery(this);jQuery.post(ajaxurl,e,function(e){window.eoxiaJS.loader.remove(o),o.replaceWith(e.data.view),e.data.status&&"0x1"==e.data.status.status_code&&jQuery('.table-row[data-id="'+e.data.id+'"] .reference-id li:last').remove()}).fail(function(){window.eoxiaJS.loader.remove(o),o.find(".statut").attr("aria-label","500 (Internal Server Error)"),o.find(".statut").addClass("statut-red")})});var e={action:"check_erp_statut",_wpnonce:scriptParams.check_erp_statut_nonce};jQuery.post(ajaxurl,e,function(e){!e.data.statut&&e.data.view&&jQuery("body").append(e.data.view)})},window.eoxiaJS.wpshop.API={},window.eoxiaJS.wpshop.API.init=function(){},window.eoxiaJS.wpshop.API.generatedAPIKey=function(e,o){e.closest(".wpshop-fields").replaceWith(o.data.view)},window.eoxiaJS.wpshop.thirdParties={},window.eoxiaJS.wpshop.thirdParties.init=function(){window.eoxiaJS.wpshop.thirdParties.event()},window.eoxiaJS.wpshop.thirdParties.event=function(){jQuery(document).on("click","#wps-third-party-contact .add-contact",window.eoxiaJS.wpshop.thirdParties.toggleContactFormNew),jQuery(document).on("click",".wpeo-autocomplete.search-contact .autocomplete-search-list .autocomplete-result",window.eoxiaJS.wpshop.thirdParties.putContactID)},window.eoxiaJS.wpshop.thirdParties.toggleContactFormNew=function(){jQuery("#wps-third-party-contact .row.new").toggle()},window.eoxiaJS.wpshop.thirdParties.putContactID=function(){jQuery(this).closest(".wpeo-autocomplete").find(".button-associate-contact").attr("data-contact-id",jQuery(this).data("id")),jQuery(this).closest(".wpeo-autocomplete").find("input#search-contact").val(jQuery(this).data("result"))},window.eoxiaJS.wpshop.thirdParties.loaddedTitleEdit=function(e,o){e.closest("h2").html(o.data.view)},window.eoxiaJS.wpshop.thirdParties.savedThird=function(e,o){e.closest("h2").html(o.data.view)},window.eoxiaJS.wpshop.thirdParties.loaddedBillingAddressSuccess=function(e,o){e.closest(".inside").html(o.data.view)},window.eoxiaJS.wpshop.thirdParties.savedBillingAddressSuccess=function(e,o){e.closest(".inside").html(o.data.view)},window.eoxiaJS.wpshop.thirdParties.loaddedContactSuccess=function(e,o){e.closest("tr").replaceWith(o.data.view)},window.eoxiaJS.wpshop.thirdParties.savedContact=function(e,o){e.closest(".inside").html(o.data.view)},window.eoxiaJS.wpshop.thirdParties.associatedContactSuccess=function(e,o){e.closest(".inside").html(o.data.view)},window.eoxiaJS.wpshop.tools={},window.eoxiaJS.wpshop.tools.init=function(){jQuery(document).on("click",".import-third-party .wpeo-button.button-primary",window.eoxiaJS.wpshop.tools.importThirdParty),jQuery(document).on("click",".import-product .wpeo-button.button-primary",window.eoxiaJS.wpshop.tools.importProduct)},window.eoxiaJS.wpshop.tools.importThirdParty=function(e){var o=new FormData;e.preventDefault(),o.append("file",jQuery(".import-third-party input[type=file]")[0].files[0]),o.append("action","import_third_party"),o.append("_wpnonce",jQuery(this).closest("form").find('input[name="_wpnonce"]').val()),o.append("index_element",0),window.eoxiaJS.wpshop.tools.requestImportThirdParty(o)},window.eoxiaJS.wpshop.tools.importProduct=function(e){var o=new FormData;e.preventDefault(),o.append("file",jQuery(".import-product input[type=file]")[0].files[0]),o.append("action","import_third_party"),o.append("_wpnonce",jQuery(this).closest("form").find('input[name="_wpnonce"]').val()),o.append("index_element",0),window.eoxiaJS.wpshop.tools.requestImportProduct(o)},window.eoxiaJS.wpshop.tools.requestImportThirdParty=function(e){jQuery.ajax({url:ajaxurl,data:e,processData:!1,contentType:!1,type:"POST",beforeSend:function(){window.eoxiaJS.loader.display(jQuery(".import-third-party .wpeo-button")),jQuery(".import-details").html("In progress")},success:function(e){var o=new FormData;e.success&&(jQuery(".import-third-party progress").attr("max",e.data.count_element),jQuery(".import-third-party progress").val(e.data.index_element/e.data.count_element*e.data.count_element),e.data.end?(jQuery(".import-detail").html("Importation terminé"),window.eoxiaJS.loader.remove(jQuery(".import-third-party .wpeo-button"))):(o.append("action","import_third_party"),o.append("_wpnonce",jQuery(".import-third-party").find('input[name="_wpnonce"]').val()),o.append("path_to_json",e.data.path_to_json),o.append("index_element",e.data.index_element),o.append("count_element",e.data.count_element),jQuery(".import-detail").html("Progress"),window.eoxiaJS.wpshop.tools.requestImport(o)))}})},window.eoxiaJS.wpshop.tools.requestImportProduct=function(e){jQuery.ajax({url:ajaxurl,data:e,processData:!1,contentType:!1,type:"POST",beforeSend:function(){window.eoxiaJS.loader.display(jQuery(".import-product .wpeo-button")),jQuery(".import-details").html("In progress")},success:function(e){var o=new FormData;e.success&&(jQuery(".import-product progress").attr("max",e.data.count_element),jQuery(".import-product progress").val(e.data.index_element/e.data.count_element*e.data.count_element),e.data.end?(jQuery(".import-detail").html("Importation terminé"),window.eoxiaJS.loader.remove(jQuery(".import-product .wpeo-button"))):(o.append("action","import_product"),o.append("_wpnonce",jQuery(".import-product").find('input[name="_wpnonce"]').val()),o.append("path_to_json",e.data.path_to_json),o.append("index_element",e.data.index_element),o.append("count_element",e.data.count_element),jQuery(".import-detail").html("Progress"),window.eoxiaJS.wpshop.tools.requestImportProduct(o)))}})},window.eoxiaJS.wpshop.product={},window.eoxiaJS.wpshop.product.init=function(){window.eoxiaJS.wpshop.product.event()},window.eoxiaJS.wpshop.product.event=function(){jQuery(document).on("wps-change-toggle",".stock-field .toggle",window.eoxiaJS.wpshop.product.displayBlockStock),jQuery(document).on("click",'.wps-list-product .table-header input[type="checkbox"]',window.eoxiaJS.wpshop.product.checkAll),jQuery(document).on("click",".button-apply",window.eoxiaJS.wpshop.product.apply),jQuery(document).ready(window.eoxiaJS.wpshop.product.autoSynchro),jQuery(".similar-product").select2({ajax:{url:scriptParams.url+"/wp-json/wpshop/v2/product/search",data:function(e){return{s:e.term}},processResults:function(e){var o=[];for(var t in e){var i={id:e[t].id,text:e[t].title};o.push(i)}return{results:o}},cache:!0},minimumInputLength:1})},window.eoxiaJS.wpshop.product.displayBlockStock=function(e,o){o?jQuery(".stock-block").fadeIn():jQuery(".stock-block").fadeOut()},window.eoxiaJS.wpshop.product.checkAll=function(){jQuery(this).is(":checked")?jQuery('.wps-list-product .table-row:not(.table-header) input[type="checkbox"]').attr("checked",!0):jQuery('.wps-list-product .table-row:not(.table-header) input[type="checkbox"]').attr("checked",!1)},window.eoxiaJS.wpshop.product.apply=function(){"quick-edit"===jQuery(".select-apply").val()&&jQuery(".wps-list-product .table-row:not(.table-header)").each(function(){jQuery(this).find('input[type="checkbox"]').is(":checked")&&jQuery(this).find('.action-attribute[data-action="change_mode"]').click()})},window.eoxiaJS.wpshop.product.autoSynchro=function(e){jQuery(this).find('.button-synchro[data-entry-id="1"]')},window.eoxiaJS.wpshop.product.changeMode=function(e,o){jQuery(e).closest("div.table-row").replaceWith(o.data.view)},window.eoxiaJS.wpshop.settings={},window.eoxiaJS.wpshop.settings.init=function(){},window.eoxiaJS.wpshop.settings.dismiss=function(e,o){jQuery(".notice-erp").fadeOut()},window.eoxiaJS.wpshop.doliAssociate={},window.eoxiaJS.wpshop.doliAssociate.init=function(){jQuery(document).on("keyup",".synchro-single .filter-entry",window.eoxiaJS.wpshop.doliAssociate.filter),jQuery(document).on("click",".synchro-single li",window.eoxiaJS.wpshop.doliAssociate.clickEntry)},window.eoxiaJS.wpshop.doliAssociate.filter=function(e){var o=jQuery(".synchro-single ul.select li");o.show();for(var t=jQuery(this).val().toLowerCase(),i=0;i'),d.after('')}),o.open()}),a.on("click",function(e){e.preventDefault(),n.html(""),i.removeClass("hidden"),a.addClass("hidden"),d.val("")})}),window.eoxiaJS.wpshop.doliDocument={},window.eoxiaJS.wpshop.doliDocument.init=function(){},window.eoxiaJS.wpshop.product={},window.eoxiaJS.wpshop.product.init=function(){window.eoxiaJS.wpshop.product.event()},window.eoxiaJS.wpshop.product.event=function(){jQuery(document).on("wps-change-toggle",".stock-field .toggle",window.eoxiaJS.wpshop.product.displayBlockStock),jQuery(document).on("click",'.wps-list-product .table-header input[type="checkbox"]',window.eoxiaJS.wpshop.product.checkAll),jQuery(document).on("click",".button-apply",window.eoxiaJS.wpshop.product.apply),jQuery(document).ready(window.eoxiaJS.wpshop.product.autoSynchro),jQuery(".similar-product").select2({ajax:{url:scriptParams.url+"/wp-json/wpshop/v2/product/search",data:function(e){return{s:e.term}},processResults:function(e){var t=[];for(var o in e){var i={id:e[o].id,text:e[o].title};t.push(i)}return{results:t}},cache:!0},minimumInputLength:1})},window.eoxiaJS.wpshop.product.displayBlockStock=function(e,t){t?jQuery(".stock-block").fadeIn():jQuery(".stock-block").fadeOut()},window.eoxiaJS.wpshop.product.checkAll=function(){jQuery(this).is(":checked")?jQuery('.wps-list-product .table-row:not(.table-header) input[type="checkbox"]').attr("checked",!0):jQuery('.wps-list-product .table-row:not(.table-header) input[type="checkbox"]').attr("checked",!1)},window.eoxiaJS.wpshop.product.apply=function(){"quick-edit"===jQuery(".select-apply").val()&&jQuery(".wps-list-product .table-row:not(.table-header)").each(function(){jQuery(this).find('input[type="checkbox"]').is(":checked")&&jQuery(this).find('.action-attribute[data-action="change_mode"]').click()})},window.eoxiaJS.wpshop.product.autoSynchro=function(e){jQuery(this).find('.button-synchro[data-entry-id="1"]')},window.eoxiaJS.wpshop.product.changeMode=function(e,t){jQuery(e).closest("div.table-row").replaceWith(t.data.view)},window.eoxiaJS.wpshop.settings={},window.eoxiaJS.wpshop.settings.init=function(){},window.eoxiaJS.wpshop.settings.dismiss=function(e,t){jQuery(".notice-erp").fadeOut()},window.eoxiaJS.wpshop.doliAssociate={},window.eoxiaJS.wpshop.doliAssociate.init=function(){jQuery(document).on("keyup",".synchro-single .filter-entry",window.eoxiaJS.wpshop.doliAssociate.filter),jQuery(document).on("click",".synchro-single li",window.eoxiaJS.wpshop.doliAssociate.clickEntry)},window.eoxiaJS.wpshop.doliAssociate.filter=function(e){var t=jQuery(".synchro-single ul.select li");t.show();for(var o=jQuery(this).val().toLowerCase(),i=0;i%2$s and " msgstr "les %2$s et " -#: modules/checkout/action/class-checkout-action.php:466 +#: modules/checkout/action/class-checkout-action.php:496 #, php-format msgid "the %2$s" msgstr "la %2$s" -#: modules/checkout/class/class-checkout.php:68 +#: modules/checkout/class/class-checkout.php:70 msgid "Terms" msgstr "Termes" -#: modules/checkout/class/class-checkout.php:73 -#: modules/checkout/view/frontend/form-shipping.php:26 +#: modules/checkout/class/class-checkout.php:75 +#: modules/checkout/view/frontend/form-shipping.php:34 msgid "First name" msgstr "Prénom" -#: modules/checkout/class/class-checkout.php:77 +#: modules/checkout/class/class-checkout.php:79 msgid "Last name" msgstr "Nom de famille" -#: modules/checkout/class/class-checkout.php:81 -#: modules/dolibarr/doli-order/view/metabox-order-details.view.php:28 -#: modules/my-account/view/frontend/my-account-details.php:48 -#: modules/third-parties/view/metaboxes/metabox-billing-address-edit.view.php:34 -#: modules/third-parties/view/metaboxes/metabox-billing-address.view.php:35 -#: modules/third-parties/view/metaboxes/metabox-contacts-edit.view.php:23 +#: modules/checkout/class/class-checkout.php:83 +#: modules/dolibarr/doli-order/view/metabox-order-details.view.php:34 +#: modules/my-account/view/frontend/my-account-details.php:59 +#: modules/third-parties/view/metaboxes/metabox-billing-address-edit.view.php:39 +#: modules/third-parties/view/metaboxes/metabox-billing-address.view.php:40 +#: modules/third-parties/view/metaboxes/metabox-contacts-edit.view.php:29 msgid "Phone" msgstr "Numéro de téléphone" -#: modules/checkout/class/class-checkout.php:85 +#: modules/checkout/class/class-checkout.php:87 msgid "Email contact" msgstr "Adresse email" -#: modules/checkout/class/class-checkout.php:89 -#: modules/my-account/view/frontend/form-login.php:56 +#: modules/checkout/class/class-checkout.php:91 +#: modules/my-account/view/frontend/form-login.php:54 msgid "Password" msgstr "Mot de passe" -#: modules/checkout/class/class-checkout.php:99 +#: modules/checkout/class/class-checkout.php:101 msgid "Street Address" msgstr "Adresse" -#: modules/checkout/class/class-checkout.php:103 +#: modules/checkout/class/class-checkout.php:105 msgid "Postcode / Zip" msgstr "Code postal" -#: modules/checkout/class/class-checkout.php:107 -#: modules/checkout/view/frontend/form-shipping.php:79 +#: modules/checkout/class/class-checkout.php:109 +#: modules/checkout/view/frontend/form-shipping.php:83 msgid "Town / City" msgstr "Ville" -#: modules/checkout/class/class-checkout.php:126 +#: modules/checkout/class/class-checkout.php:129 msgid "" "You need to accept the general conditions of sale and " "the privacy policy" @@ -195,197 +196,198 @@ msgstr "" "Veuillez accepter Les conditions générales de vente et " "la Politique confidentialité" -#: modules/checkout/class/class-checkout.php:139 +#: modules/checkout/class/class-checkout.php:142 #, php-format msgid "%s is a required field." msgstr "%s est un champs requis." -#: modules/checkout/class/class-checkout.php:151 +#: modules/checkout/class/class-checkout.php:154 #, php-format msgid "%s is already used." msgstr "%s est déjà utilisé." -#: modules/checkout/filter/class-checkout-filter.php:55 +#: modules/checkout/filter/class-checkout-filter.php:60 msgid "Add to wish list" msgstr "Ajouter à la liste d'envie" -#: modules/checkout/shortcode/class-checkout-shortcode.php:102 -#: modules/checkout/shortcode/class-checkout-shortcode.php:109 +#: modules/checkout/shortcode/class-checkout-shortcode.php:103 +#: modules/checkout/shortcode/class-checkout-shortcode.php:110 msgid "quotation" msgstr "devis" -#: modules/checkout/shortcode/class-checkout-shortcode.php:103 -#: modules/checkout/shortcode/class-checkout-shortcode.php:110 +#: modules/checkout/shortcode/class-checkout-shortcode.php:104 +#: modules/checkout/shortcode/class-checkout-shortcode.php:111 msgid "See my quotations" msgstr "Voir mes devis" -#: modules/checkout/shortcode/class-checkout-shortcode.php:117 +#: modules/checkout/shortcode/class-checkout-shortcode.php:118 msgid "order" msgstr "commande" -#: modules/checkout/shortcode/class-checkout-shortcode.php:118 +#: modules/checkout/shortcode/class-checkout-shortcode.php:119 msgid "See my orders" msgstr "Voir mes commandes" -#: modules/checkout/shortcode/class-checkout-shortcode.php:123 +#: modules/checkout/shortcode/class-checkout-shortcode.php:124 msgid "You can not see this page. Go back to %s with the dolibarr%s avec les données de " "dolibarr" -#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:68 -#: modules/dolibarr/doli-proposals/view/main.view.php:20 +#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:70 +#: modules/dolibarr/doli-proposals/view/main.view.php:34 msgid "Dolibarr Proposals" msgstr "Propositions commerciales" -#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:85 +#: modules/dolibarr/doli-proposals/action/class-doli-proposals-action.php:88 #, fuzzy #| msgid "Proposals" msgid "Proposals Dolibarr" msgstr "Propositions commerciales" -#: modules/dolibarr/doli-proposals/view/list.view.php:21 +#: modules/dolibarr/doli-proposals/view/list.view.php:29 #: modules/proposals/view/list.view.php:21 msgid "Proposal reference" msgstr "Référence du devis" -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:40 -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:66 -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:88 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:44 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:70 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:92 msgid "Draft" msgstr "Brouillon" -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:44 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:48 msgid "Waiting for a signature" msgstr "En attente de la signature" -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:48 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:52 msgid "Signed" msgstr "Signé" -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:52 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:56 msgid "Not signed" msgstr "Non signé" -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:70 -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:92 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:74 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:96 msgid "Not paid" msgstr "Non payée" -#: modules/dolibarr/doli-statut/class/class-doli-statut.php:100 +#: modules/dolibarr/doli-statut/class/class-doli-statut.php:104 msgid "Abandoned" msgstr "Abondonée" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:53 -#: modules/third-parties/action/class-third-party-action.php:155 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:54 +#: modules/third-parties/action/class-third-party-action.php:157 #: modules/third-parties/filter/class-third-party-filter.php:43 #: modules/third-parties/filter/class-third-party-filter.php:45 msgid "Third parties" msgstr "Tiers" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:73 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:74 #: modules/proposals/filter/class-proposals-filter.php:42 #: modules/proposals/filter/class-proposals-filter.php:44 -#: modules/third-parties/view/metaboxes/metabox-dolibarr-proposals.view.php:20 -#: modules/third-parties/view/metaboxes/metabox-proposals.view.php:20 +#: modules/third-parties/view/metaboxes/metabox-dolibarr-proposals.view.php:26 +#: modules/third-parties/view/metaboxes/metabox-proposals.view.php:27 msgid "Proposals" msgstr "Propositions commerciales" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:162 -#: modules/dolibarr/doli-third-parties/class/class-doli-third-parties.php:63 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:168 +#: modules/dolibarr/doli-third-parties/class/class-doli-third-parties.php:64 #, php-format msgid "" "Erase data for the third party %s with the " @@ -1064,32 +1056,36 @@ msgstr "" "Effacer les données pour le tiers %s avec les données de " "dolibarr" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:263 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:278 msgid "WP Object is not equal Dolibarr Object" msgstr "L'objet WordPress n'est pas égal à l'objet Dolibarr" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:270 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:285 msgid "Sync OK" msgstr "Synchronisation OK" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:281 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:308 msgid "Looking for sync status" msgstr "Rechercher un statut de synchronisation" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:292 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:319 msgid "No associated to an ERP Entity" msgstr "Cette entitée n'est pas associé à votre ERP" -#: modules/dolibarr/doli-sync/class/class-doli-sync.php:323 +#: modules/dolibarr/doli-sync/class/class-doli-sync.php:350 msgid "Error not defined" msgstr "Erreur non définie" -#: modules/dolibarr/doli-sync/view/sync-item.view.php:31 +#: modules/dolibarr/doli-sync/view/sync-header.view.php:16 +msgid "Synchro" +msgstr "Synchroniser" + +#: modules/dolibarr/doli-sync/view/sync-item.view.php:36 #, php-format msgid "Associate and synchronize %s" msgstr "Associer et synchroniser %s" -#: modules/dolibarr/doli-third-parties/class/class-doli-third-parties.php:137 +#: modules/dolibarr/doli-third-parties/class/class-doli-third-parties.php:138 #, php-format msgid "" "Erase data for the third party %s with the " @@ -1098,195 +1094,128 @@ msgstr "" "Effacer les données pour le tiers %s avec les données de " "WordPress" -#: modules/dolibarr/doli-user/view/frontend/user-alert.php:25 +#: modules/dolibarr/doli-user/view/frontend/user-alert.php:22 msgid "There is a problem connecting your account to our ERP" msgstr "IL Y A UN PROBLÈME DE CONNEXION DE VOTRE COMPTE À NOTRE ERP" -#: modules/emails/class/class-emails.php:47 -#: modules/pages/class/class-pages.php:103 +#: modules/emails/class/class-emails.php:48 +#: modules/pages/class/class-pages.php:108 msgid "New account" msgstr "Nouveau compte" -#: modules/emails/class/class-emails.php:48 -#: modules/pages/class/class-pages.php:118 +#: modules/emails/class/class-emails.php:49 +#: modules/pages/class/class-pages.php:123 msgid "" "Welcome
This email confirms that your account has been created.
" "Thank you for your trust and see you soon on our shop." msgstr "" -#: modules/emails/class/class-emails.php:52 +#: modules/emails/class/class-emails.php:53 msgid "Pending order" msgstr "Commande en cours" -#: modules/emails/class/class-emails.php:53 -#: modules/pages/class/class-pages.php:119 +#: modules/emails/class/class-emails.php:54 +#: modules/pages/class/class-pages.php:124 msgid "" "Hello
We have just recorded your order, thank you to send us your " "payment.
We thank you for your confidence and see you soon on our shop." msgstr "" -#: modules/emails/class/class-emails.php:57 +#: modules/emails/class/class-emails.php:58 msgid "New order" msgstr "Nouvelle commande payée" -#: modules/emails/class/class-emails.php:58 -#: modules/pages/class/class-pages.php:120 +#: modules/emails/class/class-emails.php:59 +#: modules/pages/class/class-pages.php:125 msgid "" "Hello
This email confirms that your payment for your recent order has " "just been validated.
See you soon on our shop." msgstr "" -#: modules/emails/class/class-emails.php:70 +#: modules/emails/class/class-emails.php:71 msgid "Send invoice" msgstr "Votre facture" -#: modules/emails/class/class-emails.php:71 -#: modules/pages/class/class-pages.php:122 +#: modules/emails/class/class-emails.php:72 +#: modules/pages/class/class-pages.php:127 msgid "Hello
You can access your invoices by logging in to your account." msgstr "" -#: modules/emails/view/admin-new-order.php:30 -#, php-format -msgid "You’ve received the following order from %s:" -msgstr "Vous avez reçu la commande suivante de %s:" - -#: modules/emails/view/admin-new-order.php:33 -#, php-format -msgid "
View order" -msgstr "Voir la commande" - -#: modules/emails/view/customer-delivered-order.php:30 -#: modules/emails/view/customer-invoice.php:30 -#: modules/emails/view/customer-new-account.php:26 -#: modules/emails/view/customer-processing-order.php:26 -#, php-format -msgid "Hi %s," -msgstr "Bonjour %s," - -#: modules/emails/view/customer-delivered-order.php:36 -#, php-format -msgid "Your %s order has beed marked delivered on our side." -msgstr "Votre commande de %s a été marquée comme livrée de notre côté." - -#: modules/emails/view/customer-delivered-order.php:47 -#, php-format -msgid "Your tracking link: %s." -msgstr "Votre lien de suivi : %s." - -#: modules/emails/view/customer-invoice.php:37 -#, php-format -msgid "Your invoice %1$s for your order %2$s" -msgstr "Votre facture #%1$s pour votre commande #%2$s" - -#: modules/emails/view/customer-new-account.php:32 -#, php-format -msgid "" -"Thanks for creating an account on %1$s. Your username is %2$s. You can " -"access your account area to view orders, change your password, and more at: " -"%4$s" -msgstr "" -"Merci d'avoir crée votre compte sur %1$s. Votre identifiant est %2$s. Vous " -"pouvez accéder à votre compte pour voir vos commandes, télécharger vos " -"factures, réinitialiser votre mot de passe et bien d'autre, sur : %4$s" - -#: modules/emails/view/customer-new-account.php:44 -#, php-format -msgid "" -"Click here to create your password: Create my " -"password" -msgstr "" -"Cliquez ici pour créer votre mot de passe: Créer mon " -"mot de passe" - -#: modules/emails/view/customer-new-account.php:48 -msgid "We look forward to seeing you soon." -msgstr "Nous avons hâte de vous revoir bientôt." - -#: modules/emails/view/customer-processing-order.php:32 -#, php-format -msgid "" -"Just to let you know — we've received your order #%s, and it is now being " -"processed:" -msgstr "" -"Nous vous informons que nous avons bien reçu votre commande #%s. Celle-ci " -"est en cours de traitement:" - -#: modules/emails/view/frontend/order-details.php:26 +#: modules/emails/view/frontend/order-details.php:32 #, php-format msgid "Order #%1$s ()" msgstr "Commande #%1$s ()" -#: modules/emails/view/frontend/order-details.php:82 +#: modules/emails/view/frontend/order-details.php:79 msgid "See my orders or my downloadable products" msgstr "Voir mes commandes ou mes produits téléchargeables" -#: modules/my-account/action/class-my-account-action.php:83 +#: modules/my-account/action/class-my-account-action.php:82 msgid "Your username or password is incorrect." msgstr "Votre identifiant ou votre mot de passe est incorrect." -#: modules/my-account/action/class-my-account-action.php:213 +#: modules/my-account/action/class-my-account-action.php:212 msgid "What do you try to do ?" msgstr "Qu'essayez-vous de faire ?" -#: modules/my-account/class/class-my-account.php:110 -#: modules/pages/class/class-pages.php:87 +#: modules/my-account/class/class-my-account.php:127 +#: modules/pages/class/class-pages.php:92 msgid "My account" msgstr "Mon compte" -#: modules/my-account/class/class-my-account.php:115 +#: modules/my-account/class/class-my-account.php:132 #: modules/proposals/action/class-proposals-action.php:61 #: modules/proposals/view/main.view.php:21 msgid "Wish List" msgstr "Liste d'envies" -#: modules/my-account/class/class-my-account.php:120 +#: modules/my-account/class/class-my-account.php:137 msgid "Dolibarr Quotation" msgstr "Proposition" -#: modules/my-account/class/class-my-account.php:135 +#: modules/my-account/class/class-my-account.php:152 msgid "Downloads" msgstr "Téléchargements" -#: modules/my-account/class/class-my-account.php:140 +#: modules/my-account/class/class-my-account.php:157 msgid "Logout" msgstr "Deconnexion" -#: modules/my-account/class/class-my-account.php:153 +#: modules/my-account/class/class-my-account.php:170 msgid "Switch back" msgstr "Retour" -#: modules/my-account/view/frontend/checkout-login.php:21 +#: modules/my-account/view/frontend/checkout-login.php:24 msgid "Returning customer ?" msgstr "Déjà client ? Cliquez ici pour vous connecter ?" -#: modules/my-account/view/frontend/checkout-login.php:21 +#: modules/my-account/view/frontend/checkout-login.php:24 msgid "Click here to login" msgstr "Cliquez ici pour vous connecter" -#: modules/my-account/view/frontend/form-login.php:50 -#: modules/my-account/view/frontend/lost-password.php:33 +#: modules/my-account/view/frontend/form-login.php:48 +#: modules/my-account/view/frontend/lost-password.php:32 msgid "Username or email address" msgstr "Nom d'utilisateur ou adresse électronique" -#: modules/my-account/view/frontend/form-login.php:63 +#: modules/my-account/view/frontend/form-login.php:61 msgid "Log in" msgstr "Connexion" -#: modules/my-account/view/frontend/form-login.php:64 +#: modules/my-account/view/frontend/form-login.php:62 msgid "Lost Password" msgstr "Mot de passe perdu" -#: modules/my-account/view/frontend/login-title.php:21 -#: modules/my-account/view/frontend/my-account-details.php:55 +#: modules/my-account/view/frontend/login-title.php:16 +#: modules/my-account/view/frontend/my-account-details.php:66 msgid "Login" msgstr "Connexion" -#: modules/my-account/view/frontend/lost-password.php:20 +#: modules/my-account/view/frontend/lost-password.php:19 msgid "Lost password ?" msgstr "Mot de passe perdu ?" -#: modules/my-account/view/frontend/lost-password.php:22 +#: modules/my-account/view/frontend/lost-password.php:21 msgid "" "Lost your password? Please enter your username or email address. You will " "receive a link to create a new password via email." @@ -1295,93 +1224,93 @@ msgstr "" "ou votre adresse électronique. Vous recevrez un lien pour créer un nouveau " "mot de passe par courrier électronique." -#: modules/my-account/view/frontend/lost-password.php:40 +#: modules/my-account/view/frontend/lost-password.php:39 msgid "Reset password" msgstr "Réinitialisation du mot de passe" -#: modules/my-account/view/frontend/my-account-details.php:83 +#: modules/my-account/view/frontend/my-account-details.php:94 msgid "Zip" msgstr "Code postal" -#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:24 -#: modules/my-account/view/frontend/my-account-invoices.php:25 -#: modules/my-account/view/frontend/my-account-orders.php:24 +#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:31 +#: modules/my-account/view/frontend/my-account-invoices.php:31 +#: modules/my-account/view/frontend/my-account-orders.php:30 msgid "Please contact commercial" msgstr "Veuillez contacter le service commercial" -#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:44 -#: modules/my-account/view/frontend/my-account-invoices.php:46 -#: modules/my-account/view/frontend/my-account-orders.php:44 -#: modules/my-account/view/frontend/my-account-proposals.php:33 +#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:47 +#: modules/my-account/view/frontend/my-account-invoices.php:47 +#: modules/my-account/view/frontend/my-account-orders.php:46 +#: modules/my-account/view/frontend/my-account-proposals.php:32 msgid "View details" msgstr "Voir les détails" -#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:78 +#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:80 #: modules/my-account/view/frontend/my-account-invoices.php:75 -#: modules/my-account/view/frontend/my-account-orders.php:81 -#: modules/my-account/view/frontend/my-account-proposals.php:67 +#: modules/my-account/view/frontend/my-account-orders.php:82 +#: modules/my-account/view/frontend/my-account-proposals.php:66 msgid "No products to display" msgstr "Aucun produits à afficher" -#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:89 +#: modules/my-account/view/frontend/my-account-dolibarr-proposals.php:88 msgid "No quotations" msgstr "Aucun devis" -#: modules/my-account/view/frontend/my-account-downloads.php:47 +#: modules/my-account/view/frontend/my-account-downloads.php:52 msgid "No downloadable product" msgstr "Aucun produit téléchargeable" -#: modules/my-account/view/frontend/my-account-invoices.php:86 +#: modules/my-account/view/frontend/my-account-invoices.php:83 msgid "No invoice" msgstr "Aucune facture" -#: modules/my-account/view/frontend/my-account-orders.php:92 +#: modules/my-account/view/frontend/my-account-orders.php:90 msgid "No orders" msgstr "Aucune commande" -#: modules/my-account/view/frontend/my-account-proposals.php:78 +#: modules/my-account/view/frontend/my-account-proposals.php:77 msgid "No wishes" msgstr "Aucune envie" -#: modules/pages/class/class-pages.php:84 +#: modules/pages/class/class-pages.php:89 msgid "Shop" msgstr "Boutique" -#: modules/pages/class/class-pages.php:85 +#: modules/pages/class/class-pages.php:90 msgid "Cart" msgstr "Panier" -#: modules/pages/class/class-pages.php:86 +#: modules/pages/class/class-pages.php:91 msgid "Checkout" msgstr "Tunnel de vente" -#: modules/pages/class/class-pages.php:88 +#: modules/pages/class/class-pages.php:93 msgid "General conditions of sale" msgstr "Condition générales de vente" -#: modules/pages/class/class-pages.php:105 +#: modules/pages/class/class-pages.php:110 msgid "Current order" msgstr "Commande en cours" -#: modules/pages/class/class-pages.php:107 +#: modules/pages/class/class-pages.php:112 msgid "Completed order" msgstr "Commande complétée" -#: modules/pages/class/class-pages.php:109 -#: modules/pages/class/class-pages.php:121 +#: modules/pages/class/class-pages.php:114 +#: modules/pages/class/class-pages.php:126 msgid "Paid order" msgstr "Commande payée" -#: modules/pages/class/class-pages.php:113 -#: modules/pages/class/class-pages.php:123 +#: modules/pages/class/class-pages.php:118 +#: modules/pages/class/class-pages.php:128 msgid "Delivered order" msgstr "Commande livrée" -#: modules/payment/class/class-payment.php:52 +#: modules/payment/class/class-payment.php:54 msgid "Cheque" msgstr "Chèque" -#: modules/payment/class/class-payment.php:53 +#: modules/payment/class/class-payment.php:55 msgid "" "Please send a check to Store Name, Store Street, Store Town, Store State / " "County, Store Postcode." @@ -1389,50 +1318,50 @@ msgstr "" "Veuillez envoyer un chèque au Nom de la boutique, adresse, ville, pays, Code " "postal." -#: modules/payment/class/class-payment.php:59 +#: modules/payment/class/class-payment.php:61 msgid "Payment in shop" msgstr "Paiement en boutique" -#: modules/payment/class/class-payment.php:60 +#: modules/payment/class/class-payment.php:62 msgid "Pay and pick up directly your products at the shop." msgstr "Payez et retirer vos produits à la boutique." -#: modules/payment/class/class-payment.php:65 +#: modules/payment/class/class-payment.php:67 msgid "PayPal" msgstr "PayPal" -#: modules/payment/class/class-payment.php:66 +#: modules/payment/class/class-payment.php:68 msgid "Accept payments via PayPal using account balance or credit card." msgstr "" "Paiements par PayPal utilisant le solde du compte ou la carte de crédit " "acceptés." -#: modules/payment/class/class-payment.php:73 +#: modules/payment/class/class-payment.php:75 msgid "Stripe" msgstr "Stripe" -#: modules/payment/class/class-payment.php:74 +#: modules/payment/class/class-payment.php:76 msgid "Use your credit card to place your order" msgstr "Utilisez votre carte de crédit pour passer votre commande" -#: modules/payment/class/class-payment.php:85 +#: modules/payment/class/class-payment.php:87 msgid "Waiting for the check" msgstr "En attente du chèque" -#: modules/payment/class/class-payment.php:86 -#: modules/payment/class/class-payment.php:90 -#: modules/payment/class/class-payment.php:94 -#: modules/payment/class/class-payment.php:98 +#: modules/payment/class/class-payment.php:88 +#: modules/payment/class/class-payment.php:92 +#: modules/payment/class/class-payment.php:96 +#: modules/payment/class/class-payment.php:100 msgid "Paid" msgstr "Payée" -#: modules/payment/class/class-payment.php:89 -#: modules/payment/class/class-payment.php:93 -#: modules/payment/class/class-payment.php:97 +#: modules/payment/class/class-payment.php:91 +#: modules/payment/class/class-payment.php:95 +#: modules/payment/class/class-payment.php:99 msgid "Waiting for the payment" msgstr "En attente du paiement" -#: modules/paypal/filter/class-paypal-filter.php:46 +#: modules/paypal/filter/class-paypal-filter.php:45 msgid "" " SANDBOX ENABLED. You can use sandbox testing accounts only. See the PayPal " @@ -1443,57 +1372,65 @@ msgstr "" "lifecycle/ug_sandbox/\">Guide de test des bacs à sable de PayPal pour " "plus de détails." -#: modules/paypal/view/form-setting.view.php:20 +#: modules/paypal/view/form-setting.view.php:24 msgid "Paypal email" msgstr "Email Paypal" -#: modules/paypal/view/form-setting.view.php:29 +#: modules/paypal/view/form-setting.view.php:33 msgid "PayPal Sandbox" msgstr "Sandbox de PayPal" -#: modules/products/action/class-product-action.php:53 +#: modules/products/action/class-product-action.php:51 msgid "Products Category" msgstr "Catégories de produits" -#: modules/products/action/class-product-action.php:344 +#: modules/products/action/class-product-action.php:350 #, php-format msgid "Search result for \"%s\"" msgstr "Résultats de la recherche pour \"%s\"" -#: modules/products/class/class-product.php:173 +#: modules/products/class/class-product.php:191 msgid "Product configuration" msgstr "Configuration du produit" +#: modules/products/class/class-product.php:198 +msgid "Product Gallery" +msgstr "Galerie d'image du produit" + +#: modules/products/class/class-product.php:206 +msgid "Product Document" +msgstr "Documents du produit" + +#: modules/products/filter/class-product-filter.php:64 #: modules/products/filter/class-product-filter.php:66 -#: modules/products/filter/class-product-filter.php:68 msgid "Product" msgstr "Produit" -#: modules/products/filter/class-product-filter.php:70 +#: modules/products/filter/class-product-filter.php:68 msgid "Add New Product" msgstr "Ajouter nouveau produit" -#: modules/products/filter/class-product-filter.php:71 +#: modules/products/filter/class-product-filter.php:69 msgid "New Product" msgstr "Nouveau produit" -#: modules/products/filter/class-product-filter.php:72 +#: modules/products/filter/class-product-filter.php:70 msgid "Edit Product" msgstr "Editer produit" -#: modules/products/filter/class-product-filter.php:73 +#: modules/products/filter/class-product-filter.php:71 msgid "View Product" msgstr "Voir produit" -#: modules/products/filter/class-product-filter.php:74 +#: modules/products/filter/class-product-filter.php:72 msgid "All Products" msgstr "Tous les produits" -#: modules/products/filter/class-product-filter.php:75 +#: modules/products/filter/class-product-filter.php:73 msgid "Search Products" msgstr "Rechercher Produits" -#: modules/products/filter/class-product-filter.php:76 +#: modules/products/filter/class-product-filter.php:74 msgid "Parent Products:" msgstr "Parent de produits:" @@ -1542,83 +1479,111 @@ msgstr "Nouvelle catégorie de produitNom" msgid "category-product" msgstr "categorie-produit" -#: modules/products/filter/class-product-filter.php:256 +#: modules/products/filter/class-product-filter.php:259 msgid "Sold out" msgstr "Rupture de stock" -#: modules/products/view/frontend/wps-product-list-edit.php:43 -#: modules/products/view/frontend/wps-product-list.php:33 +#: modules/products/view/frontend/wps-product-grid.php:40 +#, fuzzy +#| msgid "Search a product" +msgid "See the product" +msgstr "Rechercher un produit" + +#: modules/products/view/frontend/wps-product-grid.php:50 +#, fuzzy +#| msgid "Add New Product category" +msgid "Add the product to cart" +msgstr "Ajouter une nouvelle catégorie de produits" + +#: modules/products/view/frontend/wps-product-list-edit.php:50 +#: modules/products/view/frontend/wps-product-list.php:37 msgid "Unit price:" msgstr "Prix unitaire:" #: modules/products/view/frontend/wps-product-single.php:48 -#: modules/products/view/metabox/main.view.php:109 +#: modules/products/view/metabox/main.view.php:120 msgid "Similar products" msgstr "Produits similaires" -#: modules/products/view/frontend/wps-product-stock.php:19 +#: modules/products/view/frontend/wps-product-stock.php:26 #, php-format msgid "%s in stock" msgstr "%s en stock" -#: modules/products/view/frontend/wps-product-taxonomy.php:23 +#: modules/products/view/frontend/wps-product-taxonomy.php:30 msgid "Read more" msgstr "Détails" -#: modules/products/view/item-edit.view.php:39 +#: modules/products/view/item-edit.view.php:40 msgid "Save" msgstr "Sauvegarder" -#: modules/products/view/item-edit.view.php:68 +#: modules/products/view/item-edit.view.php:66 msgid "No product parent" msgstr "Pas de produit parent" -#: modules/products/view/item-edit.view.php:74 -#: modules/products/view/metabox/main.view.php:87 +#: modules/products/view/item-edit.view.php:71 +#: modules/products/view/metabox/main.view.php:98 msgid "Manage Stock" msgstr "Gérer le stock" -#: modules/products/view/item-edit.view.php:80 -#: modules/products/view/list.view.php:28 -#: modules/products/view/metabox/main.view.php:93 +#: modules/products/view/item-edit.view.php:77 +#: modules/products/view/list.view.php:37 +#: modules/products/view/metabox/main.view.php:104 msgid "Stock" msgstr "Stock" -#: modules/products/view/item.view.php:27 +#: modules/products/view/item.view.php:33 msgid "Edit" msgstr "Modifier" -#: modules/products/view/item.view.php:29 -#: modules/products/view/metabox/main.view.php:26 -#: modules/third-parties/view/item.view.php:32 +#: modules/products/view/item.view.php:35 +#: modules/products/view/metabox/main.view.php:37 +#: modules/third-parties/view/item.view.php:38 msgid "Edit in Dolibarr" msgstr "Editer sur Dolibarr" -#: modules/products/view/item.view.php:31 +#: modules/products/view/item.view.php:37 msgid "Delete" msgstr "Supprimer" -#: modules/products/view/item.view.php:32 +#: modules/products/view/item.view.php:38 msgid "Preview" msgstr "Afficher" -#: modules/products/view/item.view.php:39 +#: modules/products/view/item.view.php:45 msgid "No handle stock" msgstr "Stock non configuré" -#: modules/products/view/list.view.php:22 +#: modules/products/view/list.view.php:31 msgid "Thumbnail" msgstr "Vignette" -#: modules/products/view/list.view.php:25 +#: modules/products/view/list.view.php:34 msgid "Tax Rate" msgstr "Taux de TVA" -#: modules/products/view/metabox/main.view.php:32 +#: modules/products/view/metabox/document.view.php:43 +msgid "Modify documents on Dolibarr" +msgstr "Modifier les documents sur Dolibarr" + +#: modules/products/view/metabox/document.view.php:47 +msgid "Add a file to the document" +msgstr "Ajouter un fichier au document" + +#: modules/products/view/metabox/gallery.view.php:43 +msgid "Modify the gallery on Dolibarr" +msgstr "Modifier la galerie sur Dolibarr" + +#: modules/products/view/metabox/gallery.view.php:47 +msgid "Add an image to the gallery" +msgstr "Ajouter une image à la galerie" + +#: modules/products/view/metabox/main.view.php:43 msgid "Autres informations du produit" msgstr "" -#: modules/products/view/metabox/main.view.php:100 +#: modules/products/view/metabox/main.view.php:111 msgid "Product Downloadable" msgstr "Produit Téléchargeable" @@ -1629,8 +1594,8 @@ msgstr "Devis" #: modules/proposals/filter/class-proposals-filter.php:43 #: modules/proposals/filter/class-proposals-filter.php:45 #: modules/proposals/view/single.view.php:21 -#: modules/third-parties/view/metaboxes/metabox-dolibarr-proposals.view.php:24 -#: modules/third-parties/view/metaboxes/metabox-proposals.view.php:24 +#: modules/third-parties/view/metaboxes/metabox-dolibarr-proposals.view.php:30 +#: modules/third-parties/view/metaboxes/metabox-proposals.view.php:31 msgid "Proposal" msgstr "Proposition commerciale" @@ -1680,11 +1645,11 @@ msgstr "Résultats de la recherche pour \"%s\"" msgid "Details" msgstr "Détails" -#: modules/search/view/search-field.view.php:20 +#: modules/search/view/search-field.view.php:17 msgid "Search for:" msgstr "Rechercher:" -#: modules/search/view/search-field.view.php:21 +#: modules/search/view/search-field.view.php:18 msgid "Search products…" msgstr "Rechercher un produit…" @@ -1693,231 +1658,239 @@ msgstr "Rechercher un produit…" msgid "Search a product" msgstr "Rechercher un produit" -#: modules/search/widget/class-search-widget.php:61 +#: modules/search/widget/class-search-widget.php:63 msgid "New title" msgstr "Nouveau titre" -#: modules/search/widget/class-search-widget.php:64 +#: modules/search/widget/class-search-widget.php:66 msgid "Title:" msgstr "Titre:" -#: modules/settings/action/class-settings-action.php:146 -#: modules/settings/action/class-settings-action.php:305 +#: modules/settings/action/class-settings-action.php:150 +#: modules/settings/action/class-settings-action.php:313 msgid "WPshop cannot connect to dolibarr. Please check your settings" msgstr "" "WPshop n'est pas connecté à Dolibarr. Veuillez vérifier vos configurations" -#: modules/settings/action/class-settings-action.php:153 -#: modules/settings/action/class-settings-action.php:189 -#: modules/settings/action/class-settings-action.php:221 -#: modules/settings/action/class-settings-action.php:249 -#: modules/settings/action/class-settings-action.php:312 +#: modules/settings/action/class-settings-action.php:157 +#: modules/settings/action/class-settings-action.php:194 +#: modules/settings/action/class-settings-action.php:227 +#: modules/settings/action/class-settings-action.php:256 +#: modules/settings/action/class-settings-action.php:320 msgid "Your settings have been saved." msgstr "Vos réglages ont été enregistrés." -#: modules/settings/class/class-settings.php:134 +#: modules/settings/class/class-settings.php:141 msgid "No page" msgstr "Pas de page" -#: modules/settings/class/class-settings.php:219 +#: modules/settings/class/class-settings.php:229 msgid "No product" msgstr "Aucun produit" -#: modules/settings/view/email-single.view.php:48 -#: modules/settings/view/erp.view.php:181 -#: modules/settings/view/general.view.php:57 -#: modules/settings/view/pages.view.php:56 -#: modules/settings/view/payment-method-single.view.php:53 -#: modules/settings/view/shipping-cost.view.php:54 -msgid "Save Changes" -msgstr "Enregistrer les changements" - -#: modules/settings/view/emails.view.php:22 +#: modules/settings/view/emails.view.php:28 msgid "E-mail" msgstr "Email" -#: modules/settings/view/emails.view.php:38 -#: modules/settings/view/notice-activate-erp.view.php:22 -#: modules/settings/view/payment-method.view.php:37 +#: modules/settings/view/emails.view.php:39 +#: modules/settings/view/notice-activate-erp.view.php:19 +#: modules/settings/view/payment-method.view.php:43 msgid "Configure" msgstr "Configurer" -#: modules/settings/view/erp.view.php:26 +#: modules/settings/view/erp.view.php:29 msgid "Dolibarr URL" msgstr "URL de Dolibarr" -#: modules/settings/view/erp.view.php:34 +#: modules/settings/view/erp.view.php:37 msgid "Dolibarr Secret Key" msgstr "Clé API de Dolibarr" -#: modules/settings/view/erp.view.php:35 +#: modules/settings/view/erp.view.php:38 msgid "Secret key used for sell with Dolibarr" msgstr "Clé API utilisée pour la connexion avec Dolibarr" -#: modules/settings/view/erp.view.php:39 +#: modules/settings/view/erp.view.php:40 msgid "Connected to Dolibarr" msgstr "Connecter à Dolibarr" -#: modules/settings/view/erp.view.php:43 +#: modules/settings/view/erp.view.php:42 msgid "Connection to dolibarr failed" msgstr "La connexion à Dolibarr a échoué" -#: modules/settings/view/erp.view.php:55 +#: modules/settings/view/erp.view.php:52 msgid "Dolibarr Public Key (Optional)" msgstr "Clé publique Dolibarr (facultatif)" -#: modules/settings/view/erp.view.php:56 +#: modules/settings/view/erp.view.php:53 msgid "Public key used for your theme" msgstr "Clé publique utilisée pour votre thème" -#: modules/settings/view/erp.view.php:68 +#: modules/settings/view/erp.view.php:65 msgid "Dolibarr Create Tier" msgstr "Crée un Tier Dolibarr" -#: modules/settings/view/erp.view.php:69 modules/settings/view/erp.view.php:78 -#: modules/settings/view/erp.view.php:89 modules/settings/view/erp.view.php:99 -#: modules/settings/view/erp.view.php:120 -#: modules/settings/view/erp.view.php:130 -#: modules/settings/view/erp.view.php:141 -#: modules/settings/view/erp.view.php:150 -#: modules/settings/view/erp.view.php:163 -#: modules/settings/view/erp.view.php:173 +#: modules/settings/view/erp.view.php:66 modules/settings/view/erp.view.php:75 +#: modules/settings/view/erp.view.php:86 modules/settings/view/erp.view.php:96 +#: modules/settings/view/erp.view.php:105 +#: modules/settings/view/erp.view.php:126 +#: modules/settings/view/erp.view.php:136 +#: modules/settings/view/erp.view.php:147 +#: modules/settings/view/erp.view.php:156 +#: modules/settings/view/erp.view.php:169 +#: modules/settings/view/erp.view.php:179 msgid "Test the link" msgstr "Tester le lien" -#: modules/settings/view/erp.view.php:77 +#: modules/settings/view/erp.view.php:74 msgid "Dolibarr Tiers Lists" msgstr "Listes des Tiers Dolibarr" -#: modules/settings/view/erp.view.php:88 +#: modules/settings/view/erp.view.php:85 msgid "Dolibarr Create Product" msgstr "Créer un Produit Dolibarr" -#: modules/settings/view/erp.view.php:98 +#: modules/settings/view/erp.view.php:95 msgid "Dolibarr Products Lists" msgstr "Listes des Produits Dolibarr" -#: modules/settings/view/erp.view.php:119 +#: modules/settings/view/erp.view.php:104 +msgid "Dolibarr Product Document" +msgstr "Les documents des produits Dolibarr" + +#: modules/settings/view/erp.view.php:125 msgid "Dolibarr Create Proposal" msgstr "Créer une Proposition Commerciale Dolibarr" -#: modules/settings/view/erp.view.php:129 +#: modules/settings/view/erp.view.php:135 msgid "Dolibarr Proposals Lists" msgstr "Listes des Propositions Commerciales Dolibarr" -#: modules/settings/view/erp.view.php:140 +#: modules/settings/view/erp.view.php:146 msgid "Dolibarr Create Order" msgstr "Créer une Commande Dolibarr" -#: modules/settings/view/erp.view.php:149 +#: modules/settings/view/erp.view.php:155 msgid "Dolibarr Orders Lists" msgstr "Listes des Commandes Dolibarr" -#: modules/settings/view/erp.view.php:162 +#: modules/settings/view/erp.view.php:168 msgid "Dolibarr Invoices Lists" msgstr "Listes des Factures Dolibarr" -#: modules/settings/view/erp.view.php:172 +#: modules/settings/view/erp.view.php:178 msgid "Dolibarr Payments Lists" msgstr "Listes des Paiements Dolibarr" -#: modules/settings/view/general.view.php:25 +#: modules/settings/view/erp.view.php:187 +#: modules/settings/view/general.view.php:68 +#: modules/settings/view/pages.view.php:66 +#: modules/settings/view/payment-method-single.view.php:58 +#: modules/settings/view/shipping-cost.view.php:57 +msgid "Save Changes" +msgstr "Enregistrer les changements" + +#: modules/settings/view/general.view.php:29 msgid "Shop Email" msgstr "Email de la boutique WPshop" -#: modules/settings/view/general.view.php:33 +#: modules/settings/view/general.view.php:37 msgid "WPshop width size" msgstr "Largeur de la fenêtre de WPshop" -#: modules/settings/view/general.view.php:42 +#: modules/settings/view/general.view.php:46 msgid "WPshop height size" msgstr "Hauteur de la fenêtre de WPshop" -#: modules/settings/view/general.view.php:52 +#: modules/settings/view/general.view.php:56 msgid "Enable wish list" msgstr "Activer la liste d'envies" -#: modules/settings/view/main.view.php:34 modules/tools/view/main.view.php:24 +#: modules/settings/view/general.view.php:63 +msgid "Split product" +msgstr "Séparer les lignes des produits dans le panier" + +#: modules/settings/view/main.view.php:40 modules/tools/view/main.view.php:29 msgid "General" msgstr "Général" -#: modules/settings/view/main.view.php:35 +#: modules/settings/view/main.view.php:41 msgid "Pages" msgstr "Pages" -#: modules/settings/view/main.view.php:36 +#: modules/settings/view/main.view.php:42 msgid "Emails" msgstr "Emails" -#: modules/settings/view/main.view.php:38 +#: modules/settings/view/main.view.php:44 msgid "ERP" msgstr "ERP" -#: modules/settings/view/notice-activate-erp.view.php:21 +#: modules/settings/view/notice-activate-erp.view.php:18 msgid "WPshop: You have not yet set up your ERP ?" msgstr "WPshop: Avez vous réglé votre ERP ?" -#: modules/settings/view/notice-activate-erp.view.php:23 -#: modules/settings/view/notice-error-erp.view.php:22 +#: modules/settings/view/notice-activate-erp.view.php:20 +#: modules/settings/view/notice-error-erp.view.php:26 msgid "Follow this guide" msgstr "Suivre ce guide" -#: modules/settings/view/notice-activate-erp.view.php:27 +#: modules/settings/view/notice-activate-erp.view.php:24 msgid "Do not show this message again." msgstr "Ne montrez plus ce message." -#: modules/settings/view/notice-error-erp.view.php:27 +#: modules/settings/view/notice-error-erp.view.php:31 msgid "Do not show this message again" msgstr "Ne montrez plus ce message" -#: modules/settings/view/payment-method-single.view.php:39 -#: modules/settings/view/payment-method.view.php:34 +#: modules/settings/view/payment-method-single.view.php:44 +#: modules/settings/view/payment-method.view.php:40 msgid "Activate" msgstr "Activer" -#: modules/settings/view/payment-method.view.php:22 +#: modules/settings/view/payment-method.view.php:28 msgid "Method" msgstr "Méthode" -#: modules/settings/view/payment-method.view.php:23 +#: modules/settings/view/payment-method.view.php:29 msgid "Activated" msgstr "Activé" -#: modules/settings/view/payment-method.view.php:34 +#: modules/settings/view/payment-method.view.php:40 msgid "Deactivate" msgstr "Désactiver" -#: modules/settings/view/shipping-cost.view.php:26 +#: modules/settings/view/shipping-cost.view.php:32 msgid "Select shipping product" msgstr "Sélectionner votre produit \"Frais de livraison\"" -#: modules/settings/view/shipping-cost.view.php:48 +#: modules/settings/view/shipping-cost.view.php:51 msgid "Free delivery starting from (€) HT" msgstr "Livraison gratuite à partir de (€) HT" -#: modules/stripe/filter/class-stripe-filter.php:46 +#: modules/stripe/filter/class-stripe-filter.php:45 msgid " SANDBOX ENABLED" msgstr " BAC À SABLE ACTIVÉ" -#: modules/stripe/view/form-setting.view.php:20 +#: modules/stripe/view/form-setting.view.php:24 msgid "Publish key" msgstr "Clé publique" -#: modules/stripe/view/form-setting.view.php:27 +#: modules/stripe/view/form-setting.view.php:31 msgid "Secret key" msgstr "Clé secrète" -#: modules/stripe/view/form-setting.view.php:36 +#: modules/stripe/view/form-setting.view.php:40 msgid "Stripe Sandbox" msgstr "Bac à sable Stripe" #: modules/third-parties/action/class-third-party-action.php:64 #: modules/third-parties/action/class-third-party-action.php:65 -#: modules/third-parties/view/main.view.php:21 +#: modules/third-parties/view/main.view.php:34 msgid "Third Parties" msgstr "Tiers" -#: modules/third-parties/class/class-third-party.php:284 +#: modules/third-parties/class/class-third-party.php:299 #, php-format msgid "Dissociate contact %1$s from %2$s" msgstr "Dissocier contact %1$s depuis %2$s" @@ -1963,84 +1936,158 @@ msgstr "Aucun tiers trouvé." msgid "No third parties found in Trash." msgstr "Aucun Tier trouvé dans la Corbeille." -#: modules/third-parties/view/list.view.php:22 +#: modules/third-parties/view/list.view.php:29 msgid "Society name" msgstr "Nom de la société" -#: modules/third-parties/view/list.view.php:23 +#: modules/third-parties/view/list.view.php:30 msgid "User" msgstr "Utilisateur" -#: modules/third-parties/view/list.view.php:24 +#: modules/third-parties/view/list.view.php:31 msgid "Commercial" msgstr "Commercial" -#: modules/third-parties/view/list.view.php:25 +#: modules/third-parties/view/list.view.php:32 msgid "Actions" msgstr "Actions" -#: modules/third-parties/view/metaboxes/metabox-activity.view.php:20 -msgid "Activity" -msgstr "Activité" - -#: modules/third-parties/view/metaboxes/metabox-billing-address-edit.view.php:20 +#: modules/third-parties/view/metaboxes/metabox-billing-address-edit.view.php:25 msgid "Billing Address" msgstr "Adresse de facturation" -#: modules/third-parties/view/metaboxes/metabox-contacts.view.php:20 +#: modules/third-parties/view/metaboxes/metabox-contacts.view.php:29 msgid "Users" msgstr "Utilisateurs" -#: modules/third-parties/view/metaboxes/metabox-dolibarr-proposals.view.php:26 -#: modules/third-parties/view/metaboxes/metabox-invoices.view.php:27 -#: modules/third-parties/view/metaboxes/metabox-orders.view.php:26 -#: modules/third-parties/view/metaboxes/metabox-proposals.view.php:26 +#: modules/third-parties/view/metaboxes/metabox-dolibarr-proposals.view.php:32 +#: modules/third-parties/view/metaboxes/metabox-invoices.view.php:34 +#: modules/third-parties/view/metaboxes/metabox-orders.view.php:33 +#: modules/third-parties/view/metaboxes/metabox-proposals.view.php:33 msgid "€ TTC" msgstr "€ TTC" -#: modules/third-parties/view/metaboxes/metabox-indicator.view.php:20 -msgid "Indicator" -msgstr "Indicateur" - -#: modules/third-parties/view/metaboxes/metabox-task.view.php:20 -msgid "Tasks" -msgstr "Tâches" - -#: modules/third-parties/view/single-title-edit.view.php:26 +#: modules/third-parties/view/single-title-edit.view.php:30 msgid "New third party" msgstr "Nouveau tier" -#: modules/third-parties/view/single-title.view.php:20 +#: modules/third-parties/view/single-title.view.php:24 #, fuzzy, php-format #| msgid "Tier name %s" msgid "Tier %s" msgstr "Nom du Tier %s" -#: modules/tools/view/general.view.php:22 +#: modules/tools/view/general.view.php:19 msgid "Import third party CSV" msgstr "Importer des clients depuis un CSV" -#: modules/tools/view/general.view.php:32 -#: modules/tools/view/general.view.php:48 +#: modules/tools/view/general.view.php:29 +#: modules/tools/view/general.view.php:45 msgid "Import" msgstr "Importer" -#: modules/tools/view/general.view.php:38 +#: modules/tools/view/general.view.php:35 msgid "Import Product CSV" msgstr "Importer des produits depuis un CSV" -#: modules/tools/view/main.view.php:20 +#: modules/tools/view/main.view.php:25 msgid "Tools" msgstr "Outils" -#: modules/transfert-data/action/class-transfert-data-action.php:184 -#, php-format -msgid "" -"
  • %1$d Contact #%2$d %4$s is already affected to another " -"third party #%3$d %4$s
  • " +#: modules/wishlist/view/frontend/wishlist-add.view.php:19 +msgid "Choose the list or create another list" msgstr "" -"
  • %1$d Contact #%2$d %4$s est déjà affecté à un tier #" -"%3$d %4$s
  • " + +#: modules/wishlist/view/frontend/wishlist-add.view.php:22 +#, fuzzy +#| msgid "Last name" +msgid "List name" +msgstr "Nom de famille" + +#~ msgid "Click on the image to highlight it" +#~ msgstr "Cliquez sur l'image pour la mettre en avant" + +#, fuzzy +#~| msgid "Latest customers" +#~ msgid "Set custom image" +#~ msgstr "Derniers clients" + +#~ msgid "Data synchronization" +#~ msgstr "Synchronisation des données" + +#~ msgid "All Invoices Sync" +#~ msgstr "Synchronisation des factures" + +#, php-format +#~ msgid "You’ve received the following order from %s:" +#~ msgstr "Vous avez reçu la commande suivante de %s:" + +#, php-format +#~ msgid "View order" +#~ msgstr "Voir la commande" + +#, php-format +#~ msgid "Hi %s," +#~ msgstr "Bonjour %s," + +#, php-format +#~ msgid "Your %s order has beed marked delivered on our side." +#~ msgstr "Votre commande de %s a été marquée comme livrée de notre côté." + +#, php-format +#~ msgid "Your tracking link: %s." +#~ msgstr "Votre lien de suivi : %s." + +#, php-format +#~ msgid "Your invoice %1$s for your order %2$s" +#~ msgstr "Votre facture #%1$s pour votre commande #%2$s" + +#, php-format +#~ msgid "" +#~ "Thanks for creating an account on %1$s. Your username is %2$s. You can " +#~ "access your account area to view orders, change your password, and more " +#~ "at: %4$s" +#~ msgstr "" +#~ "Merci d'avoir crée votre compte sur %1$s. Votre identifiant est %2$s. " +#~ "Vous pouvez accéder à votre compte pour voir vos commandes, télécharger " +#~ "vos factures, réinitialiser votre mot de passe et bien d'autre, sur : %4$s" + +#, php-format +#~ msgid "" +#~ "Click here to create your password: Create my " +#~ "password" +#~ msgstr "" +#~ "Cliquez ici pour créer votre mot de passe: Créer " +#~ "mon mot de passe" + +#~ msgid "We look forward to seeing you soon." +#~ msgstr "Nous avons hâte de vous revoir bientôt." + +#, php-format +#~ msgid "" +#~ "Just to let you know — we've received your order #%s, and it is now being " +#~ "processed:" +#~ msgstr "" +#~ "Nous vous informons que nous avons bien reçu votre commande #%s. Celle-ci " +#~ "est en cours de traitement:" + +#~ msgid "Activity" +#~ msgstr "Activité" + +#~ msgid "Indicator" +#~ msgstr "Indicateur" + +#~ msgid "Tasks" +#~ msgstr "Tâches" + +#, php-format +#~ msgid "" +#~ "
  • %1$d Contact #%2$d %4$s is already affected to " +#~ "another third party #%3$d %4$s
  • " +#~ msgstr "" +#~ "
  • %1$d Contact #%2$d %4$s est déjà affecté à un tier #" +#~ "%3$d %4$s
  • " #~ msgid "Last Quotations" #~ msgstr "Derniers Devis" diff --git a/modules/cart/action/class-cart-action.php b/modules/cart/action/class-cart-action.php index 24d329a..043e9ea 100644 --- a/modules/cart/action/class-cart-action.php +++ b/modules/cart/action/class-cart-action.php @@ -84,8 +84,9 @@ public function callback_calculate_totals() { public function callback_add_to_cart() { check_ajax_referer( 'add_to_cart' ); - $id = ! empty( $_POST['id'] ) ? (int) $_POST['id'] : 0; - $qty = ! empty( $_POST['qty'] ) ? (int) $_POST['qty'] : 1; + $id = ! empty( $_POST['id'] ) ? (int) $_POST['id'] : 0; + $qty = ! empty( $_POST['qty'] ) ? (int) $_POST['qty'] : 1; + $desc = ! empty( $_POST['desc'] ) ? sanitize_text_field( $_POST['desc'] ) : ''; if ( empty( $id ) ) { wp_send_json_error(); @@ -93,7 +94,7 @@ public function callback_add_to_cart() { $product = Product::g()->get( array( 'id' => $id ), true ); - $added = Cart::g()->add_to_cart( $product, $qty ); + $added = Cart::g()->add_to_cart( $product, $qty, $desc ); ob_start(); include( Template_Util::get_template_part( 'cart', 'link-cart' ) ); diff --git a/modules/cart/class/class-cart.php b/modules/cart/class/class-cart.php index 43dd69e..6266709 100644 --- a/modules/cart/class/class-cart.php +++ b/modules/cart/class/class-cart.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -48,14 +48,14 @@ public function can_add_product() { * Ajoute un produit dans le panier. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 * * @param Product $product Les données du produit. * @param integer $qty La quantité à ajouter. * * @return boolean True si tout s'est bien passé. */ - public function add_to_cart( $product, $qty = 1 ) { + public function add_to_cart( $product, $qty = 1, $desc = '' ) { if ( ! $this->can_add_product() ) { return; } @@ -71,7 +71,8 @@ public function add_to_cart( $product, $qty = 1 ) { if ( ! empty( Cart_Session::g()->cart_contents ) ) { foreach ( Cart_Session::g()->cart_contents as $key => $line ) { - if ( $line['id'] === $product->data['id'] ) { + $data['content'] = $desc; + if ( $line['id'] === $product->data['id'] && Settings::g()->split_product() == false ) { $data['qty'] = $line['qty'] + $qty; $index = $key; break; @@ -83,6 +84,7 @@ public function add_to_cart( $product, $qty = 1 ) { if ( $can_add ) { if ( -1 === $index ) { + $data['content'] = $desc; Cart_Session::g()->add_product( $data ); } else { Cart_Session::g()->update_product( $index, $data ); diff --git a/modules/cart/view/frontend/cart.php b/modules/cart/view/frontend/cart.php index 70ef63d..a3e668d 100644 --- a/modules/cart/view/frontend/cart.php +++ b/modules/cart/view/frontend/cart.php @@ -16,8 +16,9 @@ /** * Documentation des variables utilisées dans la vue. * -* @var array $cart_contents Les données du panier. -* @var Product $product La donnée d'un produit. +* @var array $cart_contents Le tableau contenant toutes les données du panier. + *@var integer $key Le produit. +* @var Product $product Les données d'un produit. * @var array $shipping_cost_option Les données de frais de livraison. * @var integer $total_price_no_shipping Prix total sans frais de livraison. * @var integer $tva_amount Montant de la TVA. @@ -33,15 +34,13 @@
    - $product ) : if ( $shipping_cost_option['shipping_product_id'] !== $product['id'] ) : include( Template_Util::get_template_part( 'products', 'wps-product-list-edit' ) ); endif; endforeach; - endif; - ?> + endif; ?>
    diff --git a/modules/checkout/action/class-checkout-action.php b/modules/checkout/action/class-checkout-action.php index ce8da97..9c50ccd 100644 --- a/modules/checkout/action/class-checkout-action.php +++ b/modules/checkout/action/class-checkout-action.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -408,7 +408,9 @@ public function callback_checkout_proposal( $third_party, $contact ) { * Créer la proposition commerciale lors du tunnel de vente. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 + * + * @todo mettre la langue de l'user API pour la génération du doc * * @param Third_Party $third_party Les données du tier. * @param User $contact Les données du contact. @@ -461,6 +463,7 @@ public function callback_checkout_doli_proposal( $third_party, $contact ) { Request_Util::put( 'documents/builddoc', array( 'modulepart' => 'propal', 'original_file' => $doli_proposal->ref . '/' . $doli_proposal->ref . '.pdf', + 'langcode' => 'fr_FR', ) ); Cart_Session::g()->add_external_data( 'doli_proposal_id', $doli_proposal_id ); diff --git a/modules/dolibarr/doli-associate/action/class-doli-associate-action.php b/modules/dolibarr/doli-associate/action/class-doli-associate-action.php index a58812a..5b6b182 100644 --- a/modules/dolibarr/doli-associate/action/class-doli-associate-action.php +++ b/modules/dolibarr/doli-associate/action/class-doli-associate-action.php @@ -43,7 +43,7 @@ public function load_associate_modal() { $id = ! empty( $_POST['wp_id'] ) ? (int) $_POST['wp_id'] : 0; $type = ! empty( $_POST['type'] ) ? sanitize_text_field( $_POST['type'] ) : ''; - + $sync_info = Doli_Sync::g()->get_sync_infos( $type ); $entries = Request_Util::get( $sync_info['endpoint'] . '?limit=-1' ); @@ -59,24 +59,25 @@ public function load_associate_modal() { } } } - - ob_start(); - View_Util::exec( 'wpshop', 'doli-associate', 'main', array( - 'entries' => $entries, - 'wp_id' => $id, - 'type' => $type, - 'label' => $sync_info['title'], - ) ); - $view = ob_get_clean(); - - ob_start(); - View_Util::exec( 'wpshop', 'doli-associate', 'single-footer' ); - $buttons_view = ob_get_clean(); - - wp_send_json_success( array( - 'view' => $view, - 'buttons_view' => $buttons_view, - ) ); + if ($type == 'wps-product') { + ob_start(); + View_Util::exec( 'wpshop', 'doli-associate', 'main', array( + 'entries' => $entries, + 'wp_id' => $id, + 'type' => $type, + 'label' => $sync_info['title'], + ) ); + $view = ob_get_clean(); + + ob_start(); + View_Util::exec( 'wpshop', 'doli-associate', 'single-footer' ); + $buttons_view = ob_get_clean(); + + wp_send_json_success( array( + 'view' => $view, + 'buttons_view' => $buttons_view, + ) ); + } } /** diff --git a/modules/dolibarr/doli-categories/action/class-doli-categories-action.php b/modules/dolibarr/doli-categories/action/class-doli-categories-action.php new file mode 100644 index 0000000..f284099 --- /dev/null +++ b/modules/dolibarr/doli-categories/action/class-doli-categories-action.php @@ -0,0 +1,169 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +use eoxia\LOG_Util; +use eoxia\View_Util; +use stdClass; + +defined( 'ABSPATH' ) || exit; + +/** + * Doli Category Action Class. + */ +class Doli_Category_Action { + + /** + * Définition des metaboxes sur la page. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var array + */ + public $metaboxes = null; + + /** + * Le constructeur. + * + * @since 2.1.0 + * @version 2.1.0 + */ + public function __construct() { + + add_action( 'admin_menu', array( $this, 'callback_admin_menu' ), 60 ); + + add_action( 'wps_checkout_create_category', array( $this, 'create_category' ), 10, 1 ); + add_action( 'admin_post_wps_download_category', array( $this, 'download_category' ) ); + + } + + /** + * Initialise la page "Catégories". + * + * @since 2.1.0 + * @version 2.1.0 + */ + public function callback_admin_menu() { + if ( Settings::g()->dolibarr_is_active() ) { + $hook = add_submenu_page( 'wpshop', __( 'Categories', 'wpshop' ), __( 'Categories', 'wpshop' ), 'manage_options', 'wps-product-cat', array( $this, 'callback_add_menu_page' ) ); + + if ( ! isset( $_GET['id'] ) ) { + add_action( 'load-' . $hook, array( $this, 'callback_add_screen_option' ) ); + } + } + } + + /** + * Affichage de la vue du menu. + * + * @since 2.1.0 + * @version 2.1.0 + */ + public function callback_add_menu_page() { + global $wpdb; + if ( isset( $_GET['id'] ) ) { + // Single page. + $id = ! empty( $_GET['id'] ) ? (int) $_GET['id'] : 0; + + $doli_category = Request_Util::get( 'categories/' . $id ); + $wp_category = Doli_Category::g()->get( array( 'schema' => true ), true ); + $wp_category = Doli_Category::g()->doli_to_wp( $doli_category, $wp_category); + + $wp_category->data['datec'] = \eoxia\Date_Util::g()->fill_date( $wp_category->data['datec'] ); + + $third_party = Third_Party::g()->get( array( 'id' => $wp_category->data['parent_id'] ), true ); + + View_Util::exec( 'wpshop', 'doli-categories', 'single', array( + 'third_party' => $third_party, + 'category' => $wp_category, + ) ); + } else { + // Listing page. + // @todo: Doublon avec Class Doli Category display() ? + $per_page = get_user_meta( get_current_user_id(), Doli_Category::g()->option_per_page, true ); + $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); + $dolibarr_url = $dolibarr_option['dolibarr_url']; + + $dolibarr_create_category = 'categories/card.php?action=create&type=product&backtopage=%2Fdolibarr%2Fhtdocs%2Fcategories%2Findex.php%3Ftype%3Dproduct'; + + if ( empty( $per_page ) || 1 > $per_page ) { + $per_page = Doli_Category::g()->limit; + } + + $s = ! empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; + + $count = Doli_Category::g()->search( $s, array(), true ); + $number_page = ceil( $count / $per_page ); + $current_page = isset( $_GET['current_page'] ) ? (int) $_GET['current_page'] : 1; + + $base_url = admin_url( 'admin.php?page=wps-product-cat' ); + + $begin_url = $base_url . '¤t_page=1'; + $end_url = $base_url . '¤t_page=' . $number_page; + + $prev_url = $base_url . '¤t_page=' . ( $current_page - 1 ); + $next_url = $base_url . '¤t_page=' . ( $current_page + 1 ); + + if ( ! empty( $s ) ) { + $begin_url .= '&s=' . $s; + $end_url .= '&s=' . $s; + $prev_url .= '&s=' . $s; + $next_url .= '&s=' . $s; + } + + $wp_categories = Doli_Category::g()->get(); + + if ( ! empty($wp_categories)) { + foreach( $wp_categories as $wp_category) { + if (empty($wp_category->data['external_id'] )) { + wp_delete_term($wp_category->data['id'],'wps-product-cat'); + } + } + } + + View_Util::exec( 'wpshop', 'doli-categories', 'main', array( + 'number_page' => $number_page, + 'current_page' => $current_page, + 'count' => $count, + 'begin_url' => $begin_url, + 'end_url' => $end_url, + 'prev_url' => $prev_url, + 'next_url' => $next_url, + 's' => $s, + 'wp_categories'=> $wp_categories, + + 'dolibarr_create_category' => $dolibarr_create_category, + 'dolibarr_url' => $dolibarr_url, + ) ); + } + } + + /** + * Ajoute le menu "Options de l'écran". + * + * @since 2.1.0 + * @version 2.1.0 + */ + public function callback_add_screen_option() { + add_screen_option( + 'per_page', + array( + 'label' => _x( 'Categories', 'Category per page', 'wpshop' ), + 'default' => Doli_Category::g()->limit, + 'option' => Doli_Category::g()->option_per_page, + ) + ); + } +} + +new Doli_Category_Action(); diff --git a/modules/dolibarr/doli-categories/action/index.php b/modules/dolibarr/doli-categories/action/index.php new file mode 100644 index 0000000..6220032 --- /dev/null +++ b/modules/dolibarr/doli-categories/action/index.php @@ -0,0 +1,2 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +use eoxia\Term_Class; +use eoxia\View_Util; +use stdClass; + +defined( 'ABSPATH' ) || exit; + +/** + * Doli Category Class. + */ +class Doli_Category extends Term_Class { + + /** + * Le nom du modèle. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var string + */ + protected $model_name = '\wpshop\Doli_Category_Model'; + + /** + * Le term type. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var string + */ + protected $type = 'wps-product-cat'; + + /** + * La clé principale du modèle. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var string + */ + protected $meta_key = 'doli-categories'; + + /** + * La route pour accéder à l'objet dans la rest API. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var string + */ + protected $base = 'doli-categories'; + + /** + * Le nom du term type. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var string + */ + protected $post_type_name = 'Doli Category'; + + /** + * La limite par page. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var integer + */ + public $limit = 10; + + /** + * Le nom de l'option pour la limite par page. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @var string + */ + public $option_per_page = 'category_doli_per_page'; + + /** + * Appel la vue "list" du module "doli-categories". + * + * @since 2.1.0 + * @version 2.1.0 + */ + public function display() { + global $wpdb; + $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); + $per_page = get_user_meta( get_current_user_id(), Doli_Category::g()->option_per_page, true ); + + if ( empty( $per_page ) || 1 > $per_page ) { + $per_page = Doli_Category::g()->limit; + } + + $current_page = isset( $_GET['current_page'] ) ? (int) $_GET['current_page'] : 1; + + $s = ! empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; + + $route = 'categories?sortfield=t.rowid&sortorder=DESC&limit=' . $per_page . '&page=' . ( $current_page - 1 ); + + if ( ! empty( $s ) ) { + // La route de dolibarr ne fonctionne pas avec des caractères en base10 + $route .= '&sqlfilters=(t.ref%3Alike%3A\'%25' . $s . '%25\')'; + } + + $wp_categories = Doli_Category::g()->get(); + + if ( ! empty($wp_categories)) { + foreach( $wp_categories as $wp_category) { + if (empty($wp_category->data['external_id'] )) { + wp_delete_term($wp_category->data['id'],'wps-product-cat'); + } + } + } + + View_Util::exec( 'wpshop', 'doli-categories', 'list', array( + 'categories' => $wp_categories, + 'doli_url' => $dolibarr_option['dolibarr_url'], + ) ); + } + + /** + * Appel la vue "item" d'une catégorie. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param Doli_Category $category Les données d'une catégorie. + * @param string $doli_url L'url de Dolibarr. + */ + public function display_item( $category, $doli_url = '' ) { + View_Util::exec( 'wpshop', 'doli-categories', 'item', array( + 'category' => $category, + ) ); + } + + /** + * Convertit un tableau Category Object provenant de Dolibarr vers un format Category Object WPshop afin de normisé pour l'affichage. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param stdClass $doli_categories Le tableau contenant toutes les données des catégories provenant de Dolibarr. + * + * @return Doli_Category Le tableau contenant toutes les données des catégories convertis depuis le format de Dolibarr. + */ + public function convert_to_wp_category_format( $doli_categories ) { + $wp_categories = array(); + + if ( ! empty( $doli_categories ) ) { + foreach ( $doli_categories as $doli_category ) { + $wp_category = $this->get( array( 'schema' => true ), true ); + $wp_categories[] = $this->doli_to_wp( $doli_category, $wp_category); + } + } + + return $wp_categories; + } + + /** + * Synchronise depuis Dolibarr vers WP. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param stdClass $doli_category Les données d'une catégorie Dolibarr. + * @param Doli_Category $wp_category Les données d'une catégorie WordPress. + * @param boolean $save Enregistres les données sinon renvoies l'objet remplit sans l'enregistrer en base de donnée. + * @param array $notices Gestion des erreurs et informations de l'évolution de la méthode. * + * @return Doli_Category Les données d'une catégorie WordPress avec ceux de Dolibarr. + */ + public function doli_to_wp( $doli_category, $wp_category, $save = true, &$notices = array( + 'errors' => array(), + 'messages' => array(), + ) ) { + $category = null; + $doli_category = Request_Util::get( 'categories/' . $doli_category->id ); // Charges par la route single des factures pour avoir accès à linkedObjectsIds->commande. + + $wp_category->data['external_id'] = (int) $doli_category->id; + + $wp_category->data['name'] = $doli_category->label; + if ( ! empty($doli_category->array_options->options__wps_slug) ) { + $wp_category->data['slug'] = $doli_category->array_options->options__wps_slug; + } + if ( ! empty($doli_category->array_options->options__wps_id) ) { + $wp_category->data['id'] = (int) $doli_category->array_options->options__wps_id; + } + + $wp_category = Doli_Category::g()->update( $wp_category->data ); + + if ( $save ) { + $data_sha = array(); + $data_sha['doli_id'] = (int) $wp_category->data['external_id']; + $data_sha['wp_id'] = $wp_category->data['id']; + $data_sha['name'] = $wp_category->data['name']; + $data_sha['slug'] = $wp_category->data['slug']; + + $wp_category->data['sync_sha_256'] = hash( 'sha256', implode( ',', $data_sha ) ); + //@todo save_post utilisé ? + + update_term_meta( $wp_category->data['id'], '_sync_sha_256', $wp_category->data['sync_sha_256'] ); + update_term_meta( $wp_category->data['id'], '_external_id', (int) $doli_category->id ); + $notices['messages'][] = sprintf( __( 'Erase data for the product %s with the dolibarr data', 'wpshop' ), $wp_category->data['name'] ); + } + + return $wp_category; + } + + /** + * Fonction de recherche. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param string $s Le terme de la recherche. + * @param array $default_args Les arguments par défaut. + * @param boolean $count Si true compte le nombre d'élement, sinon renvoies l'ID des éléments trouvés. + * + * @return array|integer Les ID des éléments trouvés ou le nombre d'éléments trouvés. + */ + public function search( $s = '', $default_args = array(), $count = false ) { + $route = 'categories?sortfield=t.rowid&sortorder=DESC'; + + if ( ! empty( $s ) ) { + $route .= '&sqlfilters=(t.ref%3Alike%3A\'%25' . $s . '%25\')'; + } + + $doli_categories = Request_Util::get( $route ); + + if ( $count && ! empty( $doli_categories ) ) { + return count( $doli_categories ); + } else { + return 0; + } + } +} + +Doli_Category::g(); diff --git a/modules/dolibarr/doli-categories/class/index.php b/modules/dolibarr/doli-categories/class/index.php new file mode 100644 index 0000000..6220032 --- /dev/null +++ b/modules/dolibarr/doli-categories/class/index.php @@ -0,0 +1,2 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +defined( 'ABSPATH' ) || exit; + +/** + * Dolibarr Category Filter Class. + */ +class Doli_Category_Filter { + + /** + * Le constructeur. + * + * @since 2.1.0 + * @version 2.1.0 + */ + public function __construct() { + if ( Settings::g()->dolibarr_is_active() ) { + //add_filter( 'wps-product-cat_after_get', array( $this, 'auto_sync' ), 10, 2 ); + add_filter( 'wps_category_filter_sync', array( $this, 'category_sync' ), 10, 1 ); + } + } + + /** + * La synchronisation automatique d'une catégorie. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param Doli_Category $object Les données d'une catégorie. + * @param array $args_cb Les arguments supplémentaires. + * + * @return Doli_Category Les données d'une catégorie synchronisé. + */ + public function auto_sync( $object, $args_cb ) { + if ( empty( $object->data['external_id'] ) ) { + return $object; + } + $status = Doli_Sync::g()->check_status( $object->data['id'], $object->data['type'] ); + + if ($status['status_code'] != '0x3') { + return $object; + } + + $doli_category = Request_Util::get( 'categories/' . $object->data['external_id'] ); + $object = Doli_Category::g()->doli_to_wp( $doli_category, $object ); + + return $object; + } + + /** + * La synchronisation manuelle d'unecatégorie. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param Doli_Category $category Les données d'une catégorie. + * + * @return Doli_Category Les données d'une catégorie synchronisé. + */ + public function category_sync( $category ) { + $external_id = get_term_meta( $category->ID, '_external_id', true ); + $status = Doli_Sync::g()->check_status( $category->ID, $category->term_type ); + + if ($status['status_code'] != '0x3') { + return $category; + } + + $doli_category = Request_Util::get( 'categories/' . $external_id ); + $object = Doli_Category::g()->get( array( 'id' => $category->ID ), true ); + $object = Doli_Category::g()->doli_to_wp( $doli_category, $object ); + + $category = get_term( $category->ID ); + + return $category; + } +} + +new Doli_Category_Filter(); diff --git a/modules/dolibarr/doli-categories/filter/index.php b/modules/dolibarr/doli-categories/filter/index.php new file mode 100644 index 0000000..6220032 --- /dev/null +++ b/modules/dolibarr/doli-categories/filter/index.php @@ -0,0 +1,2 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +use eoxia\Term_Model; + +defined( 'ABSPATH' ) || exit; + +/** + * Doli Category Model Class. + */ +class Doli_Category_Model extends Term_Model { + + /** + * Le constructeur. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param Doli_Category $object Les données de l'objet. + * @param string $req_method La méthode de la requête. + */ + public function __construct( $object, $req_method = null ) { + $this->schema['external_id'] = array( + 'type' => 'integer', + 'meta_type' => 'single', + 'field' => '_external_id', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'L\'ID provenant de dolibarr', + ); + + $this->schema['sync_sha_256'] = array( + 'type' => 'string', + 'meta_type' => 'single', + 'field' => '_sync_sha_256', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'La cohérence de la synchronisation avec un ERP', + ); + + $this->schema['datec'] = array( + 'type' => 'wpeo_date', + 'meta_type' => 'single', + 'field' => 'datec', + 'context' => array( 'GET' ), + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'Date de création de la fature. Relation avec dolibarr', + ); + + $this->schema['date_category'] = array( + 'type' => 'wpeo_date', + 'meta_type' => 'single', + 'field' => 'date_category', + 'context' => array( 'GET' ), + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'Date de la fature. Relation avec dolibarr', + ); + + parent::__construct( $object, $req_method ); + } +} diff --git a/modules/dolibarr/doli-categories/model/index.php b/modules/dolibarr/doli-categories/model/index.php new file mode 100644 index 0000000..6220032 --- /dev/null +++ b/modules/dolibarr/doli-categories/model/index.php @@ -0,0 +1,2 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +defined( 'ABSPATH' ) || exit; + +/** + * Documentation des variables utilisées dans la vue. + * + * @var Doli_Category $category Les données d'une facture. + * @var string $doli_url L'url de Dolibarr. + */ + +?> + +
    +
    +
      + data['external_id'] ) ) : ?> +
    • Doli : data['external_id'] ); ?>
    • + +
    • data['datec']['rendered']['date_time'] ); ?>
    • +
    +
      + data['name'] ) ) : ?> + data['name'] ); ?> + - +
    +
      +
    • + data['external_id'] ) ) : ?> +
    • + +
    +
    +
    + data['name'] ) ) : ?> + data['name'] ); ?> + - +
    +
    + data['slug'] ) ) : ?> + data['slug'] ); ?> + - +
    +
    + data['parent_id'] ) ) : ?> + data['parent_id'] ); ?> + - +
    +
    + +
    + +
    diff --git a/modules/dolibarr/doli-categories/view/list.view.php b/modules/dolibarr/doli-categories/view/list.view.php new file mode 100644 index 0000000..5619d2c --- /dev/null +++ b/modules/dolibarr/doli-categories/view/list.view.php @@ -0,0 +1,45 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + + +namespace wpshop; + +use eoxia\View_Util; + +defined( 'ABSPATH' ) || exit; + +/** + * Documentation des variables utilisées dans la vue. + * + * @var array $categories Le tableau contanant toutes les données des factures. + * @var Doli_Category $category Les données d'une catégorie. + * @var string $doli_url L'url de Dolibarr. + */ + +?> + +
    +
    +
    +
    +
    +
    +
    +
    + $category, + 'doli_url' => $doli_url, + ) ); + endforeach; + endif; ?> +
    diff --git a/modules/dolibarr/doli-categories/view/main.view.php b/modules/dolibarr/doli-categories/view/main.view.php new file mode 100644 index 0000000..a5dcc99 --- /dev/null +++ b/modules/dolibarr/doli-categories/view/main.view.php @@ -0,0 +1,33 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +defined( 'ABSPATH' ) || exit; + +/** + * Documentation des variables utilisées dans la vue. + * @var string $dolibarr_create_category Endpoint de création de catégorie dolibarr. + * @var string $dolibarr_url L'url de fin dolibarr. + */ +?> + +
    +

    + + dolibarr_is_active() ) : ?> + + + + +

    + display(); ?> +
    diff --git a/modules/dolibarr/doli-documents/action/class-doli-documents.action.php b/modules/dolibarr/doli-documents/action/class-doli-documents.action.php new file mode 100644 index 0000000..6478ede --- /dev/null +++ b/modules/dolibarr/doli-documents/action/class-doli-documents.action.php @@ -0,0 +1,35 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +use eoxia\LOG_Util; +use eoxia\View_Util; + +defined( 'ABSPATH' ) || exit; + +/** + * Doli Documents Action Class. + */ +class Doli_Documents_Action { + + /** + * Le constructeur. + * + * @since 2.1.0 + * @version 2.1.0 + */ + public function __construct() { + } +} + +new Doli_Documents_Action(); + diff --git a/modules/dolibarr/doli-documents/asset/doli-documents.backend.js b/modules/dolibarr/doli-documents/asset/doli-documents.backend.js new file mode 100644 index 0000000..7bf4ad9 --- /dev/null +++ b/modules/dolibarr/doli-documents/asset/doli-documents.backend.js @@ -0,0 +1,112 @@ +jQuery(function($){ + + // Set all variables to be used in scope + var frame, + metaBox = $('#wps_product_gallery.postbox'), // Your meta box id here + addImgLink = metaBox.find('.upload-custom-img'), + delImgLink = metaBox.find( '.delete-custom-img'), + imgContainer = metaBox.find( '.wps-product-gallery-container' ), + imgIdInput = metaBox.find( '.wps-product-gallery-attachments-hidden-id' ); + + // ADD IMAGE LINK + addImgLink.on( 'click', function( event ){ + + event.preventDefault(); + + // If the media frame already exists, reopen it. + if ( frame ) { + frame.open(); + return; + } + + // Create a new media frame + frame = wp.media({ + title: 'Select or Upload Media Of Your Chosen Persuasion', + button: { + text: 'Use this media' + }, + multiple: true // Set to true to allow multiple files to be selected + }); + + + // When an image is selected in the media frame... + frame.on( 'select', function() { + + // Get media attachment details from the frame state + var attachments = frame.state().get('selection').map( function ( attachment ) { + attachment.toJSON(); + return attachment; + //imgContainer.append( '' ); + //imgIdInput.val( attachment.id ); + }); + + var i; + + for (i = 0; i < attachments.length; ++i) { + + //sample function 1: add image preview + imgContainer.append( + '
    ' + ); + + //sample function 2: add hidden input for each image + imgIdInput.after( + '' + ); + } + + // Send the attachment URL to our custom image input field. + + // Send the attachment id to our hidden input + + // Hide the add image link + //addImgLink.addClass( 'hidden' ); + + // Unhide the remove image link + //delImgLink.removeClass( 'hidden' ); + }); + + // Finally, open the modal on click + frame.open(); + }); + + // DELETE IMAGE LINK + delImgLink.on( 'click', function( event ){ + + event.preventDefault(); + + // Clear out the preview image + imgContainer.html( '' ); + + // Un-hide the add image link + addImgLink.removeClass( 'hidden' ); + + // Hide the delete image link + delImgLink.addClass( 'hidden' ); + + // Delete the image id from the hidden input + imgIdInput.val( '' ); + + }); + +}); + +/** + * Gestion JS des assoications Dolibarr. + * + * @since 2.1.0 + * @version 2.1.0 + */ +window.eoxiaJS.wpshop.doliDocument = {}; + +/** + * La méthode "init" est appelé automatiquement par la lib JS de Eo-Framework. + * + * @since 2.1.0 + * @version 2.1.0 + */ +window.eoxiaJS.wpshop.doliDocument.init = function() { + +}; diff --git a/modules/dolibarr/doli-documents/class/class-doli-documents.php b/modules/dolibarr/doli-documents/class/class-doli-documents.php new file mode 100644 index 0000000..1ee8611 --- /dev/null +++ b/modules/dolibarr/doli-documents/class/class-doli-documents.php @@ -0,0 +1,218 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +use eoxia\Attachment_Class; +use stdClass; + +defined( 'ABSPATH' ) || exit; + +/** + * Doli Documents Class. + */ +class Doli_Documents extends Attachment_Class { + + /** + * Le nom du modèle. + * + * @since 2.0.0 + * @version 2.0.0 + * + * @var string + */ + protected $model_name = '\wpshop\Doli_Documents_Model'; + + /** + * Le post type. + * + * @since 2.0.0 + * @version 2.0.0 + * + * @var string + */ + protected $type = 'wps-documents'; + + /** + * La clé principale du modèle. + * + * @since 2.0.0 + * @version 2.0.0 + * + * @var string + */ + protected $meta_key = 'documents'; + + /** + * La route pour accéder à l'objet dans la rest API. + * + * @since 2.0.0 + * @version 2.0.0 + * + * @var string + */ + protected $base = 'documents'; + + /** + * Le nom du post type. + * + * @since 2.0.0 + * @version 2.0.0 + * + * @var string + */ + protected $post_type_name = 'documents'; + + /** + * Convertit un tableau Documents Object provenant de Dolibarr vers un format Documents Object WPshop afin de normisé pour l'affichage. + * + * @since 2.0.0 + * @version 2.0.0 + * + * @param stdClass $doli_documents Le tableau contenant toutes les données des documents provenant de Dolibarr. + * + * @return Doli_Documents Le tableau contenant toutes les données des documents convertis depuis le format de Dolibarr. + */ + public function convert_to_wp_documents_format( $doli_documents ) { + $wp_documents = array(); + + if ( ! empty( $doli_documents ) ) { + foreach ( $doli_documents as $doli_document ) { + $wp_document = $this->get( array( 'schema' => true ), true ); + $wp_documents[] = $this->doli_to_wp( $doli_document, $wp_document, true ); + } + } + + return $wp_documents; + } + + /** + * Synchronisation depuis Dolibarr vers WP. + * + * @since 2.0.0 + * @version 2.0.0 + * + * @param stdClass $doli_document Les données d'un document Dolibarr. + * @param Doli_Documents $wp_document Les données d'un document WordPress. + * @param boolean $only_convert Only Convert Dolibarr Object to WP. Don't save the WP Object on the database. + * + * @return Doli_Documents Les données d'un document WordPress avec ceux de Dolibarr. + */ + public function doli_to_wp( $doli_document, $wp_document, $only_convert = false ) { + if ( is_object( $wp_document ) ) { + //$wp_document->data['external_id'] = (int) $doli_document->id; + $wp_document->data['name'] = $doli_document->name; + $wp_document->data['path'] = $doli_document->path; + $wp_document->data['fullpath'] = $doli_document->fullname; + $time = get_date_from_gmt ( date( 'Y-m-d H:i:s', $doli_document->date ) ); + $wp_document->data['date'] = $time; + $wp_document->data['size'] = (int) $doli_document->size; + $wp_document->data['dolibarr_type'] = $doli_document->type; + //$wp_document->data['parent_id'] = Doli_Products::g()->get_wp_id_by_doli_id( $doli_document->socid ); + + $wp_document->data['linked_objects_ids'] = array(); + + // @todo: Répéter dans toutes les méthode doli_to_wp. Mettre dans CommonObject. + if ( ! empty( $doli_document->linkedObjectsIds ) ) { + foreach ( $doli_document->linkedObjectsIds as $key => $values ) { + $values = (array) $values; + $wp_document->data['linked_objects_ids'][ $key ] = array(); + + if ( ! empty( $values ) ) { + foreach ( $values as $value ) { + $wp_document->data['linked_objects_ids'][ $key ][] = (int) $value; + } + } + } + } + + if ( ! $only_convert ) { + $wp_document = $this->update( $wp_document->data ); + } + } + return $wp_document; + } + + public function get_attachments( $product, $mine_type ) { + global $wpdb; + $mine_type = $mine_type . "%"; + $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->posts} WHERE post_parent = %d AND post_mime_type LIKE %s", $product->data['external_id'], $mine_type ) ); + $attachments = json_decode( json_encode( $attachments ), true ); + + return $attachments; + } + + public function create_attachments( $wp_documents, $product , $mine_type ) { + $wp_upload_dir = wp_upload_dir(); + foreach ( $wp_documents as $key => $wp_document ) { + $filetype = wp_check_filetype( basename( $wp_document->data['fullpath'] ), null ); + if ( strstr( $filetype['type'], $mine_type ) ) { + $uploadfile = $wp_upload_dir['path'] . '/' . $wp_document->data['name']; + + $contents = file_get_contents( $wp_document->data['fullpath'] ); + $savefile = fopen( $uploadfile, 'w' ); + fwrite( $savefile, $contents ); + fclose( $savefile ); + + $args = array( + 'post_name' => $wp_document->data['name'], + 'post_mime_type' => $filetype['type'], + 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $wp_document->data['fullpath'] ) ), + 'meta_input' => array( + 'path' => $wp_document->data['path'], + 'fullpath' => $wp_document->data['fullpath'], + 'date' => $wp_document->data['date'], + 'size' => $wp_document->data['size'], + 'dolibarr_type' => $wp_document->data['dolibarr_type'], + ), + ); + $attachment_id = wp_insert_attachment( $args, $uploadfile, $product->data['external_id'] ); + require_once ABSPATH . 'wp-admin/includes/image.php'; + $attached_file = get_post_meta( $attachment_id, '_wp_attached_file', true ); + $attach_data = wp_generate_attachment_metadata( $attachment_id, $wp_upload_dir['baseurl'] . '/' . $attached_file ); + wp_update_attachment_metadata( $attachment_id, $attach_data ); + } + } + } + + public function build_sha_documents( $id, $doli_documents ) { + $doli_documents_array = json_decode( json_encode( $doli_documents ), true ); + $data_sha_array = array(); + if ( ! empty( $doli_documents_array ) ) { + foreach ( $doli_documents_array as $doli_documents_array_single ) { + $data_sha_array[] = implode ( ',', $doli_documents_array_single ); + } + } + $data_sha = hash( 'sha256', implode ( ',', $data_sha_array ) ); + update_post_meta( $id, 'sha256_documents', $data_sha ); + + return $data_sha; + } + + public function add_metadata_attachements( $attachments ) { + $attachment = array(); + if ( ! empty( $attachments ) ) { + foreach ( $attachments as $key => $attachment_object ) { + foreach ( $attachment_object as $id => $attachment_data ) { + $attachment[ $id ] = $attachment_data; + $attachment['fullpath'] = get_post_meta( $attachment_object['ID'], 'fullpath', true ); + $attachment['size'] = get_post_meta( $attachment_object['ID'], 'size', true ); + $attachment['attached_file'] = get_post_meta( $attachment_object['ID'], '_wp_attached_file', true ); + } + $attachments[$key] = $attachment; + } + } + + return $attachments; + } +} + +Doli_Documents::g(); diff --git a/modules/dolibarr/doli-documents/class/index.php b/modules/dolibarr/doli-documents/class/index.php new file mode 100644 index 0000000..6220032 --- /dev/null +++ b/modules/dolibarr/doli-documents/class/index.php @@ -0,0 +1,2 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +use eoxia\Attachment_Model; + +defined( 'ABSPATH' ) || exit; + +/** + * Doli Documents Model Class. + */ +class Doli_Documents_Model extends Attachment_Model { + + /** + * Le constructeur. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param Doli_Order $object Les données de l'objet. + * @param string $req_method La méthode de la requête. + */ + public function __construct( $object, $req_method = null ) { + + $this->schema['external_id'] = array( + 'type' => 'integer', + 'meta_type' => 'single', + 'field' => '_external_id', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'L\'ID du customer (dolibarr). Relation avec dolibarr.', + ); + + $this->schema['name'] = array( + 'type' => 'string', + 'meta_type' => 'single', + 'field' => 'name', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'Le nom du document.', + ); + + $this->schema['path'] = array( + 'type' => 'string', + 'meta_type' => 'single', + 'field' => 'path', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'Le chemin d\'accès au document.', + ); + + $this->schema['fullpath'] = array( + 'type' => 'string', + 'meta_type' => 'single', + 'field' => 'guid', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'Le chemin d\'acces total au document.', + ); + + $this->schema['date'] = array( + 'type' => 'wpeo_date', + 'meta_type' => 'single', + 'field' => 'date', + 'context' => array( 'GET' ), + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'Date de création du document. Relation avec dolibarr', + ); + + $this->schema['size'] = array( + 'type' => 'integer', + 'meta_type' => 'single', + 'field' => 'size', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'La taille du document en Ko.', + ); + + $this->schema['dolibarr_type'] = array( + 'type' => 'string', + 'meta_type' => 'single', + 'field' => 'type', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'Le type de document.', + ); + + $this->schema['linked_objects_ids'] = array( + 'type' => 'array', + 'meta_type' => 'single', + 'field' => '_linked_objects_ids', + 'since' => '2.1.0', + 'version' => '2.1.0', + 'description' => 'L\'id des objets liés.', + 'default' => null, + ); + + parent::__construct( $object, $req_method ); + } +} diff --git a/modules/dolibarr/doli-documents/model/index.php b/modules/dolibarr/doli-documents/model/index.php new file mode 100644 index 0000000..6220032 --- /dev/null +++ b/modules/dolibarr/doli-documents/model/index.php @@ -0,0 +1,2 @@ + * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -238,7 +238,9 @@ public function meta_box_product( $invoice ) { * Créer la facture si la commande est payé. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 + * + * @todo mettre la langue de l'user API pour la génération du doc * * @param array $data Data from PayPal. */ @@ -287,6 +289,7 @@ public function create_invoice( $data ) { Request_Util::put( 'documents/builddoc', array( 'modulepart' => 'invoice', 'original_file' => $doli_invoice->ref . '/' . $doli_invoice->ref . '.pdf', + 'langcode' => 'fr_FR', ) ); $invoice_file = Request_Util::get( 'documents/download?modulepart=facture&original_file=' . $doli_invoice->ref . '/' . $doli_invoice->ref . '.pdf' ); diff --git a/modules/dolibarr/doli-order/action/class-doli-order-action.php b/modules/dolibarr/doli-order/action/class-doli-order-action.php index 45a1071..0ec4e93 100644 --- a/modules/dolibarr/doli-order/action/class-doli-order-action.php +++ b/modules/dolibarr/doli-order/action/class-doli-order-action.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -373,7 +373,9 @@ public function metabox_order_related_object( $order ) { * Création d'une commande lors du tunnel de vente. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 + * + * @todo mettre la langue de l'user API pour la génération du doc * * @param stdClass $proposal Les données d'une proposition commerciale. * @@ -394,6 +396,7 @@ public function create_order( $proposal ) { Request_Util::put( 'documents/builddoc', array( 'modulepart' => 'order', 'original_file' => $doli_order->ref . '/' . $doli_order->ref . '.pdf', + 'langcode' => 'fr_FR', ) ); $current_user = wp_get_current_user(); diff --git a/modules/dolibarr/doli-sync/action/class-doli-sync-action.php b/modules/dolibarr/doli-sync/action/class-doli-sync-action.php index a4da5bc..b31e932 100644 --- a/modules/dolibarr/doli-sync/action/class-doli-sync-action.php +++ b/modules/dolibarr/doli-sync/action/class-doli-sync-action.php @@ -111,7 +111,7 @@ public function sync() { $last = ( ! empty( $_POST['last'] ) && '1' == $_POST['last'] ) ? true : false; $sync_info = Doli_Sync::g()->get_sync_infos( $type ); - + // @todo: Do Array http_build_query. $doli_entries = Request_Util::get( $sync_info['endpoint'] . '?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Sync::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Sync::g()->limit_entries_by_request ); @@ -177,17 +177,17 @@ public function sync_entry() { $entry_id = ! empty( $_POST['entry_id'] ) ? (int) $_POST['entry_id'] : 0; $type = ! empty( $_POST['type'] ) ? sanitize_text_field( $_POST['type'] ) : ''; - $sync_status = Doli_Sync::g()->sync( $wp_id, $entry_id, $type ); + $sync_status = Doli_Sync::g()->sync( $wp_id, $entry_id, $type ); $sync_info = Doli_Sync::g()->get_sync_infos( $type ); - + ob_start(); // @todo: Add display_item for contact. - if ( $type !== 'wps-user' ) { + if ( $type !== 'wps-user' || $type !== 'wps-product-cat' ) { $sync_info['wp_class']::g()->display_item( $sync_status['wp_object'], true, $dolibarr_option['dolibarr_url'] ); } - + $item_view = ob_get_clean(); - + wp_send_json_success( array( 'id' => $wp_id, 'namespace' => 'wpshop', @@ -224,7 +224,7 @@ public function add_sync_header( $type ) { * @param boolean $sync_status Le statut de la synchronisation. */ public function add_sync_item( $object, $sync_status ) { - if ( Settings::g()->dolibarr_is_active() && in_array( $object->data['type'], array( 'wps-product', 'wps-third-party', 'wps-proposal' ) ) ) { + if ( Settings::g()->dolibarr_is_active() && in_array( $object->data['type'], array( 'wps-product', 'wps-third-party', 'wps-proposal','wps-product-cat' ) ) ) { Doli_Sync::g()->display_sync_status( $object, $object->data['type'], $sync_status ); } } @@ -240,14 +240,14 @@ public function check_sync_status() { $wp_id = ! empty( $_POST['wp_id'] ) ? (int) $_POST['wp_id'] : 0; $type = ! empty( $_POST['type'] ) ? sanitize_text_field( $_POST['type'] ) : ''; - if ( empty( $wp_id ) && ! in_array( $type, array( 'wps-product', 'wps-third-party', 'wps-proposals', 'wps-user' ) ) ) { + if ( empty( $wp_id ) && ! in_array( $type, array( 'wps-product', 'wps-third-party', 'wps-proposals', 'wps-user', 'wps-product-cat' ) ) ) { wp_send_json_error(); } - + $sync_info = Doli_Sync::g()->get_sync_infos( $type ); - + $object = $sync_info['wp_class']::g()->get( array( 'id' => $wp_id ), true ); - + ob_start(); $status = Doli_Sync::g()->display_sync_status( $object, $type ); $view = ob_get_clean(); diff --git a/modules/dolibarr/doli-sync/asset/js/doli-sync.backend.js b/modules/dolibarr/doli-sync/asset/js/doli-sync.backend.js index 6509435..0e31b03 100644 --- a/modules/dolibarr/doli-sync/asset/js/doli-sync.backend.js +++ b/modules/dolibarr/doli-sync/asset/js/doli-sync.backend.js @@ -117,7 +117,6 @@ window.eoxiaJS.wpshop.doliSync.syncEntrySuccess = function( triggeredElement, re var modal = jQuery( '.wpeo-modal.modal-active' ); // If it is associate action. - if ( modal.length > 0 ) { modal.addClass( 'modal-force-display' ); modal.find( '.modal-content' ).html( response.data.modal_view ); diff --git a/modules/dolibarr/doli-sync/class/class-doli-sync.php b/modules/dolibarr/doli-sync/class/class-doli-sync.php index 8ca180a..cc69422 100644 --- a/modules/dolibarr/doli-sync/class/class-doli-sync.php +++ b/modules/dolibarr/doli-sync/class/class-doli-sync.php @@ -80,6 +80,16 @@ protected function construct() { 'doli_class' => '\wpshop\\Doli_Proposals', 'doli_type' => 'propal', ), + 'wps-product-cat' => array( + 'title' => __( 'Categories', 'wpshop' ), + 'action' => 'sync_categories', + 'nonce' => 'sync_categories', + 'endpoint' => 'categories', + 'associate_endpoint' => 'Category', + 'wp_class' => '\wpshop\\Doli_Category', + 'doli_class' => '\wpshop\\Doli_Category', + 'doli_type' => 'category', + ), ); } @@ -173,7 +183,7 @@ public function sync( $wp_id, $entry_id, $type ) { $doli_product = Request_Util::get( 'products/' . $entry_id ); $wp_product = Product::g()->get( array( 'id' => $wp_id ), true ); $wp_product = Doli_Products::g()->doli_to_wp( $doli_product, $wp_product ); - + $messages[] = sprintf( __( 'Erase data for the product %s with the dolibarr data', 'wpshop' ), $wp_product->data['title'] ); $wp_object = $wp_product; @@ -183,13 +193,20 @@ public function sync( $wp_id, $entry_id, $type ) { $wp_proposal = Proposals::g()->get( array( 'id' => $wp_id ), true ); Doli_Proposals::g()->doli_to_wp( $doli_proposal, $wp_proposal ); - + $wp_object = $wp_proposal; break; + case 'wps-product-cat': + $doli_category = Request_Util::get( 'categories/' . $entry_id ); + $wp_category = Doli_Category::g()->get( array( 'id' => $wp_id ), true ); + $wp_category = Doli_Category::g()->doli_to_wp( $doli_category, $wp_category); + + $wp_object = $wp_category; + break; default: break; } - + return array( 'messages' => $messages, 'wp_error' => $wp_error, @@ -211,26 +228,34 @@ public function sync( $wp_id, $entry_id, $type ) { public function check_status( $id, $type ) { $external_id = 0; $sha_256 = 0; + global $wpdb; if ( $type == 'wps-user' ) { $external_id = get_user_meta( $id, '_external_id', true ); $sha_256 = get_user_meta( $id, '_sync_sha_256', true ); + } elseif ( $type == 'wps-product-cat' ) { + $external_id = get_term_meta( $id, '_external_id', true ); + $sha_256 = get_term_meta( $id, '_sync_sha_256', true ); } else { $external_id = get_post_meta( $id, '_external_id', true ); $sha_256 = get_post_meta( $id, '_sync_sha_256', true ); + $sha_documents = get_post_meta( $id, 'sha256_documents', true ); } - + $sync_info = $this->sync_infos[ $type ]; - + $response = Request_Util::get( $sync_info['endpoint'] . '/' . $external_id ); - + // Dolibarr return false when object is not found. if ( ! $response ) { // @todo: Doublon if ( $type == 'wps-user' ) { delete_user_meta( $id, '_external_id' ); delete_user_meta( $id, '_sync_sha_256' ); - } else { + } elseif ( $type == 'wps-product-cat' ) { + delete_term_meta( $id, '_external_id' ); + delete_term_meta( $id, '_sync_sha_256' ); + } else { delete_post_meta( $id, '_external_id' ); delete_post_meta( $id, '_sync_sha_256' ); } @@ -241,13 +266,16 @@ public function check_status( $id, $type ) { 'status_message' => 'Dolibarr Object: #' . $external_id . ' not exist. Automatically delete external_id.', ); } - + // Dolibarr Object is not linked to this WP Object. if ( $response->array_options->options__wps_id != $id ) { // @todo: Doublon if ( $type == 'wps-user' ) { delete_user_meta( $id, '_external_id' ); delete_user_meta( $id, '_sync_sha_256' ); + } elseif ( $type == 'wps-product-cat' ) { + delete_term_meta( $id, '_external_id' ); + delete_term_meta( $id, '_sync_sha_256' ); } else { delete_post_meta( $id, '_external_id' ); delete_post_meta( $id, '_sync_sha_256' ); @@ -259,11 +287,10 @@ public function check_status( $id, $type ) { 'status_message' => 'Dolibarr Object is not linked to this WP Object.', ); } - + $response = apply_filters( 'doli_build_sha_' . $type, $response, $id ); - // WP Object is not equal Dolibarr Object. - if ($response->sha !== $sha_256) { + if ( $response->sha !== $sha_256 || $response->sha_documents != $sha_documents ) { return array( 'status' => true, 'status_code' => '0x3', @@ -291,7 +318,7 @@ public function check_status( $id, $type ) { * @return string Le statut de la synchronisation. */ public function display_sync_status( $object, $type, $load_erp_status = true ) - { + { $data_view = array( 'object' => $object, 'type' => $type, @@ -300,24 +327,24 @@ public function display_sync_status( $object, $type, $load_erp_status = true ) 'message_tooltip' => __( 'Looking for sync status', 'wpshop' ), 'can_sync' => false, ); - + if ( ! $load_erp_status ) { View_Util::exec('wpshop', 'doli-sync', 'sync-item', $data_view); return; } if ( empty($object->data['external_id'] ) ) { - $data_view['status_color'] = 'red'; + $data_view['status_color'] = 'none'; $data_view['message_tooltip'] = __('No associated to an ERP Entity', 'wpshop'); View_Util::exec('wpshop', 'doli-sync', 'sync-item', $data_view); return; } - + $response = Doli_Sync::g()->check_status($object->data['id'], $type); - + if ( ! $response || ! $response['status'] ) { - $data_view['status_color'] = 'red'; + $data_view['status_color'] = 'none'; } else { // @todo: Do Const for status_code. switch ($response['status_code']) { @@ -326,22 +353,22 @@ public function display_sync_status( $object, $type, $load_erp_status = true ) $data_view['can_sync'] = true; break; case '0x1': - $data_view['status_color'] = 'red'; + $data_view['status_color'] = 'none'; break; case '0x2': - $data_view['status_color'] = 'red'; + $data_view['status_color'] = 'none'; $object->data['external_id'] = ''; break; case '0x3': - $data_view['status_color'] = 'orange'; + $data_view['status_color'] = 'red'; $data_view['can_sync'] = true; break; } } - + $data_view['message_tooltip'] = isset ( $response['status_message'] ) ? $response['status_message'] : __( 'Error not defined', 'wpshop' ); View_Util::exec( 'wpshop', 'doli-sync', 'sync-item', $data_view ); - + return $response; } } diff --git a/modules/dolibarr/doli-sync/filter/class-doli-sync-filter.php b/modules/dolibarr/doli-sync/filter/class-doli-sync-filter.php index 4a98038..b65cfeb 100644 --- a/modules/dolibarr/doli-sync/filter/class-doli-sync-filter.php +++ b/modules/dolibarr/doli-sync/filter/class-doli-sync-filter.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -24,13 +24,14 @@ class Doli_Sync_Filter extends Singleton_Util { * Le constructeur. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ protected function construct() { add_filter( 'wps_countries', array( $this, 'doli_countries' ) ); add_filter( 'doli_build_sha_wps-product', array( $this, 'build_sha_product' ), 10, 2 ); add_filter( 'doli_build_sha_wps-third-party', array( $this, 'build_sha_third_party' ), 10, 2 ); + add_filter( 'doli_build_sha_wps-product-cat', array( $this, 'build_sha_categories' ), 10, 2 ); } /** @@ -78,7 +79,7 @@ public function doli_countries( $countries ) { * La construction du SHA256 d'une synchronisation d'un produit. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 * * @param Product $response Les données d'un produit. * @param integer $wp_id L'id d'un produit WordPress. @@ -103,6 +104,15 @@ public function build_sha_product( $response, $wp_id ) { $data_sha['status'] = 'draft'; } + $doli_documents = Request_Util::get( 'documents?modulepart=product&id=' . $response->id ); + $doli_documents_array = json_decode( json_encode( $doli_documents ), true ); + $data_sha_array = array(); + if ( ! empty( $doli_documents_array ) ) { + foreach ($doli_documents_array as $doli_documents_array_single) { + $data_sha_array[] = implode(',', $doli_documents_array_single); + } + $response->sha_documents = hash('sha256', implode(',', $data_sha_array)); + } $response->sha = hash( 'sha256', implode( ',', $data_sha ) ); return $response; @@ -137,6 +147,30 @@ public function build_sha_third_party( $response, $wp_id ) { return $response; } + + /** + * La construction du SHA256 d'une synchronisation d'une catégorie. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param Doli_Category $response Les données d'une catégorie. + * @param integer $wp_id L'id d'un tier WordPress. + * + * @return Doli_Category Les données d'un catégorie avec le SHA256. + */ + public function build_sha_categories( $response, $wp_id ) { + $data_sha = array(); + + $data_sha['doli_id'] = (int) $response->id; + $data_sha['wp_id'] = $wp_id; + $data_sha['name'] = $response->label; + $data_sha['slug'] = $response->array_options->options__wps_slug; + + $response->sha = hash( 'sha256', implode( ',', $data_sha ) ); + + return $response; + } } Doli_Sync_Filter::g(); diff --git a/modules/dolibarr/doli-sync/view/sync-item.view.php b/modules/dolibarr/doli-sync/view/sync-item.view.php index 100717b..2e80258 100644 --- a/modules/dolibarr/doli-sync/view/sync-item.view.php +++ b/modules/dolibarr/doli-sync/view/sync-item.view.php @@ -22,12 +22,11 @@ * @var string $type Le type d'entité. * @var string $status_color La couleur du statut d'une synchronisation. * @var string $message_tooltip Le message de la tooltip. - */ + */ ?> -
      -
    • WP : data['id'] ); ?>
    • +
    • WP : data['id'] ); ?>
    • Doli : data['external_id'] ) ? esc_html( $object->data['external_id'] ) : "N/A"; ?>
    dolibarr_is_active() ) { add_submenu_page( 'wpshop', __( 'Add', 'wpshop' ), __( 'Add', 'wpshop' ), 'manage_options', 'post-new.php?post_type=wps-product' ); } - add_submenu_page( 'wpshop', __( 'Products Category', 'wpshop' ), __( 'Products Category', 'wpshop' ), 'manage_options', 'edit-tags.php?taxonomy=wps-product-cat&post_type=wps-product' ); - add_action( 'load-' . $hook, array( $this, 'callback_add_screen_option' ) ); } /** @@ -89,7 +87,7 @@ public function callback_add_menu_page() { $prev_url .= '&s=' . $s; $next_url .= '&s=' . $s; } - + View_Util::exec( 'wpshop', 'products', 'main', array( 'number_page' => $number_page, 'current_page' => $current_page, diff --git a/modules/products/class/class-product.php b/modules/products/class/class-product.php index 39e5b6c..b6c7f6f 100644 --- a/modules/products/class/class-product.php +++ b/modules/products/class/class-product.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -180,10 +180,10 @@ public function display_item( $product, $sync_status, $doli_url = '' ) { } /** - * Ajoute une metabox pour configurer le produit. + * Ajoute des metabox pour configurer le produit. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ public function callback_register_meta_box() { add_meta_box( @@ -192,6 +192,22 @@ public function callback_register_meta_box() { array( $this, 'callback_add_meta_box' ), 'wps-product' ); + + add_meta_box( + 'wps_product_gallery', + __( 'Product Gallery', 'wpshop'), + array( $this, 'callback_add_meta_box_gallery' ), + 'wps-product', + 'side' + ); + + add_meta_box( + 'wps_product_document', + __( 'Product Document', 'wpshop'), + array( $this, 'callback_add_meta_box_document' ), + 'wps-product', + 'side' + ); } /** @@ -231,6 +247,147 @@ public function callback_add_meta_box( $post ) { ) ); } + /** + * La vue de la metabox pour configurer la galerie d'image du produit. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param WP_Post $post Le produit. + */ + public function callback_add_meta_box_gallery( $post ) { + $product = $this->get( array( 'id' => $post->ID ), true ); + + if ( empty( $product ) ) { + $product = $this->get( array( 'schema' => true ), true ); + } + + if ( ! empty( $product->data['fk_product_parent'] ) ) { + $parent_post = get_post( Doli_Products::g()->get_wp_id_by_doli_id( $product->data['fk_product_parent'] ) ); + + $product->data['parent_post'] = $parent_post; + } + + // Get Dolibarr documents. + $doli_documents = Request_Util::get( 'documents?modulepart=product&id=' . $product->data['external_id'] ); + $wp_documents = Doli_Documents::g()->convert_to_wp_documents_format( $doli_documents ); + + $mine_type = 'image'; + $wp_upload_dir = wp_upload_dir(); + + // create the sha256 for documents. + $sha256 = get_post_meta( $post->ID, 'sha256_documents', true ); + $data_sha = Doli_Documents::g()->build_sha_documents( $post->ID, $doli_documents ); + + if ( $sha256 != $data_sha ) { + + $attachments = Doli_Documents::g()->get_attachments( $product, $mine_type ); + + if ( ! empty( $attachments ) ) { + foreach ( $attachments as $attachment ) { + wp_delete_attachment( $attachment['ID'] ); + } + } + + Doli_Documents::g()->create_attachments( $wp_documents, $product , $mine_type ); + } + + $attachments = Doli_Documents::g()->get_attachments( $product, $mine_type ); + $attachments = Doli_Documents::g()->add_metadata_attachements( $attachments ); + + $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); + + $dolibarr_product_document = $dolibarr_option['dolibarr_product_document']; + $dolibarr_url = $dolibarr_option['dolibarr_url']; + + $upload_link = esc_url( get_upload_iframe_src( 'image', $product->data['id'] ) ); + + View_Util::exec( + 'wpshop', + 'products', + 'metabox/gallery', + array( + 'id' => ! empty( $product->data['id'] ) ? $product->data['id'] : $post->ID, + 'wp_upload_dir' => $wp_upload_dir, + 'upload_link' => $upload_link, + 'attachments' => ! empty( $attachments ) ? $attachments : '', + 'product' => $product, + 'dolibarr_url' => $dolibarr_url, + 'dolibarr_product_document' => $dolibarr_product_document, + ) + ); + } + + /** + * La vue de la metabox pour configurer les documents du produit. + * + * @since 2.1.0 + * @version 2.1.0 + * + * @param WP_Post $post Le produit. + */ + public function callback_add_meta_box_document( $post ) { + $product = $this->get( array( 'id' => $post->ID ), true ); + + if ( empty( $product ) ) { + $product = $this->get( array( 'schema' => true ), true ); + } + + if ( ! empty( $product->data['fk_product_parent'] ) ) { + $parent_post = get_post( Doli_Products::g()->get_wp_id_by_doli_id( $product->data['fk_product_parent'] ) ); + + $product->data['parent_post'] = $parent_post; + } + + // Get Dolibarr documents. + $doli_documents = Request_Util::get( 'documents?modulepart=product&id=' . $product->data['external_id'] ); + $wp_documents = Doli_Documents::g()->convert_to_wp_documents_format( $doli_documents ); + + $mine_type = 'application'; + $wp_upload_dir = wp_upload_dir(); + + // create the sha256 for documents. + $sha256 = get_post_meta( $post->ID, 'sha256_documents', true ); + $data_sha = Doli_Documents::g()->build_sha_documents( $post->ID, $doli_documents ); + + if ( $sha256 == $data_sha ) { + + $attachments = Doli_Documents::g()->get_attachments( $product, $mine_type ); + + if ( ! empty( $attachments ) ) { + foreach ( $attachments as $attachment ) { + wp_delete_attachment( $attachment['ID'] ); + } + } + + Doli_Documents::g()->create_attachments( $wp_documents, $product , $mine_type ); + } + + $attachments = Doli_Documents::g()->get_attachments( $product, $mine_type ); + $attachments = Doli_Documents::g()->add_metadata_attachements( $attachments ); + + $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); + + $dolibarr_url = $dolibarr_option['dolibarr_url']; + $dolibarr_product_document = $dolibarr_option['dolibarr_product_document']; + $upload_link = esc_url( get_upload_iframe_src( 'image', $product->data['id'] ) ); + + View_Util::exec( + 'wpshop', + 'products', + 'metabox/document', + array( + 'id' => ! empty( $product->data['id'] ) ? $product->data['id'] : $post->ID, + 'wp_upload_dir' => $wp_upload_dir, + 'upload_link' => $upload_link, + 'attachments' => ! empty( $attachments ) ? $attachments : '', + 'product' => $product, + 'dolibarr_url' => $dolibarr_url, + 'dolibarr_product_document' => $dolibarr_product_document, + ) + ); + } + /** * Fonction de recherche. * diff --git a/modules/products/filter/class-product-filter.php b/modules/products/filter/class-product-filter.php index 7782544..d3eabeb 100644 --- a/modules/products/filter/class-product-filter.php +++ b/modules/products/filter/class-product-filter.php @@ -124,7 +124,7 @@ public function callback_register_post_type_args( $args ) { */ public function callback_taxonomy( $args ) { $labels = array( - 'name' => _x( 'Products category', 'taxonomy general name', 'wpshop' ), + 'name' => _x( 'Product category', 'taxonomy general name', 'wpshop' ), 'singular_name' => _x( 'Product category', 'taxonomy singular name', 'wpshop' ), 'search_items' => __( 'Search Products category', 'wpshop' ), 'all_items' => __( 'All Products category', 'wpshop' ), @@ -132,7 +132,7 @@ public function callback_taxonomy( $args ) { 'parent_item_colon' => __( 'Parent Product: category', 'wpshop' ), 'edit_item' => __( 'Edit Product category', 'wpshop' ), 'update_item' => __( 'Update Product category', 'wpshop' ), - 'add_new_item' => __( 'Add New Product category', 'wpshop' ), + 'add_new_item' => __( 'Add with Dolibarr', 'wpshop' ), 'new_item_name' => __( 'New Product categoryName', 'wpshop' ), 'menu_name' => __( 'Product category', 'wpshop' ), ); @@ -145,7 +145,7 @@ public function callback_taxonomy( $args ) { 'show_in_nav_menus' => true, 'query_var' => true, 'rewrite' => array( - 'slug' => __( 'category-product', 'wpshop' ), + 'slug' => __( 'wps-product-cat', 'wpshop' ), ), ); diff --git a/modules/products/view/frontend/wps-product-single.php b/modules/products/view/frontend/wps-product-single.php index 0bfcad2..4d97f09 100644 --- a/modules/products/view/frontend/wps-product-single.php +++ b/modules/products/view/frontend/wps-product-single.php @@ -22,7 +22,8 @@ ?>
    -
    data['price_ttc'] ) ? esc_html( number_format( $product->data['price_ttc'], 2, ',', '' ) ) . ' €' : ''; ?>
    +
    data['price_ht'] ) ? esc_html( number_format( $product->data['price_ht'], 2, ',', '' ) ) . ' € HT' : ''; ?>
    +
    data['price_ttc'] ) ? esc_html( number_format( $product->data['price_ttc'], 2, ',', '' ) ) . ' € TTC' : ''; ?>
    post_content, $product ); ?>
    diff --git a/modules/products/view/metabox/document.view.php b/modules/products/view/metabox/document.view.php new file mode 100644 index 0000000..45dc12b --- /dev/null +++ b/modules/products/view/metabox/document.view.php @@ -0,0 +1,53 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +defined( 'ABSPATH' ) || exit; + +/** + * Documentation des variables utilisées dans la vue. + * + * @var Product $product Les données d'un produit. + * @var array $attachments Le tableau contenant toutes les données des documents. + * @var array $attachment Les données d'un document. + * @var array $wp_upload_dir Le tableau contenant les données du répertoire des médias. + * @var string $dolibarr_url L'url de Dolibarr. + * @var string $dolibarr_product_document L'url des documents de Dolibarr. + * @var string $upload_link Le lien vers l'iframe d'ajout d'un média. + */ +?> + +
    + + +

    + dolibarr_is_active() ) : ?> + + + + + + + + +

    + + +
    diff --git a/modules/products/view/metabox/gallery.view.php b/modules/products/view/metabox/gallery.view.php new file mode 100644 index 0000000..08904f4 --- /dev/null +++ b/modules/products/view/metabox/gallery.view.php @@ -0,0 +1,53 @@ + + * @copyright (c) 2011-2020 Eoxia . + * @since 2.1.0 + * @version 2.1.0 + */ + +namespace wpshop; + +defined( 'ABSPATH' ) || exit; + +/** + * Documentation des variables utilisées dans la vue. + * + * @var Product $product Les données d'un produit. + * @var array $attachments Le tableau contenant toutes les données des documents. + * @var array $attachment Les données d'un document. + * @var array $wp_upload_dir Le tableau contenant les données du répertoire des médias. + * @var string $dolibarr_url L'url de Dolibarr. + * @var string $dolibarr_product_document L'url des documents de Dolibarr. + * @var string $upload_link Le lien vers l'iframe d'ajout d'un média. + */ +?> + + diff --git a/modules/settings/action/class-settings-action.php b/modules/settings/action/class-settings-action.php index 5ecfbf2..c030e2d 100644 --- a/modules/settings/action/class-settings-action.php +++ b/modules/settings/action/class-settings-action.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -118,7 +118,7 @@ public function callback_load_tab() { * Met à jour les options général. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ public function callback_update_general_settings() { check_admin_referer( 'callback_update_general_settings' ); @@ -133,15 +133,15 @@ public function callback_update_general_settings() { $thumbnail_size['width'] = ! empty( $thumbnail_size['width'] ) ? (int) $thumbnail_size['width'] : 0; $thumbnail_size['height'] = ! empty( $thumbnail_size['height'] ) ? (int) $thumbnail_size['height'] : 0; $use_quotation = isset( $_POST['use_quotation'] ) && 'on' == $_POST['use_quotation'] ? true : false; + $split_product = isset( $_POST['split_product'] ) && 'on' == $_POST['split_product'] ? true : false; $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); - $dolibarr_option['shop_email'] = $shop_email; - + $dolibarr_option['shop_email'] = $shop_email; $dolibarr_option['thumbnail_size']['width'] = $thumbnail_size['width']; $dolibarr_option['thumbnail_size']['height'] = $thumbnail_size['height']; - - $dolibarr_option['use_quotation'] = $use_quotation; + $dolibarr_option['use_quotation'] = $use_quotation; + $dolibarr_option['split_product'] = $split_product; update_option( 'wps_dolibarr', $dolibarr_option ); diff --git a/modules/settings/class/class-settings.php b/modules/settings/class/class-settings.php index 51bd1e6..a55b980 100644 --- a/modules/settings/class/class-settings.php +++ b/modules/settings/class/class-settings.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -45,7 +45,7 @@ class Settings extends Singleton_Util { * Le constructeur. * * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ protected function construct() { $this->default_settings = array( @@ -59,6 +59,7 @@ protected function construct() { 'height' => 460, ), 'use_quotation' => true, + 'split_product' => true, 'notice' => array( 'error_erp' => true, 'activate_erp' => true, @@ -72,6 +73,7 @@ protected function construct() { //-Liens Produits 'dolibarr_create_product' => 'product/card.php?leftmenu=product&action=create&type=0', 'dolibarr_products_lists' => 'product/list.php?leftmenu=product&type=0', + 'dolibarr_product_document' => 'product/document.php?id=', /**-Liens Services //@todo 'dolibarr_create_service' => 'product/card.php?leftmenu=service&action=create&type=1', //@todo 'dolibarr_services_lists' => 'product/list.php?leftmenu=service&type=1', @@ -285,6 +287,22 @@ public function use_quotation() { return $dolibarr_option['use_quotation']; } + + /** + * Vérifie si la séparation des produits est activé. + * + * @todo a revoir + * + * @since 2.1.0 + * @version 2.1.0 + * + * @return boolean true ou false. + */ + public function split_product() { + $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); + + return $dolibarr_option['split_product']; + } } Settings::g(); diff --git a/modules/settings/view/erp.view.php b/modules/settings/view/erp.view.php index 7e3a5aa..3d3b49f 100644 --- a/modules/settings/view/erp.view.php +++ b/modules/settings/view/erp.view.php @@ -6,7 +6,7 @@ * @author Eoxia * @copyright (c) 2011-2020 Eoxia . * @since 2.0.0 - * @version 2.0.0 + * @version 2.1.0 */ namespace wpshop; @@ -100,6 +100,15 @@
    +
    + + + + +
    + diff --git a/modules/settings/view/general.view.php b/modules/settings/view/general.view.php index d0bae64..dfa1285 100644 --- a/modules/settings/view/general.view.php +++ b/modules/settings/view/general.view.php @@ -57,6 +57,13 @@
    +
    + +
    +
    diff --git a/readme.txt b/readme.txt index 2e02d78..9eed880 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Donate link: https://www.wpshop.fr/ Requires at least: 4.4 Tested up to: 5.5.1 Requires PHP: 7.0 -Stable tag: 2.0.0 +Stable tag: 2.1.0 License: GPLv3 or later License URI: https://spdx.org/licenses/GPL-3.0-or-later.html @@ -65,6 +65,13 @@ Il n'est pas possible de migrer les données vers la version WPShop 2.X.X. == Changelog == += Version 2.1.0 = + += IMPROVEMENT = + +Synchronisation des catégories Dolibarr avec ceux de WordPress. +Synchronisation des médias Dolibarr avec ceux de WordPress. + = Version 2.0.0 = * First Released diff --git a/wpshop.config.json b/wpshop.config.json index 9f1e035..f9b30e9 100644 --- a/wpshop.config.json +++ b/wpshop.config.json @@ -2,7 +2,7 @@ "name": "WPshop", "slug": "wpshop", "since": "2.0.0", - "version": "2.0.0", + "version": "2.1.0", "description": "L'application WPshop 2", "externals": [], "modules": [ @@ -39,13 +39,15 @@ "modules/dolibarr/doli-statut/doli-statut.config.json", "modules/dolibarr/doli-proposals/doli-proposals.config.json", "modules/dolibarr/doli-order/doli-order.config.json", + "modules/dolibarr/doli-categories/doli-categories.config.json", "modules/dolibarr/doli-third-parties/doli-third-parties.config.json", "modules/dolibarr/doli-user/doli-user.config.json", "modules/dolibarr/doli-invoice/doli-invoice.config.json", "modules/dolibarr/doli-payment/doli-payment.config.json", "modules/dolibarr/doli-products/doli-products.config.json", "modules/dolibarr/doli-sync/doli-sync.config.json", - "modules/dolibarr/doli-associate/doli-associate.config.json" + "modules/dolibarr/doli-associate/doli-associate.config.json", + "modules/dolibarr/doli-documents/doli-documents.config.json" ], "use_global_sync": true } diff --git a/wpshop.php b/wpshop.php index 9f59360..35c6efb 100644 --- a/wpshop.php +++ b/wpshop.php @@ -3,7 +3,7 @@ * Plugin Name: WPshop 2 * Plugin URI: https://wpshop.fr/ * Description: Simple, fast, efficient it will transform your WordPress into an internet sales site - * Version: 2.0.0 + * Version: 2.1.0 * Author: Eoxia * Author URI: http://www.eoxia.com/ * License: GPLv3 @@ -30,7 +30,7 @@ } // Include composer component. -require_once 'vendor/autoload.php'; +// require_once 'vendor/autoload.php'; // Boot your plugin. Init_Util::g()->exec( PLUGIN_WPSHOP_PATH, basename( __FILE__, '.php' ) );