From cefb5f6c6b1876b21915f4e3aa4dfa2528622a73 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Tue, 3 May 2016 14:20:42 +0200 Subject: [PATCH] NEW hook in expedition card --- htdocs/expedition/card.php | 132 ++++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 62 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c52c72ff509..b4b82be7726 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1736,72 +1736,80 @@ else if ($id || $ref) { print '
'; - if ($object->statut == 0 && $num_prod > 0) + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + // modified by hook + if (empty($reshook)) { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate))) - { - print ''.$langs->trans("Validate").''; - } - else - { - print ''.$langs->trans("Validate").''; - } - } - // TODO add alternative status - // 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order) - if ($object->statut == 2 && $object->billed && $user->rights->expedition->creer) - { - print ''.$langs->trans("ReOpen").''; + if ($object->statut == 0 && $num_prod > 0) + { + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->creer)) + || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expedition->shipping_advance->validate))) + { + print ''.$langs->trans("Validate").''; + } + else + { + print ''.$langs->trans("Validate").''; + } + } + + // TODO add alternative status + // 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order) + if ($object->statut == 2 && $object->billed && $user->rights->expedition->creer) + { + print ''.$langs->trans("ReOpen").''; + } + + // Send + if ($object->statut > 0) + { + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) + { + print ''.$langs->trans('SendByMail').''; + } + else print ''.$langs->trans('SendByMail').''; + } + + // Create bill and Close shipment + if (! empty($conf->facture->enabled) && $object->statut > 0) + { + if ($user->rights->facture->creer) + { + print ''.$langs->trans("CreateBill").''; + } + } + + // This is just to generate a delivery receipt + //var_dump($object->linkedObjectsIds['delivery']); + if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0) + { + print ''.$langs->trans("CreateDeliveryOrder").''; + } + // Close + if (! empty($conf->facture->enabled) && $object->statut > 0) + { + if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed) + { + $label="Close"; $paramaction='classifyclosed'; // = Transferred/Received + // Label here should be "Close" or "ClassifyBilled" if we decided to make bill on shipments instead of orders + if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // TODO Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close. + { + $label="ClassifyBilled"; + $paramaction='classifybilled'; + } + print ''.$langs->trans($label).''; + } + } + + if ($user->rights->expedition->supprimer) + { + print ''.$langs->trans("Delete").''; + } + } - // Send - if ($object->statut > 0) - { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expedition->shipping_advance->send) - { - print ''.$langs->trans('SendByMail').''; - } - else print ''.$langs->trans('SendByMail').''; - } - - // Create bill and Close shipment - if (! empty($conf->facture->enabled) && $object->statut > 0) - { - if ($user->rights->facture->creer) - { - print ''.$langs->trans("CreateBill").''; - } - } - - // This is just to generate a delivery receipt - //var_dump($object->linkedObjectsIds['delivery']); - if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0) - { - print ''.$langs->trans("CreateDeliveryOrder").''; - } - // Close - if (! empty($conf->facture->enabled) && $object->statut > 0) - { - if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed) - { - $label="Close"; $paramaction='classifyclosed'; // = Transferred/Received - // Label here should be "Close" or "ClassifyBilled" if we decided to make bill on shipments instead of orders - if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) // TODO Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close. - { - $label="ClassifyBilled"; - $paramaction='classifybilled'; - } - print ''.$langs->trans($label).''; - } - } - - if ($user->rights->expedition->supprimer) - { - print ''.$langs->trans("Delete").''; - } - print '
'; }