diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index bbacb30775f1f..8d7f58d37cc35 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -3921,7 +3921,7 @@ parameters: - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue - count: 9 + count: 3 path: ../../htdocs/categories/viewcat.php - @@ -4608,12 +4608,6 @@ parameters: count: 1 path: ../../htdocs/comm/propal/card.php - - - message: '#^Parameter \#4 \$url of function dolGetButtonAction expects array\\}\>\|string, array\{0\: array\{lang\: ''orders'', enabled\: bool, perm\: 0\|1, label\: ''AddOrder'', url\: non\-falsy\-string\}, 1\: array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}\|array\{lang\: ''orders'', enabled\: bool, perm\: bool, label\: ''AddPurchaseOrder'', url\: non\-falsy\-string\}, 2\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}\|array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}, 3\?\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}\|array\{lang\: ''invoice'', enabled\: bool, perm\: 0\|1, label\: ''CreateBill'', url\: non\-falsy\-string\}, 4\?\: array\{lang\: ''invoice'', enabled\: bool, perm\: 0\|1, label\: ''CreateBill'', url\: non\-falsy\-string\}\} given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/comm/propal/card.php - - message: '#^Property CommonObject\:\:\$fk_project \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -5028,12 +5022,6 @@ parameters: count: 1 path: ../../htdocs/commande/card.php - - - message: '#^Parameter \#4 \$url of function dolGetButtonAction expects array\\}\>\|string, array\{0\: array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}, 1\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}, 2\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\|array\{lang\: ''sendings'', enabled\: bool, perm\: 0\|1, label\: ''CreateShipment'', url\: non\-falsy\-string\}, 3\?\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\}\|array\{0\: array\{lang\: ''orders'', enabled\: bool, perm\: bool, label\: ''AddPurchaseOrder'', url\: non\-falsy\-string\}, 1\: array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}, 2\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}, 3\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\|array\{lang\: ''sendings'', enabled\: bool, perm\: 0\|1, label\: ''CreateShipment'', url\: non\-falsy\-string\}, 4\?\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\} given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/commande/card.php - - message: '#^Result of && is always false\.$#' identifier: booleanAnd.alwaysFalse @@ -31884,30 +31872,6 @@ parameters: count: 1 path: ../../htdocs/public/test/test_arrays.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/public/test/test_badges.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_badges.php - - - - message: '#^Parameter \#7 \$params of function dolGetButtonAction expects array\{confirm\?\: array\{url\?\: string, title\?\: string, content\?\: string, action\-btn\-label\?\: string, cancel\-btn\-label\?\: string, modal\?\: bool\}, attr\?\: array\, areDropdownButtons\?\: bool, backtopage\?\: string, lang\?\: string, enabled\?\: bool, perm\?\: int\<0, 1\>, label\?\: string, \.\.\.\}, array\{confirm\: true\} given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/public/test/test_buttons.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_buttons.php - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' identifier: variable.undefined @@ -31920,18 +31884,6 @@ parameters: count: 1 path: ../../htdocs/public/test/test_exec.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/test/test_forms.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_forms.php - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 5a18f127c5a44..4ff525e6fc73d 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -599,6 +599,7 @@ if ($type == Categorie::TYPE_CUSTOMER) { if ($user->hasRight("societe", "read")) { $permission = $user->hasRight('societe', 'creer'); + $showclassifyform = $user->hasRight('societe', 'creer'); $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($socs < 0) { @@ -624,7 +625,6 @@ // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -679,6 +679,7 @@ if ($type == Categorie::TYPE_SUPPLIER) { if ($user->hasRight("fournisseur", "read")) { $permission = $user->hasRight('societe', 'creer'); + $showclassifyform = $user->hasRight('societe', 'creer'); $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); @@ -705,7 +706,6 @@ // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -763,6 +763,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $permission = $user->hasRight('adherent', 'creer'); + $showclassifyform = $user->hasRight('adherent', 'creer'); $members = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($members < 0) { @@ -788,7 +789,6 @@ // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '\n"; print ''; + // Date sending + print ''; + print '\n"; + print ''; + // Note Public print ''; print '
'; @@ -1015,8 +1015,8 @@ if ($user->hasRight("project", "read")) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - $permission = ($user->hasRight('projet', 'creer') == 1); - $showclassifyform = ($user->hasRight('projet', 'creer') == 1); + $permission = $user->hasRight('projet', 'creer'); + $showclassifyform = $user->hasRight('projet', 'creer'); $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($objects < 0) { @@ -1246,6 +1246,7 @@ if ($type == Categorie::TYPE_TICKET) { if ($user->hasRight("ticket", "read")) { $permission = $user->hasRight('categorie', 'creer'); + $showclassifyform = $user->hasRight('categorie', 'creer'); $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($tickets < 0) { @@ -1271,7 +1272,6 @@ // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 19d4200b5c149..10b01316bf09a 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -137,10 +137,10 @@ $usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('propal', 'propal_advance', 'send'))); $usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); -$usercancreateorder = $user->hasRight('commande', 'creer'); -$usercancreateinvoice = $user->hasRight('facture', 'creer'); -$usercancreatecontract = $user->hasRight('contrat', 'creer'); -$usercancreateintervention = $user->hasRight('ficheinter', 'creer'); +$usercancreateorder = ($user->hasRight('commande', 'creer') == 1); +$usercancreateinvoice = ($user->hasRight('facture', 'creer') == 1); +$usercancreatecontract = ($user->hasRight('contrat', 'creer') == 1); +$usercancreateintervention = ($user->hasRight('ficheinter', 'creer') == 1); $usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php @@ -754,7 +754,7 @@ } elseif (GETPOSTINT('statut') == $object::STATUS_SIGNED || GETPOSTINT('statut') == $object::STATUS_NOTSIGNED) { $locationTarget = ''; // prevent browser refresh from closing proposal several times - if ($object->statut == $object::STATUS_VALIDATED || (getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') && $object->statut == $object::STATUS_DRAFT)) { + if ($object->status == $object::STATUS_VALIDATED || (getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') && $object->status == $object::STATUS_DRAFT)) { $db->begin(); $oldstatus = $object->status; @@ -833,7 +833,7 @@ } elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) { // Reopen proposal // prevent browser refresh from reopening proposal several times - if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED || $object->statut == Propal::STATUS_CANCELED) { + if ($object->status == Propal::STATUS_SIGNED || $object->status == Propal::STATUS_NOTSIGNED || $object->status == Propal::STATUS_BILLED || $object->status == Propal::STATUS_CANCELED) { $db->begin(); $newstatus = (getDolGlobalInt('PROPAL_SKIP_ACCEPT_REFUSE') ? Propal::STATUS_DRAFT : Propal::STATUS_VALIDATED); @@ -852,7 +852,7 @@ $db->rollback(); } } - } elseif ($action == 'import_lines_from_object' && $usercancreate && $object->statut == Propal::STATUS_DRAFT) { + } elseif ($action == 'import_lines_from_object' && $usercancreate && $object->status == Propal::STATUS_DRAFT) { // add lines from objectlinked $fromElement = GETPOST('fromelement'); $fromElementid = GETPOST('fromelementid'); @@ -2663,7 +2663,7 @@ $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); - $caneditfield = ($object->statut != Propal::STATUS_SIGNED && $object->statut != Propal::STATUS_BILLED); + $caneditfield = ($object->status != Propal::STATUS_SIGNED && $object->status != Propal::STATUS_BILLED); $thirdparty = $soc; $discount_type = 0; @@ -2683,7 +2683,7 @@ // } // print '
'; - $editenable = $usercancreate && $caneditfield && $object->statut == Propal::STATUS_DRAFT; + $editenable = $usercancreate && $caneditfield && $object->status == Propal::STATUS_DRAFT; print $form->editfieldkey("DatePropal", 'date', '', $object, $editenable); print '
'; if ($action == 'editdate' && $usercancreate && $caneditfield) { @@ -2725,7 +2725,7 @@ } else { if (!empty($object->fin_validite)) { print dol_print_date($object->fin_validite, 'day'); - if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) { + if ($object->status == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) { print img_warning($langs->trans("Late")); } } else { @@ -3038,12 +3038,12 @@ '; - if (!empty($conf->use_javascript_ajax) && $object->statut == Propal::STATUS_DRAFT) { + if (!empty($conf->use_javascript_ajax) && $object->status == Propal::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } print '
'; - if (!empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { + if (!empty($object->lines) || ($object->status == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { print ''; } @@ -3052,7 +3052,7 @@ } // Form to add new line - if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { + if ($object->status == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { if ($action != 'editline') { $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -3068,7 +3068,7 @@ } } - if (!empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { + if (!empty($object->lines) || ($object->status == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { print '
'; } print '
'; @@ -3093,8 +3093,8 @@ if (empty($reshook)) { if ($action != 'editline') { // Validate - if (($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) - || ($object->statut == Propal::STATUS_DRAFT && getDolGlobalString('PROPAL_ENABLE_NEGATIVE') && count($object->lines) > 0)) { + if (($object->status == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) + || ($object->status == Propal::STATUS_DRAFT && getDolGlobalString('PROPAL_ENABLE_NEGATIVE') && count($object->lines) > 0)) { if ($usercanvalidate) { print ''.(!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') ? $langs->trans('Validate') : $langs->trans('ValidateAndSign')).''; } else { @@ -3107,19 +3107,19 @@ print '' . $langs->trans("AddAction") . ''; }*/ // Edit - if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) { + if ($object->status == Propal::STATUS_VALIDATED && $usercancreate) { print ''.$langs->trans('Modify').''; } // ReOpen - if (((getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && $object->statut == Propal::STATUS_NOTSIGNED) || (!getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED || $object->statut == Propal::STATUS_CANCELED))) && $usercanclose) { + if (((getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && $object->status == Propal::STATUS_NOTSIGNED) || (!getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && ($object->status == Propal::STATUS_SIGNED || $object->status == Propal::STATUS_NOTSIGNED || $object->status == Propal::STATUS_BILLED || $object->status == Propal::STATUS_CANCELED))) && $usercanclose) { print ''.$langs->trans('ReOpen').''; } // Send if (empty($user->socid)) { - if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || getDolGlobalString('PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS')) { + if ($object->status == Propal::STATUS_VALIDATED || $object->status == Propal::STATUS_SIGNED || getDolGlobalString('PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS')) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '', $usercansend); } } @@ -3127,8 +3127,14 @@ $arrayforbutaction = array(); // Create a sale order - $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => (isModEnabled('order') && $object->statut == Propal::STATUS_SIGNED), 'perm' => $usercancreateorder, 'label' => 'AddOrder', 'url' => '/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if (isModEnabled('order') && $object->statut == Propal::STATUS_SIGNED) { + $arrayforbutaction[] = array( + 'lang' => 'orders', + 'enabled' => (isModEnabled('order') && $object->status == Propal::STATUS_SIGNED), + 'perm' => $usercancreateorder, + 'label' => 'AddOrder', + 'url' => '/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if (isModEnabled('order') && $object->status == Propal::STATUS_SIGNED) { if ($usercancreateorder) { print ''.$langs->trans("AddOrder").''; } @@ -3136,8 +3142,14 @@ // Create a purchase order if (getDolGlobalString('WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL')) { - $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => ($object->statut == Propal::STATUS_SIGNED && isModEnabled("supplier_order")), 'perm' => $usercancreatepurchaseorder, 'label' => 'AddPurchaseOrder', 'url' => '/fourn/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if ($object->statut == Propal::STATUS_SIGNED && isModEnabled("supplier_order")) { + $arrayforbutaction[] = array( + 'lang' => 'orders', + 'enabled' => ($object->status == Propal::STATUS_SIGNED && isModEnabled("supplier_order")), + 'perm' => $usercancreatepurchaseorder, + 'label' => 'AddPurchaseOrder', + 'url' => '/fourn/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if ($object->status == Propal::STATUS_SIGNED && isModEnabled("supplier_order")) { if ($usercancreatepurchaseorder) { print ''.$langs->trans("AddPurchaseOrder").''; } @@ -3145,8 +3157,14 @@ } // Create an intervention - $arrayforbutaction[] = array('lang' => 'interventions', 'enabled' => (isModEnabled("service") && isModEnabled('intervention') && $object->statut == Propal::STATUS_SIGNED), 'perm' => $usercancreateintervention, 'label' => 'AddIntervention', 'url' => '/fichinter/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if (isModEnabled("service") && isModEnabled('intervention') && $object->statut == Propal::STATUS_SIGNED) { + $arrayforbutaction[] = array( + 'lang' => 'interventions', + 'enabled' => (isModEnabled("service") && isModEnabled('intervention') && $object->status == Propal::STATUS_SIGNED), + 'perm' => $usercancreateintervention, + 'label' => 'AddIntervention', + 'url' => '/fichinter/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if (isModEnabled("service") && isModEnabled('intervention') && $object->status == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); print ''.$langs->trans("AddIntervention").''; @@ -3154,8 +3172,14 @@ }*/ // Create contract - $arrayforbutaction[] = array('lang' => 'contracts', 'enabled' => (isModEnabled('contract') && $object->statut == Propal::STATUS_SIGNED), 'perm' => $usercancreatecontract, 'label' => 'AddContract', 'url' => '/contrat/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if (isModEnabled('contract') && $object->statut == Propal::STATUS_SIGNED) { + $arrayforbutaction[] = array( + 'lang' => 'contracts', + 'enabled' => (isModEnabled('contract') && $object->status == Propal::STATUS_SIGNED), + 'perm' => $usercancreatecontract, + 'label' => 'AddContract', + 'url' => '/contrat/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if (isModEnabled('contract') && $object->status == Propal::STATUS_SIGNED) { $langs->load("contracts"); if ($usercancreatecontract) { @@ -3164,16 +3188,22 @@ }*/ // Create an invoice and classify billed - if ($object->statut == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { - $arrayforbutaction[] = array('lang' => 'invoice', 'enabled' => isModEnabled('invoice'), 'perm' => $usercancreateinvoice, 'label' => 'CreateBill', 'url' => '/compta/facture/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); + if ($object->status == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { + $arrayforbutaction[] = [ + 'lang' => 'invoice', + 'enabled' => isModEnabled('invoice'), + 'perm' => $usercancreateinvoice, + 'label' => 'CreateBill', + 'url' => '/compta/facture/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid), + ]; /*if (isModEnabled('invoice') && $usercancreateinvoice) { print ''.$langs->trans("CreateBill").''; }*/ } $actionButtonsParameters = [ - "areDropdownButtons" => !getDolGlobalInt("MAIN_REMOVE_DROPDOWN_CREATE_BUTTONS_ON_ORDER"), - "backtopage" => $_SERVER["PHP_SELF"]."?id=".((int) $id) + "areDropdownButtons" => !getDolGlobalInt("MAIN_REMOVE_DROPDOWN_CREATE_BUTTONS_ON_ORDER"), + "backtopage" => $_SERVER["PHP_SELF"] . "?id=" . ((int) $id) ]; if ($numlines > 0) { @@ -3182,7 +3212,7 @@ print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans("Create"), 'default', $arrayforbutaction, $object->id, 0, $actionButtonsParameters); } - if ($object->statut == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { + if ($object->status == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || !getDolGlobalString('WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED')) { if ($usercanclose) { @@ -3195,7 +3225,7 @@ if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { // Close as accepted/refused - if ($object->statut == Propal::STATUS_VALIDATED) { + if ($object->status == Propal::STATUS_VALIDATED) { if ($usercanclose) { print ''.$langs->trans('SetAcceptedRefused').''; @@ -3206,7 +3236,7 @@ } } else { // Set not signed (close) - if ($object->statut == Propal::STATUS_DRAFT && $usercanclose) { + if ($object->status == Propal::STATUS_DRAFT && $usercanclose) { print '' . $langs->trans('SetRefusedAndClose') . ''; } @@ -3256,7 +3286,7 @@ print $htmltoenteralink; $compatibleImportElementsList = false; - if ($user->hasRight('propal', 'creer') && $object->statut == Propal::STATUS_DRAFT) { + if ($user->hasRight('propal', 'creer') && $object->status == Propal::STATUS_DRAFT) { $compatibleImportElementsList = array('commande', 'propal', 'facture'); // import from linked elements } $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList); @@ -3264,7 +3294,7 @@ // Show online signature link $useonlinesignature = getDolGlobalInt('PROPOSAL_ALLOW_ONLINESIGN'); - if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) { + if ($object->status != Propal::STATUS_DRAFT && $useonlinesignature) { print '
'; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; print showOnlineSignatureUrl('proposal', $object->ref, $object).'
'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 441ff76239c12..6366fbe34b954 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -3041,7 +3041,13 @@ // Create a purchase order if (!getDolGlobalInt('COMMANDE_DISABLE_ADD_PURCHASE_ORDER')) { - $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT), 'perm' => $usercancreatepurchaseorder, 'label' => 'AddPurchaseOrder', 'url' => '/fourn/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id)); + $arrayforbutaction[] = array( + 'lang' => 'orders', + 'enabled' => (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT), + 'perm' => $usercancreatepurchaseorder, + 'label' => 'AddPurchaseOrder', + 'url' => '/fourn/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) + ); } /*if (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfServicesLines() > 0) { @@ -3051,7 +3057,13 @@ }*/ // Create intervention - $arrayforbutaction[] = array('lang' => 'interventions', 'enabled' => (isModEnabled("intervention") && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0), 'perm' => $user->hasRight('ficheinter', 'creer'), 'label' => 'AddIntervention', 'url' => '/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid); + $arrayforbutaction[] = array( + 'lang' => 'interventions', + 'enabled' => (isModEnabled("intervention") && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0), + 'perm' => ($user->hasRight('ficheinter', 'creer') == 1), + 'label' => 'AddIntervention', + 'url' => '/fichinter/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid, + ); /*if (isModEnabled('ficheinter')) { $langs->load("interventions"); @@ -3065,7 +3077,13 @@ }*/ // Create contract - $arrayforbutaction[] = array('lang' => 'contracts', 'enabled' => (isModEnabled("contract") && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)), 'perm' => $user->hasRight('contrat', 'creer'), 'label' => 'AddContract', 'url' => '/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid); + $arrayforbutaction[] = array( + 'lang' => 'contracts', + 'enabled' => (isModEnabled("contract") && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)), + 'perm' => ($user->hasRight('contrat', 'creer') == 1), + 'label' => 'AddContract', + 'url' => '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid, + ); /*if (isModEnabled('contrat') && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) { $langs->load("contracts"); @@ -3082,7 +3100,13 @@ // Create shipment if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) { - $arrayforbutaction[] = array('lang' => 'sendings', 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), 'perm' => $user->hasRight('expedition', 'creer'), 'label' => 'CreateShipment', 'url' => '/expedition/shipment.php?id='.$object->id); + $arrayforbutaction[] = array( + 'lang' => 'sendings', + 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), + 'perm' => $user->hasRight('expedition', 'creer'), + 'label' => 'CreateShipment', + 'url' => '/expedition/shipment.php?id=' . $object->id + ); /* if ($user->hasRight('expedition', 'creer')) { print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, ''); @@ -3101,7 +3125,7 @@ 'enabled' => (isModEnabled('invoice') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0), 'perm' => ($user->hasRight('facture', 'creer') && !getDolGlobalInt('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')), 'label' => 'CreateBill', - 'url' => '/compta/facture/card.php?action=create&token='.newToken().'&origin='.urlencode($object->element).'&originid='.$object->id.'&socid='.$object->socid + 'url' => '/compta/facture/card.php?action=create&token=' . newToken() . '&origin=' . urlencode($object->element) . '&originid=' . $object->id . '&socid=' . $object->socid ); /* if (isModEnabled('facture') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index daef9ea49f1ef..8ee36319c1b80 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -120,6 +120,8 @@ $date_delivery = dol_mktime(GETPOSTINT('date_deliveryhour'), GETPOSTINT('date_deliverymin'), 0, GETPOSTINT('date_deliverymonth'), GETPOSTINT('date_deliveryday'), GETPOSTINT('date_deliveryyear')); +$date_shipping = dol_mktime(GETPOSTINT('date_shippinghour'), GETPOSTINT('date_shippingmin'), 0, GETPOSTINT('date_shippingmonth'), GETPOSTINT('date_shippingday'), GETPOSTINT('date_shippingyear')); + if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); @@ -266,6 +268,7 @@ $object->ref_customer = GETPOST('ref_customer', 'alpha'); $object->model_pdf = GETPOST('model'); $object->date_delivery = $date_delivery; // Date delivery planned + $object->date_shipping = $date_shipping; // Sending date $object->fk_delivery_address = $objectsrc->fk_delivery_address; $object->shipping_method_id = GETPOSTINT('shipping_method_id'); $object->tracking_number = GETPOST('tracking_number', 'alpha'); @@ -1037,6 +1040,15 @@ print "
'.$langs->trans("DateShipping").''; + print img_picto('', 'action', 'class="pictofixedwidth"'); + $date_shipping = ($date_shipping ? $date_shipping : $object->date_shipping); // $date_shipping comes from GETPOST + print $form->selectDate($date_shipping ? $date_shipping : -1, 'date_shipping', 1, 1, 1); + print "
'.$langs->trans("NotePublic").''; @@ -2018,7 +2030,6 @@ print ''; - if ($action != 'editdate_livraison') { print ''; } @@ -2037,6 +2048,29 @@ print ''; print ''; + // Delivery sending date + print ''; + print ''; + // Weight print ''; } +// Date shipping +if (!empty($arrayfields['e.date_expedition']['checked'])) { + print ''; +} if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Delivery method print ''; } if (!empty($arrayfields['l.date_delivery']['checked'])) { - // Date received + // Date reception print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Get code using getLabelFromKey $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang index 5eac14c49582f..49bb1e3148184 100644 --- a/htdocs/langs/en_US/deliveries.lang +++ b/htdocs/langs/en_US/deliveries.lang @@ -6,7 +6,8 @@ DeliveryOrder=Delivery receipt DeliveryDate=Delivery date CreateDeliveryOrder=Generate delivery receipt DeliveryStateSaved=Delivery state saved -SetDeliveryDate=Set shipping date +SetDeliveryDate=Set estimated delivery date +SetShippingDate=Set shipping date ValidateDeliveryReceipt=Validate delivery receipt ValidateDeliveryReceiptConfirm=Are you sure you want to validate this delivery receipt? DeleteDeliveryReceipt=Delete delivery receipt diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 9f648d5f706ff..eb9c16239ccc4 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -44,6 +44,7 @@ ConfirmCancelSending=Are you sure you want to cancel this shipment? DocumentModelMerou=Merou A5 model WarningNoQtyLeftToSend=Warning, no products waiting to be shipped. StatsOnShipmentsOnlyValidated=Statistics are only for validated shipments. Date used is the date of validation of shipment (planned delivery date is not always known) +DateShipping=Sending date DateDeliveryPlanned=Planned date of delivery RefDeliveryReceipt=Ref delivery receipt StatusReceipt=Status delivery receipt diff --git a/htdocs/langs/fr_FR/deliveries.lang b/htdocs/langs/fr_FR/deliveries.lang index 79b0a5d7735b0..3353abe7cb453 100644 --- a/htdocs/langs/fr_FR/deliveries.lang +++ b/htdocs/langs/fr_FR/deliveries.lang @@ -6,7 +6,8 @@ DeliveryOrder=Bon de réception DeliveryDate=Date de livraison CreateDeliveryOrder=Générer bon de réception DeliveryStateSaved=Le statut de livraison est enregistré -SetDeliveryDate=Définir la date d'expédition +SetDeliveryDate=Définir la date prévue de livraison +SetShippingDate=Définir la date d'expédition ValidateDeliveryReceipt=Valider le bon de livraison ValidateDeliveryReceiptConfirm=Êtes-vous sûr de vouloir valider ce bon de livraison ? DeleteDeliveryReceipt=Supprimer le bon de livraison diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index b3d5ae247efcf..88fcfdbceffba 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -44,6 +44,7 @@ ConfirmCancelSending=Êtes-vous sûr de vouloir annuler cette expédition ? DocumentModelMerou=Modèle Merou A5 WarningNoQtyLeftToSend=Alerte, aucun produit en attente d'expédition. StatsOnShipmentsOnlyValidated=Les statistiques ne prennent en compte que les envois validés. La date utilisée est celle qui est la date de validation de l'envoi (la date de réception prévue n'est pas nécessairement connue) +DateShipping=Date d’expédition DateDeliveryPlanned=Date prévue de livraison RefDeliveryReceipt=Ref bon de réception StatusReceipt=Status du bon de réception diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 2da002eb21574..2cd029ff91a36 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -352,7 +352,7 @@ print ''; } print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -446,8 +446,9 @@ } print ''; } + // Ref - print ''; if (!$i) { @@ -455,13 +456,13 @@ } // Title - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } // Type - print '
'; print $langs->trans('DateDeliveryPlanned'); print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'
'; + print ''; + if ($action != 'editdate_shipping') { + print ''; + } + print '
'; + print $langs->trans('DateShipping'); + print 'id.'">'.img_edit($langs->trans('SetShippingDate'), 1).'
'; + print '
'; + if ($action == 'editdate_shipping') { + print '
'; + print ''; + print ''; + print $form->selectDate($object->date_shipping ? $object->date_shipping : -1, 'liv_', 1, 1, 0, "setdate_shipping", 1, 0); + print ''; + print '
'; + } else { + print $object->date_shipping ? dol_print_date($object->date_shipping, 'dayhour') : ' '; + } + print '
'; print $form->editfieldkey("Weight", 'trueWeight', $object->trueWeight, $object, $user->hasRight('expedition', 'creer')); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 7ce4800e0932a..8a49d6139a6b8 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1206,6 +1206,9 @@ public function update($user = null, $notrigger = 0) if (isset($this->model_pdf)) { $this->model_pdf = trim($this->model_pdf); } + if (!empty($this->date_expedition)) { + $this->date_shipping = $this->date_expedition; + } // Check parameters // Put here code to add control on parameters values @@ -1220,7 +1223,7 @@ public function update($user = null, $notrigger = 0) $sql .= " fk_user_author = ".(isset($this->fk_user_author) ? $this->fk_user_author : "null").","; $sql .= " date_valid = ".(dol_strlen($this->date_valid) != 0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').","; $sql .= " fk_user_valid = ".(isset($this->fk_user_valid) ? $this->fk_user_valid : "null").","; - $sql .= " date_expedition = ".(dol_strlen($this->date_expedition) != 0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').","; + $sql .= " date_expedition = ".(dol_strlen($this->date_shipping) != 0 ? "'".$this->db->idate($this->date_shipping)."'" : 'null').","; $sql .= " date_delivery = ".(dol_strlen($this->date_delivery) != 0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; $sql .= " fk_address = ".(isset($this->fk_delivery_address) ? $this->fk_delivery_address : "null").","; $sql .= " fk_shipping_method = ".((isset($this->shipping_method_id) && $this->shipping_method_id > 0) ? $this->shipping_method_id : "null").","; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 141c0ff6161da..e2cbfed00c58f 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -77,6 +77,8 @@ $search_country = GETPOST("search_country", 'aZ09'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'intcomma'); $search_billed = GETPOST("search_billed", 'intcomma'); +$search_dateshipping_start = dol_mktime(0, 0, 0, GETPOSTINT('search_dateshipping_startmonth'), GETPOSTINT('search_dateshipping_startday'), GETPOSTINT('search_dateshipping_startyear')); +$search_dateshipping_end = dol_mktime(23, 59, 59, GETPOSTINT('search_dateshipping_endmonth'), GETPOSTINT('search_dateshipping_endday'), GETPOSTINT('search_dateshipping_endyear')); $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datedelivery_startmonth'), GETPOSTINT('search_datedelivery_startday'), GETPOSTINT('search_datedelivery_startyear')); $search_datedelivery_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datedelivery_endmonth'), GETPOSTINT('search_datedelivery_endday'), GETPOSTINT('search_datedelivery_endyear')); $search_datereceipt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datereceipt_startmonth'), GETPOSTINT('search_datereceipt_startday'), GETPOSTINT('search_datereceipt_startyear')); @@ -144,9 +146,10 @@ 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => 0, 'position' => 7), 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers, 'position' => 8), 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => 1, 'position' => 9), - 'e.fk_shipping_method' => array('label' => $langs->trans('SendingMethod'), 'checked' => 1, 'position' => 10), - 'e.tracking_number' => array('label' => $langs->trans("TrackingNumber"), 'checked' => 1, 'position' => 11), - 'e.weight' => array('label' => $langs->trans("Weight"), 'checked' => 0, 'position' => 12), + 'e.date_expedition' => array('label' => $langs->trans("DateShipping"), 'checked' => 1, 'position' => 10), + 'e.fk_shipping_method' => array('label' => $langs->trans('SendingMethod'), 'checked' => 1, 'position' => 11), + 'e.tracking_number' => array('label' => $langs->trans("TrackingNumber"), 'checked' => 1, 'position' => 12), + 'e.weight' => array('label' => $langs->trans("Weight"), 'checked' => 0, 'position' => 13), 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500), 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500), 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000), @@ -213,6 +216,8 @@ $search_shipping_method_ids = []; $search_type_thirdparty = ''; $search_billed = ''; + $search_dateshipping_start = ''; + $search_dateshipping_end = ''; $search_datedelivery_start = ''; $search_datedelivery_end = ''; $search_datereceipt_start = ''; @@ -567,6 +572,12 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); } + if ($search_dateshipping_start) { + $param .= '&search_dateshipping_startday='.urlencode(dol_print_date($search_dateshipping_start, '%d')).'&search_dateshipping_startmonth='.urlencode(dol_print_date($search_dateshipping_start, '%m')).'&search_dateshipping_startyear='.urlencode(dol_print_date($search_dateshipping_start, '%Y')); + } + if ($search_dateshipping_end) { + $param .= '&search_dateshipping_endday='.urlencode(dol_print_date($search_dateshipping_end, '%d')).'&search_dateshipping_endmonth='.urlencode(dol_print_date($search_dateshipping_end, '%m')).'&search_dateshipping_endyear='.urlencode(dol_print_date($search_dateshipping_end, '%Y')); + } if ($search_datedelivery_start) { $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); } @@ -667,7 +678,7 @@ if ($search_all || $search_user > 0) { $sql = 'SELECT DISTINCT'; } -$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, e.fk_statut, e.signed_status, e.billed, e.tracking_number, e.fk_shipping_method,"; +$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_expedition, e.date_delivery as delivery_date, e.fk_statut, e.signed_status, e.billed, e.tracking_number, e.fk_shipping_method,"; if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { // Link for delivery fields ref and date. Does not duplicate the line because we should always have only 1 link or 0 per shipment $sql .= " l.date_delivery as date_reception,"; @@ -771,6 +782,12 @@ if ($search_ref_exp) { $sql .= natural_search('e.ref', $search_ref_exp); } +if ($search_dateshipping_start) { + $sql .= " AND e.date_expedition >= '".$db->idate($search_dateshipping_start)."'"; +} +if ($search_dateshipping_end) { + $sql .= " AND e.date_expedition <= '".$db->idate($search_dateshipping_end)."'"; +} if ($search_datedelivery_start) { $sql .= " AND e.date_delivery >= '".$db->idate($search_datedelivery_start)."'"; } @@ -978,6 +995,12 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty)); } +if ($search_dateshipping_start) { + $param .= '&search_dateshipping_startday='.urlencode(dol_print_date($search_dateshipping_start, '%d')).'&search_dateshipping_startmonth='.urlencode(dol_print_date($search_dateshipping_start, '%m')).'&search_dateshipping_startyear='.urlencode(dol_print_date($search_dateshipping_start, '%Y')); +} +if ($search_dateshipping_end) { + $param .= '&search_dateshipping_endday='.urlencode(dol_print_date($search_dateshipping_end, '%d')).'&search_dateshipping_endmonth='.urlencode(dol_print_date($search_dateshipping_end, '%m')).'&search_dateshipping_endyear='.urlencode(dol_print_date($search_dateshipping_end, '%Y')); +} if ($search_datedelivery_start) { $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); } @@ -1248,6 +1271,17 @@ print ''; print ''; + print '
'; + print $form->selectDate($search_dateshipping_start ? $search_dateshipping_start : -1, 'search_dateshipping_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_dateshipping_end ? $search_dateshipping_end : -1, 'search_dateshipping_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; @@ -1268,7 +1302,7 @@ print ''; print '
'; print $form->selectDate($search_datereceipt_start ? $search_datereceipt_start : -1, 'search_datereceipt_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -1385,6 +1419,10 @@ print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } +if (!empty($arrayfields['e.date_expedition']['checked'])) { + print_liste_field_titre($arrayfields['e.date_expedition']['label'], $_SERVER["PHP_SELF"], "e.date_expedition", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { print_liste_field_titre($arrayfields['e.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "e.fk_shipping_method", "", $param, '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; @@ -1602,6 +1640,15 @@ $totalarray['nbfield']++; } } + // Date shipping + if (!empty($arrayfields['e.date_expedition']['checked'])) { + print '
'; + print dol_print_date($db->jdate($obj->date_expedition), "dayhour"); + print "'; + print ''; print $opensurvey_static->getNomUrl(1); print ''.dol_htmlentities($obj->title).''.dol_htmlentities($obj->title).''; + print ''; $type = ($obj->format == 'A') ? 'classic' : 'date'; print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1); print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate"); @@ -470,7 +471,7 @@ $totalarray['nbfield']++; } - print ''; + print ''; // Author if ($obj->fk_user_creat) { $userstatic = new User($db); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a230763a1abfc..f0b2ea132fa83 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -864,7 +864,7 @@ public function loadDefaultValues() * @param string $module Module of permission to check * @param string $permlevel1 Permission level1 (Example: 'read', 'write', 'delete') * @param string $permlevel2 Permission level2 - * @return 0|1 Return integer 1 if user has permission, 0 if not. + * @return int<0,1> Return integer 1 if user has permission, 0 if not. * @see clearrights(), delrights(), loadRights(), hasRight() */ public function hasRight($module, $permlevel1, $permlevel2 = '')