Browse Source

Bouton expe ok sur commande

Mathieu Moulin 1 year ago
parent
commit
6930e8c62f
3 changed files with 26 additions and 2 deletions
  1. 1 0
      admin/setup.php
  2. 21 2
      class/actions_mmiworkflow.class.php
  3. 4 0
      langs/fr_FR/mmiworkflow.lang

+ 1 - 0
admin/setup.php

@@ -46,6 +46,7 @@ $arrayofparameters = array(
 	'SHIPPING_PDF_ANTIGASPI'=>array('type'=>'yesno','enabled'=>1), // MMI Hack
 	'MAIN_GENERATE_SHIPMENT_WITH_PICTURE'=>array('type'=>'yesno','enabled'=>1),
 	'MMI_SHIPPING_PDF_MESSAGE'=>array('type'=>'html','enabled'=>1),
+	'MMI_ORDER_SET_EXPE_OK'=>array('type'=>'yesno','enabled'=>1),
 
 	'MMI_INVOICE_DRAFTIFY'=>array('type'=>'yesno', 'enabled'=>1),
 	'MMI_INVOICE_DRAFTIFY_TYPES'=>array('type'=>'string', 'enabled'=>1),

+ 21 - 2
class/actions_mmiworkflow.class.php

@@ -94,15 +94,26 @@ class ActionsMMIWorkflow extends MMI_Actions_1_0
 				}
 			}
 			// Fix bug 1ct Presta & co
-			if ($conf->global->MMI_1CT_FIX) {
+			if (!empty($conf->global->MMI_1CT_FIX)) {
 				$link = '?id='.$object->id.'&action=1ct_fix';
 				echo "<a class='butAction' href='".$link."'>".$langs->trans("MMI1ctFix")."</a>";
 			}
 			// Fix bug TVA Presta & co
-			if ($conf->global->MMI_VAT_TX_FIX) {
+			if (!empty($conf->global->MMI_VAT_TX_FIX)) {
 				$link = '?id='.$object->id.'&action=vat_tx_fix';
 				echo "<a class='butAction' href='".$link."'>".$langs->trans("MMIVATTxFix")."</a>";
 			}
+			// Marquer expédié tout
+			if (!empty($conf->global->MMI_ORDER_SET_EXPE_OK) && (int)$object->status>=Commande::STATUS_VALIDATED && empty(
+				$object->array_options['options_expe_ok'])) {
+				$link = '?id='.$object->id.'&action=expe_ok';
+				// Test si déjà facture
+				// Test si déjà expédition
+				if ($user->rights->expedition->creer)
+					echo "<a class='butAction' href='".$link."'>".$langs->trans("MMISetExpeOK")."</a>";
+				else
+					echo "<span class='butActionRefused classfortooltip' title='".$langs->trans("MMISetExpeOKNotRight")."'>".$langs->trans("MMISetExpeOK")."</span>";
+			}
 		}
 		// Fiche Facture
 		elseif ($this->in_context($parameters, 'invoicecard')) {
@@ -168,6 +179,7 @@ class ActionsMMIWorkflow extends MMI_Actions_1_0
 
 		// Commande
 		if ($this->in_context($parameters, 'ordercard')) {
+			/** @var Commande $object */
 			// 1 click invoice shipping
 			if ($action === '1clic_invoice_shipping') {
 				if ($conf->global->MMI_ORDER_1CLIC_INVOICE_SHIPPING) {
@@ -204,6 +216,13 @@ class ActionsMMIWorkflow extends MMI_Actions_1_0
 					mmi_workflow::order_vat_tx_fix($user, $object);
 				}
 			}
+			// Marquer expe ok
+			if ($action === 'expe_ok') {
+				if ($user->rights->expedition->creer) {
+					$object->array_options['options_expe_ok'] = 1;
+					$ret = $object->update($user);
+				}
+			}
 		}
 		// Invoice
 		elseif ($this->in_context($parameters, 'invoicecard')) {

+ 4 - 0
langs/fr_FR/mmiworkflow.lang

@@ -36,6 +36,7 @@ MMI_ORDER_1CLIC_INVOICE = Facturer automatiquement (par défaut à l'expédition
 MMI_ORDER_1CLIC_INVOICE_DELAY = Décaler la facturation à la livraison
 MMI_ORDER_1CLIC_INVOICE_EMAIL_AUTO = Envoyer automatiquement la facture par email
 MMI_ORDER_1CLIC_INVOICE_EMAIL_AUTO_NOPRO = Ne pas envoyer la facture automatiquement pour les pro
+MMI_ORDER_SET_EXPE_OK = Bouton dans commande "Marquer tous les produits expédiés" (champ supplémentaire)
 MMI_SHIPPING_PDF_MESSAGE = Message à afficher en en-tête des expéditions
 MAIN_GENERATE_SHIPMENT_WITH_PICTURE = Afficher les images sur les PDF des expéditions
 SHIPPING_PDF_HIDE_BATCH = Cacher le numéro de lot dans les expéditions
@@ -88,6 +89,9 @@ MMI1ClickOrderInvoiceShipping = 1 Clic Facture & Expé
 MMI1ClickOrderInvoiceShippingConfirm = Êtes-vous certain de vouloir FActurer et Expédier ?
 MMIInvoiceEmailSend = Envoi express email
 MMI1ctFix = Fix Bug 1ct
+MMI1ctFix = Fix Bug 1ct
+MMISetExpeOK = Marquer "expédié tout"
+MMISetExpeOKNotRight = Vous devez avoir le droit de créer une expédition pour modifier ce statut
 
 #
 # Messages