diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index aceda22aa52..b180a5d9434 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,11 +9,11 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 770+ occurrences - // PhanPluginUnknownPropertyType : 710+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 600+ occurrences + // PhanUndeclaredProperty : 640+ occurrences + // PhanPluginUnknownPropertyType : 630+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 580+ occurrences // PhanTypeMismatchArgumentProbablyReal : 400+ occurrences - // PhanUndeclaredGlobalVariable : 380+ occurrences + // PhanUndeclaredGlobalVariable : 350+ occurrences // PhanPluginUnknownArrayMethodReturnType : 300+ occurrences // PhanPluginUnknownArrayMethodParamType : 250+ occurrences // PhanPossiblyUndeclaredVariable : 200+ occurrences @@ -29,22 +29,22 @@ return [ // PhanTypeInvalidDimOffset : 35+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences // PhanPluginUnknownObjectMethodCall : 15+ occurrences - // PhanTypeComparisonFromArray : 15+ occurrences // PhanUndeclaredConstant : 15+ occurrences // PhanUndeclaredMethod : 15+ occurrences // PhanEmptyForeach : 10+ occurrences // PhanPluginConstantVariableNull : 10+ occurrences // PhanPossiblyNullTypeMismatchProperty : 10+ occurrences // PhanTypeArraySuspiciousNull : 10+ occurrences + // PhanTypeComparisonFromArray : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences // PhanPluginBothLiteralsBinaryOp : 8 occurrences // PhanPluginSuspiciousParamPosition : 8 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences // PhanParamTooMany : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences - // PhanTypeExpectedObjectPropAccessButGotNull : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences + // PhanTypeExpectedObjectPropAccessButGotNull : 3 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence @@ -293,7 +293,7 @@ return [ 'htdocs/core/class/html.formldap.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmargin.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], - 'htdocs/core/class/html.formprojet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/class/html.formprojet.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/html.formsetup.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], 'htdocs/core/class/html.formwebsite.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], 'htdocs/core/class/ldap.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPossiblyUndeclaredVariable'], @@ -430,14 +430,12 @@ return [ 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], - 'htdocs/core/tpl/login.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/objectline_edit.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/objectline_title.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanTypeExpectedObjectPropAccessButGotNull', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/tpl/onlinepaymentlinks.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordforgotten.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/passwordreset.tpl.php' => ['PhanUndeclaredGlobalVariable'], @@ -445,7 +443,7 @@ return [ 'htdocs/core/tpl/resource_view.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/core/triggers/dolibarrtriggers.class.php' => ['PhanPluginUnknownArrayPropertyType'], 'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanTypeComparisonFromArray', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/triggers/interface_50_modNotification_Notification.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess'], @@ -781,24 +779,20 @@ return [ 'htdocs/salaries/paiement_salary.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/salaries/virement_request.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/societe/admin/societe.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'], - 'htdocs/societe/ajax/ajaxcompanies.php' => ['PhanUndeclaredProperty'], 'htdocs/societe/ajax/company.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/societe/checkvat/checkVatPopup.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/societe/class/api_contacts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/societe/class/client.class.php' => ['PhanPluginUnknownArrayPropertyType'], - 'htdocs/societe/class/companybankaccount.class.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/societe/class/companypaymentmode.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/class/societeaccount.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], + 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], 'htdocs/societe/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/website.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/stripe/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayMethodParamType', 'PhanUndeclaredProperty'], - 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], + 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition'], + 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty'], 'htdocs/supplier_proposal/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanUndeclaredProperty'], diff --git a/dev/tools/phan/config_extended.php b/dev/tools/phan/config_extended.php index 521c0347d73..70087113db3 100644 --- a/dev/tools/phan/config_extended.php +++ b/dev/tools/phan/config_extended.php @@ -97,6 +97,7 @@ $config['suppress_issue_types'] = [ 'PhanPluginUnknownArrayMethodParamType', // this option costs more time to be supported than it solves time 'PhanPluginUnknownArrayMethodReturnType', // this option costs more time to be supported than it solves time + 'PhanTypeSuspiciousNonTraversableForeach', // Reports on `foreach ($object as $key => $value)` which works without php notices, so we ignore it because this is intentional in the code. ]; return $config; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 8e5ed262fe4..256f89219cd 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3179,6 +3179,7 @@ class Adherent extends CommonObject $actioncomm->errors_to = ''; $actioncomm->fk_element = $adherent->id; + $actioncomm->elementid = $adherent->id; $actioncomm->elementtype = $adherent->element; $actioncomm->extraparams = $extraparams; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index d8e5f342494..b9318aeb2a6 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -564,12 +564,7 @@ print ''; print ''; print ''.$langs->trans("TicketsAutoAssignTicket").''; print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); -} else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, getDolGlobalString('TICKET_AUTO_ASSIGN_USER_CREATE')); -} +print ''; print ''; print ''; print $formcategory->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help'); diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 72e764322b4..ae53dd2f173 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -142,7 +142,7 @@ if (isModEnabled("product") || isModEnabled("service")) { } else { print $form->select_produits(GETPOSTINT('idprod'), (($filtertype == 1) ? 'idprodservice' : 'idprod'), $filtertype, getDolGlobalInt('PRODUIT_LIMIT_SIZE'), 0, $statustoshow, 2, '', 1, array(), 0, '1', 0, 'maxwidth500 widthcentpercentminusx', 0, '', GETPOSTINT('combinations'), 1); } - $urltocreateproduct = DOL_URL_ROOT.'/product/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); + $urltocreateproduct = DOL_URL_ROOT.'/product/card.php?action=create'.(($filtertype == 1) ? '&leftmenu=service&type=1' : '&leftmenu=product&type=0').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); print ''; echo ''; diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index f00e0303550..3a18a668724 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -188,12 +188,13 @@ if ($object->id > 0) { print ''; - $sql = "SELECT ac.id, ac.ref, ac.datep as date_start, ac.datep2 as date_end, ac.label, acr.fk_element"; + $sql = "SELECT ac.id, ac.ref, ac.datep as date_start, ac.datep2 as date_end, ac.label, acr.fk_element as elementid"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as ac"; $sql .= " JOIN ".MAIN_DB_PREFIX."actioncomm_resources as acr on acr.fk_actioncomm = ac.id"; $sql .= " WHERE ac.fk_bookcal_calendar = ".((int) $object->id); $sql .= " AND ac.code = 'AC_RDV'"; $sql .= " AND acr.element_type = 'socpeople'"; + $resql = $db->query($sql); $num = 0; @@ -203,10 +204,10 @@ if ($object->id > 0) { $tmpcontact = new Contact($db); $tmpactioncomm = new ActionComm($db); - $num = $db->num_rows($result); + $num = $db->num_rows($resql); while ($i < $num) { $obj = $db->fetch_object($resql); - $tmpcontact->fetch($obj->fk_element); + $tmpcontact->fetch($obj->elementid); $tmpactioncomm->fetch($obj->id); print ''; @@ -230,7 +231,6 @@ if ($object->id > 0) { print $tmpcontact->getNomUrl(1, -1); print ''; - print "\n"; $i++; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 38812429661..843ccc40575 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -376,6 +376,7 @@ if (empty($reshook) && $action == 'add' && $usercancreate) { } if ($hasPermissionOnLinkedObject) { $object->fk_element = GETPOSTINT("fk_element"); + $object->elementid = GETPOSTINT("fk_element"); $object->elementtype = GETPOST("elementtype", 'alpha'); } } @@ -402,6 +403,7 @@ if (empty($reshook) && $action == 'add' && $usercancreate) { } $object->fk_element = $taskid; + $object->elementid = $taskid; $object->elementtype = 'task'; } @@ -836,6 +838,7 @@ if (empty($reshook) && $action == 'update' && $usercancreate) { } if ($hasPermissionOnLinkedObject) { $object->fk_element = GETPOSTINT("fk_element"); + $object->elementid = GETPOSTINT("fk_element"); $object->elementtype = GETPOST("elementtype", 'alpha'); } } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 1c51b37d5c7..e4858c21f94 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -273,6 +273,7 @@ class ActionComm extends CommonObject // Properties for links to other objects /** * @var int Id of linked object + * @deprecated Use $elementid */ public $fk_element; // Id of record @@ -480,6 +481,9 @@ class ActionComm extends CommonObject if (empty($this->fk_element) && !empty($this->elementid)) { $this->fk_element = $this->elementid; } + if (empty($this->elementid) && !empty($this->fk_element)) { + $this->elementid = $this->fk_element; + } if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead of an array $tmpid = (int) $this->userassigned; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 78b71241705..f58894c212c 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -947,6 +947,7 @@ if ($resql) { $event->location = $obj->location; $event->transparency = $obj->transparency; $event->fk_element = $obj->fk_element; + $event->elementid = $obj->fk_element; $event->elementtype = $obj->elementtype; $event->fk_project = $obj->fk_project; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index b42264712ab..d5dda3a95cd 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -697,6 +697,7 @@ if ($resql) { $event->contact_id = $obj->fk_contact; $event->fk_element = $obj->fk_element; + $event->elementid = $obj->fk_element; $event->elementtype = $obj->elementtype; // Defined date_start_in_calendar and date_end_in_calendar property diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 88dd5e5d7c8..1274346b70f 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -731,6 +731,7 @@ if ($resql) { $event->contact_id = $obj->fk_contact; $event->fk_element = $obj->fk_element; + $event->elementid = $obj->fk_element; $event->elementtype = $obj->elementtype; // Defined date_start_in_calendar and date_end_in_calendar property diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 5b37f801dcb..47f23fac914 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -151,7 +151,7 @@ class AdvanceTargetingMailing extends CommonObject */ public function create($user, $notrigger = 0) { - global $conf, $langs; + global $conf; $error = 0; // Clean parameters diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 01957c93456..b66f0314490 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -417,11 +417,9 @@ class FormAdvTargetEmailing extends Form */ public function selectAdvtargetemailingTemplate($htmlname = 'template_id', $selected = 0, $showempty = 0, $type_element = 'mailing', $morecss = '') { - global $conf, $user, $langs; - $out = ''; - $sql = "SELECT c.rowid, c.name, c.fk_element"; + $sql = "SELECT c.rowid, c.name, c.fk_element as elementid"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_advtarget as c"; $sql .= " WHERE type_element = '".$this->db->escape($type_element)."'"; $sql .= " ORDER BY c.name"; @@ -440,7 +438,7 @@ class FormAdvTargetEmailing extends Form $obj = $this->db->fetch_object($resql); $label = $obj->name; if (empty($label)) { - $label = $obj->fk_element; + $label = (string) $obj->elementid; } if ($selected > 0 && $selected == $obj->rowid) { @@ -455,7 +453,9 @@ class FormAdvTargetEmailing extends Form } else { dol_print_error($this->db); } + $this->db->free($resql); + return $out; } } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e0aa0a4803d..6576b0155be 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2732,34 +2732,36 @@ while ($i < $imaxinloop) { $numlines = count($generic_commande->lines); // Loop on each line of order for ($lig = 0; $lig < $numlines; $lig++) { - if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) { - $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id]; + $orderLine = $generic_commande->lines[$lig]; + '@phan-var-force OrderLine $orderLine'; + if (isset($generic_commande->expeditions[$orderLine->id])) { + $reliquat = $orderLine->qty - $generic_commande->expeditions[$orderLine->id]; } else { - $reliquat = $generic_commande->lines[$lig]->qty; + $reliquat = $orderLine->qty; } - if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service + if ($orderLine->product_type == 0 && $orderLine->fk_product > 0) { // If line is a product and not a service $nbprod++; // order contains real products - $generic_product->id = $generic_commande->lines[$lig]->fk_product; + $generic_product->id = $orderLine->fk_product; // Get local and virtual stock and store it into cache - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) { + if (empty($productstat_cache[$orderLine->fk_product])) { $generic_product->load_stock('nobatch,warehouseopen'); // ->load_virtual_stock() is already included into load_stock() - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel; - $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique; + $productstat_cache[$orderLine->fk_product]['stock_reel'] = $generic_product->stock_reel; + $productstat_cachevirtual[$orderLine->fk_product]['stock_reel'] = $generic_product->stock_theorique; } else { - $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel']; + $generic_product->stock_reel = $productstat_cache[$orderLine->fk_product]['stock_reel']; // @phan-suppress-next-line PhanTypeInvalidDimOffset - $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel']; + $generic_product->stock_theorique = $productstat_cachevirtual[$orderLine->fk_product]['stock_reel']; } if ($reliquat > $generic_product->stock_reel) { $notshippable++; } if (!getDolGlobalString('SHIPPABLE_ORDER_ICON_IN_LIST')) { // Default code. Default should be this case. - $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); + $text_info .= $reliquat.' x '.$orderLine->product_ref.' '.dol_trunc($orderLine->product_label, 20); $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.''; $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.''; - $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); + $text_info .= ($reliquat != $orderLine->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($orderLine->qty - $reliquat).')' : ''); $text_info .= '
'; } else { // BUGGED CODE. // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE. @@ -2770,29 +2772,29 @@ while ($i < $imaxinloop) { $stock_order_supplier = 0; if (getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT') || getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { // What about other options ? if (isModEnabled('order')) { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { + if (empty($productstat_cache[$orderLine->fk_product]['stats_order_customer'])) { $generic_product->load_stats_commande(0, '1,2'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; + $productstat_cache[$orderLine->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; } else { // @phan-suppress-next-line PhanTypeInvalidDimOffset - $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer']; + $generic_product->stats_commande['qty'] = $productstat_cache[$orderLine->fk_product]['stats_order_customer']; } $stock_order = $generic_product->stats_commande['qty']; } if (isModEnabled("supplier_order")) { - if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) { + if (empty($productstat_cache[$orderLine->fk_product]['stats_order_supplier'])) { $generic_product->load_stats_commande_fournisseur(0, '3'); - $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; + $productstat_cache[$orderLine->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty']; } else { // @phan-suppress-next-line PhanTypeInvalidDimOffset - $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier']; + $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$orderLine->fk_product]['stats_order_supplier']; } $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty']; } } - $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20); + $text_info .= $reliquat.' x '.$orderLine->ref.' '.dol_trunc($orderLine->product_label, 20); $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order; - if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) { + if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $orderLine->qty)) { $warning++; $text_warning .= ''.$langs->trans('Available').' : '.$text_stock_reel.''; } @@ -2804,7 +2806,7 @@ while ($i < $imaxinloop) { if (isModEnabled("supplier_order")) { $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier; } - $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : ''); + $text_info .= ($reliquat != $orderLine->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($orderLine->qty - $reliquat).')' : ''); $text_info .= '
'; } } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 663eef6f6f3..1726f6395a7 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -159,6 +159,8 @@ class BankAccounts extends DolibarrApi $result = $this->_validate($request_data); $account = new Account($this->db); + // Date of the initial balance (required to create an account). + $account->date_solde = time(); foreach ($request_data as $field => $value) { if ($field === 'caller') { // Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller @@ -168,8 +170,6 @@ class BankAccounts extends DolibarrApi $account->$field = $this->_checkValForAPI($field, $value, $account); } - // Date of the initial balance (required to create an account). - $account->date_solde = time(); // courant and type are the same thing but the one used when // creating an account is courant $account->courant = $account->type; // deprecated diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index f753baf5158..1d8fec0b090 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1890,7 +1890,10 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf } } -$parameters['toselect'] = (empty($toselect) ? array() : $toselect); +if (empty($toselect)) { + $toselect=[]; +} +$parameters['toselect'] = &$toselect; $parameters['uploaddir'] = $uploaddir; $parameters['massaction'] = $massaction; $parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null; diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index effde09c757..0ea8d182169 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -1,7 +1,7 @@ - * Copyright (C) 2018-2023 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index a311114592b..1324096d3d5 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -1,6 +1,7 @@ - * Copyright (C) 2007-2012 Laurent Destailleur +/* Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2007-2012 Laurent Destailleur + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,7 +79,7 @@ if ($boxorder && $zone != '' && $userid > 0) { // boxorder value is the target order: "A:idboxA1,idboxA2,A-B:idboxB1,idboxB2,B" dol_syslog("AjaxBox boxorder=".$boxorder." zone=".$zone." userid=".$userid, LOG_DEBUG); - $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid); + $result = InfoBox::saveboxorder($db, (int) $zone, $boxorder, $userid); if ($result > 0) { $langs->load("boxes"); if (!GETPOST('closing')) { diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index ef18720b9b6..566332ad34d 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -1,8 +1,8 @@ - * Copyright (C) 2017 Juanjo Menent - * Copyright (C) 2019 Frédéric France - * Copyright (C) 2023 Laurent Destailleur +/* Copyright (C) 2016 Sergio Sanchis + * Copyright (C) 2017 Juanjo Menent + * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2023 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,7 +66,6 @@ if ($action == 'stopreminder') { // Test on permission not required here. Endpoi if (!$resql) { dol_print_error($db); } - //} include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 2754623b82d..0ad93d71af6 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -391,7 +391,7 @@ class FormProjets extends Form // Use select2 selector if (empty($option_only) && !empty($conf->use_javascript_ajax)) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); + $comboenhancement = ajax_combobox($htmlname, [], 0, $forcefocus); $out .= $comboenhancement; $morecss .= ' minwidth150imp'; } @@ -906,7 +906,7 @@ class FormProjets extends Form if (empty($lineOnly)) { if (!empty($conf->use_javascript_ajax)) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlNameInvoiceLine, '', 0, 0); + $comboenhancement = ajax_combobox($htmlNameInvoiceLine, [], 0, 0); $out .= $comboenhancement; $morecss = 'minwidth200imp maxwidth500'; } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 659c966d9d9..c3f476a6ac4 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -445,7 +445,7 @@ function ajax_dialog($title, $message, $w = 350, $h = 150) * TODO: It is used when COMPANY_USE_SEARCH_TO_SELECT and CONTACT_USE_SEARCH_TO_SELECT are set by html.formcompany.class.php. Should use ajax_autocompleter instead like done by html.form.class.php for select_produits. * * @param string $htmlname Name of html select field ('myid' or '.myclass') - * @param array}> $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param array}> $events More events option. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @param int $minLengthToAutocomplete Minimum length of input string to start autocomplete * @param int $forcefocus Force focus on field * @param string $widthTypeOfAutocomplete 'resolve' or 'off' diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5401717a869..57b026a2e8c 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -540,63 +540,61 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t } if ($mode == 'target' || preg_match('/targetwithdetails/', $mode)) { - if ($usecontact) { - if (is_object($targetcontact)) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1)); + if ($usecontact && (is_object($targetcontact))) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($targetcontact->getFullName($outputlangs, 1)); - if (!empty($targetcontact->address)) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n"; - } else { - $companytouseforaddress = $targetcompany; + if (!empty($targetcontact->address)) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcontact))."\n"; + } else { + $companytouseforaddress = $targetcompany; - // Contact on a thirdparty that is a different thirdparty than the thirdparty of object - if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) { - $targetcontact->fetch_thirdparty(); - $companytouseforaddress = $targetcontact->thirdparty; - } - - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress))."\n"; - } - // Country - if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code)); - } elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code)); + // Contact on a thirdparty that is a different thirdparty than the thirdparty of object + if ($targetcontact->socid > 0 && $targetcontact->socid != $targetcompany->id) { + $targetcontact->fetch_thirdparty(); + $companytouseforaddress = $targetcontact->thirdparty; } - if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match('/targetwithdetails/', $mode)) { - // Phone - if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) { - if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": "; - } - if (!empty($targetcontact->phone_pro)) { - $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro); - } - if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) { - $stringaddress .= " / "; - } - if (!empty($targetcontact->phone_mobile)) { - $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile); - } + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($companytouseforaddress))."\n"; + } + // Country + if (!empty($targetcontact->country_code) && $targetcontact->country_code != $sourcecompany->country_code) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcontact->country_code)); + } elseif (empty($targetcontact->country_code) && !empty($targetcompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code)); + } + + if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || preg_match('/targetwithdetails/', $mode)) { + // Phone + if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_phone/', $mode)) { + if (!empty($targetcontact->phone_pro) || !empty($targetcontact->phone_mobile)) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Phone").": "; } - // Fax - if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) { - if ($targetcontact->fax) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); - } + if (!empty($targetcontact->phone_pro)) { + $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_pro); } - // EMail - if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) { - if ($targetcontact->email) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email); - } + if (!empty($targetcontact->phone_pro) && !empty($targetcontact->phone_mobile)) { + $stringaddress .= " / "; } - // Web - if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) { - if ($targetcontact->url) { - $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url); - } + if (!empty($targetcontact->phone_mobile)) { + $stringaddress .= $outputlangs->convToOutputCharset($targetcontact->phone_mobile); + } + } + // Fax + if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_fax/', $mode)) { + if ($targetcontact->fax) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($targetcontact->fax); + } + } + // EMail + if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_email/', $mode)) { + if ($targetcontact->email) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($targetcontact->email); + } + } + // Web + if (getDolGlobalString('MAIN_PDF_ADDALSOTARGETDETAILS') || $mode == 'targetwithdetails' || preg_match('/targetwithdetails_url/', $mode)) { + if ($targetcontact->url) { + $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($targetcontact->url); } } } diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 4a6133a54a7..47e6b2c04c0 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -1,9 +1,9 @@ - * Copyright (C) 2019 Alexandre Spangaro + * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2023 Frédéric France + * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -25,7 +25,7 @@ * Returns an array with the tabs for the "salaries" section * It loads tabs from modules looking for the entity salaries * - * @param Paiement $object Current salaries object + * @param Salary $object Current salaries object * @return array Tabs for the salaries section */ function salaries_prepare_head($object) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index c8df347a067..9eb6b20d9f8 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -183,7 +183,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("commande") && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=4', 'StatusOrderProcessed', 1, 'orders', '$user->hasRight("commande", "lire")', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("commande") && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->hasRight("commande", "lire")', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("commande")', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '(!empty($conf->global->MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS)?$user->hasRight("commande", "commande", "export"):$user->hasRight("commande", "lire"))', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("commande") && $conf->global->MAIN_FEATURES_LEVEL >= 1 && empty($user->socid)', __HANDLER__, 'left', 1210__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/list_det.php?mainmenu=commercial&leftmenu=orders', 'ListOrderLigne', 1, 'orders', '$user->hasRight("commande", "lire")', '', 2, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("commande") && empty($user->socid)', __HANDLER__, 'left', 1210__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/list_det.php?mainmenu=commercial&leftmenu=orders', 'ListOrderLigne', 1, 'orders', '$user->hasRight("commande", "lire")', '', 2, 1, __ENTITY__); -- Commercial - Supplier's proposals insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("supplier_proposal")', __HANDLER__, 'left', 1650__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e66457836ca..835120bd922 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1382,7 +1382,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->hasRight('commande', 'lire')); $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->hasRight('commande', 'lire')); } - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 && empty($user->socid)) { + if (empty($user->socid)) { $newmenu->add("/commande/list_det.php?leftmenu=orders", $langs->trans("ListOrderLigne"), 1, $user->hasRight('commande', 'lire')); } if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) { diff --git a/htdocs/core/modules/modAi.class.php b/htdocs/core/modules/modAi.class.php index e59b44d5de6..491c8506a83 100644 --- a/htdocs/core/modules/modAi.class.php +++ b/htdocs/core/modules/modAi.class.php @@ -198,7 +198,7 @@ class modAi extends DolibarrModules /* Example: $this->dictionaries=array( 'langs'=>'ai@ai', - // List of tables we want to see into dictonnary editor + // List of tables we want to see into dictionary editor 'tabname'=>array("table1", "table2", "table3"), // Label of tables 'tablib'=>array("Table1", "Table2", "Table3"), diff --git a/htdocs/core/modules/modBookCal.class.php b/htdocs/core/modules/modBookCal.class.php index 55837ef34ee..43210e6dfe9 100644 --- a/htdocs/core/modules/modBookCal.class.php +++ b/htdocs/core/modules/modBookCal.class.php @@ -195,7 +195,7 @@ class modBookCal extends DolibarrModules /* Example: $this->dictionaries=array( 'langs'=>'bookcal@bookcal', - // List of tables we want to see into dictonnary editor + // List of tables we want to see into dictionary editor 'tabname'=>array("table1", "table2", "table3"), // Label of tables 'tablib'=>array("Table1", "Table2", "Table3"), diff --git a/htdocs/core/modules/modIncoterm.class.php b/htdocs/core/modules/modIncoterm.class.php index 3584a9f9db1..fe0c2e3fecf 100644 --- a/htdocs/core/modules/modIncoterm.class.php +++ b/htdocs/core/modules/modIncoterm.class.php @@ -86,7 +86,7 @@ class modIncoterm extends DolibarrModules } $this->dictionaries = array( 'langs' => 'incoterm', - 'tabname' => array("c_incoterms"), // List of tables we want to see into dictonnary editor + 'tabname' => array("c_incoterms"), // List of tables we want to see into dictionary editor 'tablib' => array("Incoterms"), // Label of tables 'tabsql' => array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields 'tabsqlsort' => array("rowid ASC"), // Sort order diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index fabe977c849..e9d1d465e60 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -214,7 +214,7 @@ class modPartnership extends DolibarrModules // Dictionaries $this->dictionaries = array( 'langs' => 'partnership', - // List of tables we want to see into dictonnary editor + // List of tables we want to see into dictionary editor 'tabname' => array("c_partnership_type"), // Label of tables 'tablib' => array("PartnershipType"), diff --git a/htdocs/core/modules/modStockTransfer.class.php b/htdocs/core/modules/modStockTransfer.class.php index bf41a6f036d..c797136b335 100644 --- a/htdocs/core/modules/modStockTransfer.class.php +++ b/htdocs/core/modules/modStockTransfer.class.php @@ -176,7 +176,7 @@ class modStockTransfer extends DolibarrModules /* Example: $this->dictionaries=array( 'langs'=>'stocktransfer@stocktransfer', - // List of tables we want to see into dictonnary editor + // List of tables we want to see into dictionary editor 'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"), // Label of tables 'tablib'=>array("Table1", "Table2", "Table3"), diff --git a/htdocs/core/modules/modWebPortal.class.php b/htdocs/core/modules/modWebPortal.class.php index d0cdcf2e68b..7059e92fc0b 100644 --- a/htdocs/core/modules/modWebPortal.class.php +++ b/htdocs/core/modules/modWebPortal.class.php @@ -205,7 +205,7 @@ class modWebPortal extends DolibarrModules /* Example: $this->dictionaries=array( 'langs'=>'website', - // List of tables we want to see into dictonnary editor + // List of tables we want to see into dictionary editor 'tabname'=>array("table1", "table2", "table3"), // Label of tables 'tablib'=>array("Table1", "Table2", "Table3"), diff --git a/htdocs/core/modules/modWebhook.class.php b/htdocs/core/modules/modWebhook.class.php index 071b3cd6466..26ffcb1044b 100644 --- a/htdocs/core/modules/modWebhook.class.php +++ b/htdocs/core/modules/modWebhook.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2019-2020 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -199,7 +200,7 @@ class modWebhook extends DolibarrModules /* Example: $this->dictionaries=array( 'langs'=>'', - // List of tables we want to see into dictonnary editor + // List of tables we want to see into dictionary editor 'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"), // Label of tables 'tablib'=>array("Table1", "Table2", "Table3"), diff --git a/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php b/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php index 5e448df4ff6..7e5030be5ea 100644 --- a/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php +++ b/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2011 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,8 @@ * \brief File to manage captcha generation according to dolibarr native code */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/security/captcha/modules_captcha.php'; + require_once DOL_DOCUMENT_ROOT.'/core/modules/security/captcha/modules_captcha.php'; + require_once DOL_DOCUMENT_ROOT.'/core/modules/security/generate/modGeneratePassStandard.class.php'; /** @@ -74,7 +75,24 @@ class modCaptchaStandard extends ModeleCaptcha */ public function getExample() { - return ''; + global $db, $conf, $langs, $user; + + $generator = new modGeneratePassStandard($db, $conf, $langs, $user); + $example = $generator->getExample(); + $img = imagecreate(80, 32); + if (!$img) { + return "Problem with GD creation"; + } + $background_color = imagecolorallocate($img, 250, 250, 250); + $ecriture_color = imagecolorallocate($img, 0, 0, 0); + imagestring($img, 4, 15, 8, $example, $ecriture_color); + + ob_start(); + imagepng($img); + $image_data = ob_get_contents(); + ob_end_clean(); + + return ''; } diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 7b18cc1a4e9..f6dd6b91659 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -40,6 +40,27 @@ if ($size > 10000) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +' +@phan-var-force string $captcha_refresh +@phan-var-force int<0,1> $dol_hide_leftmenu +@phan-var-force int<0,1> $dol_hide_topmenu +@phan-var-force int<0,1> $dol_no_mouse_hover +@phan-var-force int<0,1> $dol_optimize_smallscreen +@phan-var-force int<0,1> $dol_use_jmobile +@phan-var-force string $focus_element +@phan-var-force string $helpcenterlink +@phan-var-force string $login +@phan-var-force string $main_authentication +@phan-var-force string $main_home +@phan-var-force string $password +@phan-var-force string $session_name +@phan-var-force string $titletruedolibarrversion +@phan-var-force string $urllogo + +@phan-var-force int<0,1> $forgetpasslink +@phan-var-force int<0,1> $helpcenterlink +'; + header('Cache-Control: Public, must-revalidate'); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 1b285a13dff..2a5591a86cc 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -1,8 +1,8 @@ - * Copyright (C) 2013-2014 Laurent Destailleur - * Copyright (C) 2015 Marcos García - * Copyright (C) 2024 MDW +/* Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2013-2014 Laurent Destailleur + * Copyright (C) 2015 Marcos García + * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -415,8 +415,11 @@ if ($massaction == 'preapproveleave') { } // Allow Pre-Mass-Action hook (eg for confirmation dialog) +if (empty($toselect)) { + $toselect=[]; +} $parameters = array( - 'toselect' => isset($toselect) ? $toselect : array(), + 'toselect' => &$toselect, 'uploaddir' => isset($uploaddir) ? $uploaddir : null, 'massaction' => $massaction ); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 2161f41709a..ecb9e2cc670 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -41,6 +41,13 @@ if (empty($object) || !is_object($object)) { exit(1); } +' +@phan-var-force Propal|Contrat|Commande|Facture|Expedition|Delivery|FactureFournisseur|FactureFournisseur|SupplierProposal $object +@phan-var-force PropaleLigne|ContratLigne|CommonObjectLine|CommonInvoiceLine|CommonOrderLine|ExpeditionLigne|DeliveryLine|FactureFournisseurLigneRec|SupplierInvoiceLine|SupplierProposalLine $line +@phan-var-force ThirdParty $seller +@phan-var-force ThirdParty $buyer +@phan-var-force string $var +'; $usemargins = 0; if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) { @@ -208,6 +215,7 @@ $coldisplay++; // VAT Rate $coldisplay++; + $type_tva = null; if ($object->element == 'propal' || $object->element == 'commande' || $object->element == 'facture' || $object->element == 'facturerec') { $type_tva = 1; } elseif ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') { @@ -369,6 +377,8 @@ $coldisplay++; trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> lines) && $i > 0) { for ($j = $i - 1; $j >= 0; $j--) { $lastline = $object->lines[$j]; diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e3fef9eebbc..328a4c5748f 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -46,10 +46,15 @@ if (empty($object) || !is_object($object)) { exit(1); } -'@phan-var-force CommonObject $this - @phan-var-force CommonObject $object - @phan-var-force 0|1 $forceall - @phan-var-force int $num +' +@phan-var-force PropaleLigne|ContratLigne|CommonObjectLine|CommonInvoiceLine|CommonOrderLine|ExpeditionLigne|DeliveryLine|FactureFournisseurLigneRec|SupplierInvoiceLine|SupplierProposalLine $line +@phan-var-force CommonObject $this +@phan-var-force Propal|Contrat|Commande|Facture|Expedition|Delivery|FactureFournisseur|FactureFournisseur|SupplierProposal $object +@phan-var-force 0|1 $forceall +@phan-var-force int $num +@phan-var-force ?Product $product_static +@phan-var-force string $text +@phan-var-force string $description '; global $mysoc; @@ -464,9 +469,14 @@ if ($this->status == 0 && $tmppermtoedit && $action != 'selectlines') { if (isModEnabled('asset') && $object->element == 'invoice_supplier') { print ''; $coldisplay++; - if (!empty($product_static->accountancy_code_buy) || - !empty($product_static->accountancy_code_buy_intra) || - !empty($product_static->accountancy_code_buy_export) + if ( + $product_static !== null + && + ( + !empty($product_static->accountancy_code_buy) || + !empty($product_static->accountancy_code_buy_intra) || + !empty($product_static->accountancy_code_buy_export) + ) ) { $accountancy_category_asset = getDolGlobalString('ASSET_ACCOUNTANCY_CATEGORY'); $filters = array(); diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index f0d32aba003..386cbb9b8ef 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -1,15 +1,14 @@ +/* Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2011-2014 Juanjo Menent - * Copyright (C) 2013 Cedric GROSS + * Copyright (C) 2013 Cedric GROSS * Copyright (C) 2014 Marcos García - * Copyright (C) 2015 Bahfir Abbes - * Copyright (C) 2022 Ferran Marcet - * Copyright (C) 2023 William Mead - * Copyright (C) 2023 Christian Foellmann - * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2022 Ferran Marcet + * Copyright (C) 2023-2024 William Mead + * Copyright (C) 2023 Christian Foellmann + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,6 +104,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Actions if ($action == 'COMPANY_CREATE') { + '@phan-var-force Societe $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -122,6 +122,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); $object->socid = $object->id; } elseif ($action == 'COMPANY_MODIFY') { + '@phan-var-force Societe $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -144,6 +145,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); $object->socid = $object->id; } elseif ($action == 'COMPANY_SENTBYMAIL') { + '@phan-var-force Societe $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -158,6 +160,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'CONTACT_CREATE') { + '@phan-var-force Contact $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -175,6 +178,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array($object->id => $object->id); // $object->socid = $object->socid; } elseif ($action == 'CONTACT_MODIFY') { + '@phan-var-force Contrat $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "companies")); @@ -192,6 +196,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array($object->id => $object->id); // $object->socid = $object->socid; } elseif ($action == 'CONTRACT_VALIDATE') { + '@phan-var-force Contrat $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "contracts")); @@ -208,6 +213,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'CONTRACT_SENTBYMAIL') { + '@phan-var-force Contrat $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "contracts")); @@ -225,6 +231,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'PROPAL_VALIDATE') { + '@phan-var-force Propal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -241,6 +248,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROPAL_MODIFY') { + '@phan-var-force Propal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -257,6 +265,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROPAL_SENTBYMAIL') { + '@phan-var-force Propal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -274,6 +283,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'PROPAL_CLOSE_SIGNED') { + '@phan-var-force Propal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -290,6 +300,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROPAL_CLASSIFY_BILLED') { + '@phan-var-force Propal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -306,6 +317,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROPAL_CLOSE_REFUSED') { + '@phan-var-force Propal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -322,6 +334,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'ORDER_VALIDATE') { + '@phan-var-force Commande $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "orders")); @@ -338,6 +351,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'ORDER_CLOSE') { + '@phan-var-force Commande $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -354,6 +368,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'ORDER_CLASSIFY_BILLED') { + '@phan-var-force Commande $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -370,6 +385,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'ORDER_CANCEL') { + '@phan-var-force Commande $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -386,6 +402,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'ORDER_SENTBYMAIL') { + '@phan-var-force Commande $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -403,6 +420,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'BILL_VALIDATE') { + '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -419,6 +437,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'BILL_UNVALIDATE') { + '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -435,6 +454,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'BILL_SENTBYMAIL') { + '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -452,6 +472,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'BILL_PAYED') { + '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -469,6 +490,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'BILL_CANCEL') { + '@phan-var-force Facture $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -485,6 +507,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'FICHINTER_CREATE') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -503,6 +526,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->fk_element = 0; $object->elementtype = ''; } elseif ($action == 'FICHINTER_VALIDATE') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -521,6 +545,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->fk_element = 0; $object->elementtype = ''; } elseif ($action == 'FICHINTER_MODIFY') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -539,6 +564,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->fk_element = 0; $object->elementtype = ''; } elseif ($action == 'FICHINTER_SENTBYMAIL') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -556,6 +582,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'FICHINTER_CLASSIFY_BILLED') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -572,6 +599,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -588,6 +616,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'FICHINTER_CLOSE') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -606,6 +635,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->fk_element = 0; $object->elementtype = ''; } elseif ($action == 'FICHINTER_DELETE') { + '@phan-var-force Fichinter $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "interventions")); @@ -624,6 +654,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->fk_element = 0; $object->elementtype = ''; } elseif ($action == 'SHIPPING_VALIDATE') { + '@phan-var-force Expedition $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "sendings")); @@ -641,6 +672,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'SHIPPING_SENTBYMAIL') { + '@phan-var-force Expedition $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "sendings")); @@ -658,6 +690,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'RECEPTION_VALIDATE') { + '@phan-var-force Reception $object'; $langs->load("agenda"); $langs->load("other"); $langs->load("receptions"); @@ -676,6 +709,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'RECEPTION_SENTBYMAIL') { + '@phan-var-force Reception $object'; $langs->load("agenda"); $langs->load("other"); $langs->load("receptions"); @@ -694,6 +728,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') { + '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -710,6 +745,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') { + '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -727,6 +763,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') { + '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -743,6 +780,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') { + '@phan-var-force SupplierProposal $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "propal")); @@ -776,6 +814,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { + '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -853,6 +892,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') { + '@phan-var-force CommandeFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "orders")); @@ -943,6 +983,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'BILL_SUPPLIER_VALIDATE') { + '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -959,6 +1000,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') { + '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -975,6 +1017,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') { + '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills", "orders")); @@ -992,6 +1035,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'BILL_SUPPLIER_PAYED') { + '@phan-var-force FactureFournisseur $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "bills")); @@ -1024,6 +1068,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'MEMBER_VALIDATE') { + '@phan-var-force Adherent $object'; // Members // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1043,6 +1088,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'MEMBER_MODIFY') { + '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1061,6 +1107,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') { + '@phan-var-force Subscription $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1092,6 +1139,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->socid = $object->fk_soc; } } elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') { + '@phan-var-force Subscription $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1122,6 +1170,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->socid = $object->fk_soc; } } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') { + '@phan-var-force Subscription $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1153,6 +1202,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->socid = $object->fk_soc; } } elseif ($action == 'MEMBER_RESILIATE') { + '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1171,6 +1221,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'MEMBER_DELETE') { + '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1189,6 +1240,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'MEMBER_EXCLUDE') { + '@phan-var-force Adherent $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -1207,6 +1259,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROJECT_CREATE') { + '@phan-var-force Project $object'; // Projects // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1225,6 +1278,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROJECT_VALIDATE') { + '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1242,6 +1296,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROJECT_MODIFY') { + '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1263,6 +1318,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'PROJECT_SENTBYMAIL') { + '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1280,6 +1336,7 @@ class InterfaceActionsAuto extends DolibarrTriggers // Parameters $object->sendtoid defined by caller //$object->sendtoid = array(); } elseif ($action == 'PROJECT_DELETE') { + '@phan-var-force Project $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1306,6 +1363,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'TASK_CREATE') { + '@phan-var-force Task $object'; // Project tasks // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1324,6 +1382,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'TASK_MODIFY') { + '@phan-var-force Task $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1341,6 +1400,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'TASK_DELETE') { + '@phan-var-force Task $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1358,6 +1418,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = array(); } elseif ($action == 'TICKET_ASSIGNED') { + '@phan-var-force Ticket $object'; // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -1509,7 +1570,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $contactforactionid = reset($object->sendtoid); } } else { - if ($object->sendtoid > 0) { + if ($object->sendtoid > 0) { // @phan-suppress-current-line PhanTypeComparisonFromArray $contactforactionid = $object->sendtoid; } } @@ -1524,6 +1585,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $projectid = isset($object->fk_project) ? $object->fk_project : 0; if ($object->element == 'project') { + '@phan-var-force Project $object'; $projectid = $object->id; } @@ -1531,6 +1593,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $elementtype = $object->element; $elementmodule = (empty($object->module) ? '' : $object->module); if ($object->element == 'subscription') { + '@phan-var-force Subscription $object'; $elementid = $object->fk_adherent; $elementtype = 'member'; } @@ -1552,8 +1615,9 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->contact_id = $contactforactionid; // deprecated, now managed by setting $actioncomm->socpeopleassigned later $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action - // Fields defined when action is an email (content should be into object->actionmsg to be added into event note, subject should be into object->actionms2 to be added into event label) + // Fields defined when action is an email (content should be into object->actionmsg to be added into event note, subject should be into object->actionmsg2 to be added into event label) if (!property_exists($object, 'email_fields_no_propagate_in_actioncomm') || empty($object->email_fields_no_propagate_in_actioncomm)) { + '@phan-var-force ActionComm $object'; // TODO: Non of the dolibarr classes has all the fields, check class type or properties (email_date) $actioncomm->datep = empty($object->email_date) ? $now : $object->email_date; $actioncomm->datef = empty($object->email_date) ? $now : $object->email_date; $actioncomm->email_msgid = empty($object->email_msgid) ? null : $object->email_msgid; @@ -1573,13 +1637,19 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->elementtype = $elementtype.($elementmodule ? '@'.$elementmodule : ''); } + // @phan-suppress-next-line PhanUndeclaredProperty if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) { + // @phan-suppress-next-line PhanUndeclaredProperty $actioncomm->attachedfiles = $object->attachedfiles; } + // @phan-suppress-next-line PhanUndeclaredProperty if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) { + // @phan-suppress-next-line PhanUndeclaredProperty $actioncomm->userassigned = $object->sendtouserid; } + // @phan-suppress-next-line PhanUndeclaredProperty if (property_exists($object, 'sendtoid') && is_array($object->sendtoid) && count($object->sendtoid) > 0) { + // @phan-suppress-next-line PhanUndeclaredProperty foreach ($object->sendtoid as $val) { $actioncomm->socpeopleassigned[$val] = $val; } @@ -1588,13 +1658,17 @@ class InterfaceActionsAuto extends DolibarrTriggers $ret = $actioncomm->create($user); // User creating action if ($ret > 0 && getDolGlobalString('MAIN_COPY_FILE_IN_EVENT_AUTO')) { + // @phan-suppress-next-line PhanUndeclaredProperty if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) { + // Note: None of the dolibarr classes seem to have an attachedfiles property // Get directory of object $tmpelems = getElementProperties($object->element.($object->module ? '@'.$object->module : '')); $destdir = $tmpelems['dir_output'].'/'.$ret; + // @phan-suppress-next-line PhanUndeclaredProperty foreach ($object->attachedfiles['paths'] as $key => $filespath) { $srcfile = $filespath; + // @phan-suppress-next-line PhanUndeclaredProperty $destfile = $destdir.'/'.$object->attachedfiles['names'][$key]; if (dol_mkdir($destdir) >= 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 6dedf4f6ebd..dcc64cb67db 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -273,7 +273,7 @@ class Delivery extends CommonObject * Create a line * * @param int $origin_id Id of order - * @param string $qty Quantity + * @param float $qty Quantity * @param int $fk_product Id of predefined product * @param string $description Description * @param array $array_options Array options @@ -637,8 +637,6 @@ class Delivery extends CommonObject */ public function addline($origin_id, $qty, $array_options = []) { - global $conf; - $num = count($this->lines); $line = new DeliveryLine($this->db); @@ -763,8 +761,8 @@ class Delivery extends CommonObject $datas = []; - $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ShowReceiving").':
'; - $datas['picto'] .= ''.$langs->trans("Status").': '.$this->ref; + $datas['picto'] = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly').' '.$langs->trans("ShowReceiving").':
'; + $datas['ref'] = ''.$langs->trans("Ref").': '.$this->ref; return $datas; } diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index f29fd4d2c86..a34c5dddc83 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -9,6 +9,7 @@ * Copyright (C) 2017-2022 Ferran Marcet * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -675,7 +676,7 @@ if ($object->id > 0 || !empty($object->ref)) { print "\n"; } - $nbfreeproduct = 0; // Nb of lins of free products/services + $nbfreeproduct = 0; // Nb of lines of free products/services $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 7a7b0f1fc54..29f442313ec 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -61,7 +61,7 @@ class Fichinter extends CommonObject 'dateo' => array('type' => 'date', 'label' => 'Dateo', 'enabled' => 1, 'visible' => -1, 'position' => 85), 'datee' => array('type' => 'date', 'label' => 'Datee', 'enabled' => 1, 'visible' => -1, 'position' => 90), 'datet' => array('type' => 'date', 'label' => 'Datet', 'enabled' => 1, 'visible' => -1, 'position' => 95), - 'duree' => array('type' => 'double', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100), + 'duree' => array('type' => 'integer', 'label' => 'Duree', 'enabled' => 1, 'visible' => -1, 'position' => 100), 'signed_status' => array('type' => 'smallint(6)', 'label' => 'SignedStatus', 'enabled' => 1, 'visible' => -1, 'position' => 101, 'arrayofkeyval' => array(0 => 'NoSignature', 1 => 'SignedSender', 2 => 'SignedReceiver', 3 => 'SignedReceiverOnline', 9 => 'SignedAll')), 'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'visible' => -1, 'position' => 105, 'showoncombobox' => 2), 'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110), @@ -83,11 +83,6 @@ class Fichinter extends CommonObject */ public $table_element = 'fichinter'; - /** - * @var string Field with ID of parent key if this field has a parent - */ - public $fk_element = 'fk_fichinter'; - /** * @var string Name of subtable line */ @@ -139,7 +134,7 @@ class Fichinter extends CommonObject /** * Date modification record (tms) * - * @var integer + * @var int */ public $datem; @@ -1122,7 +1117,7 @@ class Fichinter extends CommonObject if (!$error) { $main = MAIN_DB_PREFIX.'fichinterdet'; $ef = $main."_extrafields"; - $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = ".((int) $this->id).")"; + $sql = "DELETE FROM ".$this->db->sanitize($ef)." WHERE fk_object IN (SELECT rowid FROM ".$this->db->sanitize($main)." WHERE fk_fichinter = ".((int) $this->id).")"; $resql = $this->db->query($sql); if (!$resql) { diff --git a/htdocs/fichinter/class/fichinterligne.class.php b/htdocs/fichinter/class/fichinterligne.class.php index 32e05c7a418..6b87b1a9c73 100644 --- a/htdocs/fichinter/class/fichinterligne.class.php +++ b/htdocs/fichinter/class/fichinterligne.class.php @@ -47,8 +47,7 @@ class FichinterLigne extends CommonObjectLine public $error = ''; /** - * From llx_fichinterdet - * @var int ID + * @var int ID of intervention (field from llx_fichinterdet) */ public $fk_fichinter; diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index 8b75dd0fcc3..c8fae403ec2 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -45,11 +45,6 @@ class FichinterRec extends Fichinter public $table_element = 'fichinter_rec'; public $table_element_line = 'fichinterdet_rec'; - /** - * @var string Fieldname with ID of parent key if this field has a parent - */ - public $fk_element = 'fk_fichinter'; - /** * {@inheritdoc} */ diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 8e5b56d0ce7..1dafc2f7679 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -294,7 +294,7 @@ class Skill extends CommonObject if (!$error) { $this->db->commit(); - setEventMessage($langs->trans('SkillCreated', $i)); + setEventMessage($langs->trans('SkillCreated', $i - 1)); return 1; } else { $this->db->rollback(); diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index 9f837d65270..affd6b8a40b 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -706,7 +706,7 @@ while ($i < $imaxinloop) { } elseif ($key == 'rowid') { print $object->showOutputField($val, $key, $object->id, ''); } elseif ($key == 'label') { - print $object->getNomUrl(1); + print $object->showOutputField($val, $key, $object->label, ''); } else { print $object->showOutputField($val, $key, $object->$key, ''); } diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 1cd35d8a8cd..036f52e55ba 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -128,13 +128,34 @@ if (empty($reshook)) { $triggermodname = 'HRM_SKILL_MODIFY'; // Name of trigger action code to execute when we modify record + // action update on Skilldet must be done before real update action in core/actions_addupdatedelete.inc.php + $skilldetArray = GETPOST("descriptionline", "array:alphanohtml"); + if (!$error) { + if (is_array($skilldetArray) && count($skilldetArray) > 0) { + if ($action == 'update' && $permissiontoadd) { + foreach ($skilldetArray as $key => $SkValueToUpdate) { + $skilldetObj = new Skilldet($object->db); + $res = $skilldetObj->fetch($key); + if ($res > 0) { + $skilldetObj->description = $SkValueToUpdate; + $resupd = $skilldetObj->update($user); + if ($resupd <= 0) { + setEventMessage($langs->trans('errorUpdateSkilldet'), 'errors'); + $error++; + } + } + } + } + } + } // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen $noback = 1; - include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + if (in_array($action, array("confirm_delete", "update"))) { + $noback = 0; + } - // action update on Skilldet - $skilldetArray = GETPOST("descriptionline", "array:alphanohtml"); + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; if (!$error) { if (is_array($skilldetArray) && count($skilldetArray) > 0) { @@ -153,19 +174,8 @@ if (empty($reshook)) { } $index++; } - } - if ($action == 'update' && $permissiontoadd) { - foreach ($skilldetArray as $key => $SkValueToUpdate) { - $skilldetObj = new Skilldet($object->db); - $res = $skilldetObj->fetch($key); - if ($res > 0) { - $skilldetObj->description = $SkValueToUpdate; - $resupd = $skilldetObj->update($user); - if ($resupd <= 0) { - setEventMessage($langs->trans('errorUpdateSkilldet'), 'errors'); - } - } - } + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); + exit; } } } diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index 14af4528708..f2e059652de 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -444,7 +444,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($objecttype != 'user' && $permissiontoadd) { print ''; print ''; - print 'rowid . '">'; + print 'rowid . '&token='.newToken().'">'; print img_delete(); print ''; } diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index c8b257eefcc..ee2449ce74c 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -113,7 +113,7 @@ TicketsLimitViewAssignedOnlyHelp=Only tickets assigned to the current user will TicketsActivatePublicInterface=Activate public interface TicketsActivatePublicInterfaceHelp=Public interface allow any visitors to create tickets. TicketsAutoAssignTicket=Automatically assign the user who created the ticket -TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket. +TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automatically assigned to the ticket(Examples: 0=Never automatically assigned to the ticket, 1=Automatically assigned to the ticket if no one is assigned, 2=Automatically assigned to the ticket even if someone was defined). TicketAutoChangeStatusOnAnswer=Automatically assign a status when answering a ticket TicketAutoChangeStatusOnAnswerHelp=When a user answers to a ticket, the status will automatically be applied to the ticket TicketNumberingModules=Tickets numbering module diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index fa752615ad2..ab99b57ec2c 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -221,7 +221,7 @@ class modMyModule extends DolibarrModules /* Example: $this->dictionaries=array( 'langs' => 'mymodule@mymodule', - // List of tables we want to see into dictonnary editor + // List of tables we want to see into dictionary editor 'tabname' => array("table1", "table2", "table3"), // Label of tables 'tablib' => array("Table1", "Table2", "Table3"), diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 8b45888d3ea..98051f76b42 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -298,7 +298,7 @@ class FormProduct dol_syslog(get_class($this)."::selectWarehouses " . (is_array($selected) ? 'selected is array' : $selected) . ", $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG); $out = ''; - if (!getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { + if ((!getDolGlobalString('ENTREPOT_EXTRA_STATUS')) && ($filterstatus==="warehouseinternal")) { $filterstatus = ''; } if (!empty($fk_product) && $fk_product > 0) { diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 14384709182..50b78c18ae6 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -68,8 +68,8 @@ $resultboxes = FormOther::getBoxesArea($user, "4"); if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled) require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; - $zone = GETPOST('areacode', 'int'); - $userid = GETPOST('userid', 'int'); + $zone = GETPOSTINT('areacode'); + $userid = GETPOSTINT('userid'); $boxorder = GETPOST('boxorder', 'aZ09'); $boxorder .= GETPOST('boxcombo', 'aZ09'); $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid); diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 801e300fc2c..b368d21aab8 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -632,7 +632,7 @@ if (!empty($arrayfields['timeconsumed']['checked'])) { print ''.$langs->trans("TimeSpentSmall").($usertoprocess->firstname ? '
'.$usertoprocess->getNomUrl(-2).''.dol_trunc($usertoprocess->firstname, 10).'' : '').''; } foreach ($TWeek as $week_number) { - print ''.$langs->trans("WeekShort").' '.$week_number.'
('.$TFirstDays[$week_number].'...'.$TLastDays[$week_number].')'; + print ''.$langs->trans("WeekShort").' '.$week_number.'
('.$TFirstDays[$week_number].'...'.$TLastDays[$week_number].')
'; } //print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index b670c2ae963..97aa291a3d3 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -694,9 +694,14 @@ for ($idw = 0; $idw < 7; $idw++) { $cssonholiday .= 'onholidayafternoon '; } + $year = (int) dol_print_date($dayinloopfromfirstdaytoshow, '%Y'); + $month = (int) dol_print_date($dayinloopfromfirstdaytoshow, '%m'); + $day = (int) dol_print_date($dayinloopfromfirstdaytoshow, '%d'); + print ''; + print ''; print dol_print_date($dayinloopfromfirstdaytoshow, '%a'); - print '
'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').''; + print '
'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').'
'; } //print ''; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 3d8db1970c6..709a817c7f9 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -715,10 +715,12 @@ if ($event->type == 'payout.created') { $companypaymentmode->number = $event->data->object->id; $companypaymentmode->last_four = $event->data->object->card->last4; $companypaymentmode->card_type = $event->data->object->card->branding; + $companypaymentmode->owner_name = $event->data->object->billing_details->name; - $companypaymentmode->proprio = $companypaymentmode->owner_name; // We still need this formodulebuilder because name of field is "proprio" - $companypaymentmode->exp_date_month = $event->data->object->card->exp_month; - $companypaymentmode->exp_date_year = $event->data->object->card->exp_year; + $companypaymentmode->proprio = $companypaymentmode->owner_name; // We may still need this formodulebuilder because name of field is "proprio" + + $companypaymentmode->exp_date_month = (int) $event->data->object->card->exp_month; + $companypaymentmode->exp_date_year = (int) $event->data->object->card->exp_year; $companypaymentmode->cvn = null; $companypaymentmode->datec = $event->data->object->created; $companypaymentmode->default_rib = 0; @@ -755,8 +757,8 @@ if ($event->type == 'payout.created') { $companypaymentmode->number = $db->escape($event->data->object->id); $companypaymentmode->last_four = $db->escape($event->data->object->card->last4); $companypaymentmode->proprio = $db->escape($event->data->object->billing_details->name); - $companypaymentmode->exp_date_month = $db->escape($event->data->object->card->exp_month); - $companypaymentmode->exp_date_year = $db->escape($event->data->object->card->exp_year); + $companypaymentmode->exp_date_month = (int) $event->data->object->card->exp_month; + $companypaymentmode->exp_date_year = (int) $event->data->object->card->exp_year; $companypaymentmode->cvn = null; $companypaymentmode->datec = $db->escape($event->data->object->created); $companypaymentmode->default_rib = 0; diff --git a/htdocs/reception/dispatch.php b/htdocs/reception/dispatch.php index e3a0266cf2f..e53b525be55 100644 --- a/htdocs/reception/dispatch.php +++ b/htdocs/reception/dispatch.php @@ -586,7 +586,7 @@ if ($id > 0 || !empty($ref)) { print "\n"; } - $nbfreeproduct = 0; // Nb of lins of free products/services + $nbfreeproduct = 0; // Nb of lines of free products/services $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 3944e3283f2..8357653f038 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -1,12 +1,12 @@ - * Copyright (C) 2014-2020 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Charlie BENKE - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2023 Maxime Nicolas - * Copyright (C) 2023 Benjamin GREMBI +/* Copyright (C) 2011-2024 Alexandre Spangaro + * Copyright (C) 2014-2020 Laurent Destailleur + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2023 Maxime Nicolas + * Copyright (C) 2023 Benjamin GREMBI * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -1115,28 +1115,30 @@ if ($id > 0) { } // Reopen - if ($object->paye && $permissiontoadd) { + if ($object->status == $object::STATUS_PAID && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, ''); } // Edit - if ($object->paye == 0 && $permissiontoadd) { + if ($object->status == $object::STATUS_UNPAID && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id, ''); } // Emit payment - if ($object->paye == 0 && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) { + if ($object->status == $object::STATUS_UNPAID && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='. $object->id, ''); } // Classify 'paid' // If payment complete $resteapayer <= 0 on a positive salary, or if amount is negative, we allow to classify as paid. - if ($object->paye == 0 && (($resteapayer <= 0 && $object->amount > 0) || ($object->amount <= 0)) && $permissiontoadd) { + if ($object->status == $object::STATUS_UNPAID && (($resteapayer <= 0 && $object->amount > 0) || ($object->amount <= 0)) && $permissiontoadd) { print dolGetButtonAction('', $langs->trans('ClassifyPaid'), 'default', $_SERVER["PHP_SELF"].'?action=paid&token='.newToken().'&id='.$object->id, ''); } // Transfer request - print dolGetButtonAction('', $langs->trans('MakeTransferRequest'), 'default', DOL_URL_ROOT.'/salaries/virement_request.php?id='.$object->id, ''); + if ($object->status == $object::STATUS_UNPAID && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) { + print dolGetButtonAction('', $langs->trans('MakeTransferRequest'), 'default', DOL_URL_ROOT . '/salaries/virement_request.php?id=' . $object->id, ''); + } // Clone if ($permissiontoadd) { @@ -1196,7 +1198,7 @@ if ($id > 0) { print ''; } - //Select mail models is same action as presend + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 64269370560..2f15018a85c 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -1,8 +1,8 @@ - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2011-2024 Alexandre Spangaro + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -366,6 +366,7 @@ class PaymentSalary extends CommonObject $this->datec = $this->db->jdate($obj->datec); $this->tms = $this->db->jdate($obj->tms); $this->datepaye = $this->db->jdate($obj->datep); + $this->datep = $this->db->jdate($obj->datep); $this->amount = $obj->amount; $this->fk_typepayment = $obj->fk_typepayment; $this->num_paiement = $obj->num_payment; diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index 95696e6ef7d..c20466fcb70 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -1,12 +1,12 @@ - * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW - * Copyright (C) 2024 Alexandre SPANGARO - * Copyright (C) 2024 Frédéric France +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Alexandre SPANGARO + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index a2733f878b4..e3c85b76ca4 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -1,9 +1,10 @@ - * Copyright (C) 2015 Charlie BENKE - * Copyright (C) 2017-2019 Alexandre Spangaro +/* Copyright (C) 2005-2015 Laurent Destailleur + * Copyright (C) 2015 Charlie BENKE + * Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 3ee8442bf3d..a27f7c3504a 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -166,13 +166,34 @@ class CompanyBankAccount extends Account * @var string label */ public $label; + /** + * @var string + */ public $code_banque; + /** + * @var string + */ public $code_guichet; + /** + * @var string + */ public $number; + /** + * @var string + */ public $cle_rib; + /** + * @var string + */ public $bic; + /** + * @var string + */ public $iban_prefix; + /** + * @var string + */ public $bank; /** @@ -185,6 +206,9 @@ class CompanyBankAccount extends Account */ public $fk_country; + /** + * @var string + */ public $country_code; /** @@ -213,22 +237,58 @@ class CompanyBankAccount extends Account * @var string */ public $frstrecur; + /** + * @var string + */ public $import_key; + /** + * @var string + */ public $last_four; + /** + * @var string + */ public $card_type; + /** + * @var string + */ public $cvn; + /** + * @var int + */ public $exp_date_month; + /** + * @var int + */ public $exp_date_year; + /** + * @var int + */ public $approved; /** * @var string email */ public $email; + /** + * @var int|string + */ public $ending_date; + /** + * @var float + */ public $max_total_amount_of_all_payments; + /** + * @var string + */ public $preapproval_key; + /** + * @var int|string + */ public $starting_date; + /** + * @var float + */ public $total_amount_of_all_payments; diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 4b6da9bbcab..6c3a910f1e5 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -131,53 +131,145 @@ class CompanyPaymentMode extends CommonObject */ public $label; + /** + * @var ?string + */ public $bank; + /** + * @var string + */ public $code_banque; + /** + * @var string + */ public $code_guichet; + /** + * @var string + */ public $number; + /** + * @var string + */ public $cle_rib; + /** + * @var string + */ public $bic; /** * @var string iban - * @deprecated + * @deprecated Use $iban_prefix, or wait the field in database is renamed into iban. * @see $iban_prefix */ public $iban; /** - * iban_prefix - * @var string + * @var string IBAN prefix */ public $iban_prefix; - /** @deprecated Use address */ + /** + * @var string + * @deprecated Use address + */ public $domiciliation; + + /** + * @var string + */ public $address; - /** @deprecated Use owner_name*/ + + /** + * @var string + * @deprecated Use owner_name + */ public $proprio; + + /** + * @var string + */ public $owner_name; + /** + * @var string + */ public $owner_address; + /** + * @var int + */ public $default_rib; + /** + * @var string + */ public $rum; + /** + * @var int + */ public $date_rum; + /** + * @var string + */ public $frstrecur; + /** + * @var string + */ public $type; + /** + * @var string + */ public $last_four; + /** + * @var string + */ public $card_type; + /** + * @var ?string + */ public $cvn; + /** + * @var int + */ public $exp_date_month; + /** + * @var int + */ public $exp_date_year; + /** + * @var string + */ public $country_code; + /** + * @var int + */ public $approved; + /** + * @var string + */ public $email; + /** + * @var float + */ public $max_total_amount_of_all_payments; + /** + * @var string + */ public $preapproval_key; + /** + * @var float + */ public $total_amount_of_all_payments; + /** + * @var string + */ public $stripe_card_ref; // External system payment mode ID + /** + * @var string + */ public $stripe_account; // External system customer ID + /** + * @var string + */ public $ext_payment_site; // External system 'StripeLive', 'StripeTest', 'StancerLive', 'StancerTest', ... /** @@ -185,16 +277,25 @@ class CompanyPaymentMode extends CommonObject */ public $status; + /** + * @var int + */ public $starting_date; + /** + * @var int + */ public $ending_date; /** * Date creation record (datec) * - * @var integer + * @var int */ public $datec; + /** + * @var string + */ public $import_key; // END MODULEBUILDER PROPERTIES @@ -355,11 +456,11 @@ class CompanyPaymentMode extends CommonObject /** * Return a link to the object card (with optionally the picto) * - * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param string $option On what the link point to ('nolink', ...) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int<0,2> $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int<0,1> $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) @@ -424,9 +525,9 @@ class CompanyPaymentMode extends CommonObject /** * Set a Payment mode as Default * - * @param int $id Payment mode ID - * @param int $alltypes 1=The default is for all payment types instead of per type - * @return int 0 if KO, 1 if OK + * @param int $id Payment mode ID + * @param int<0,1> $alltypes 1=The default is for all payment types instead of per type + * @return int 0 if KO, 1 if OK */ public function setAsDefault($id = 0, $alltypes = 0) { @@ -482,8 +583,8 @@ class CompanyPaymentMode extends CommonObject /** * Return label of the status * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label of status */ public function getLibStatut($mode = 0) { @@ -494,8 +595,8 @@ class CompanyPaymentMode extends CommonObject /** * Return the status * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @param int $status Id status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ public function LibStatut($status, $mode = 0) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index c12b9d268ac..41d5b95f205 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -94,10 +94,12 @@ $stripe = null; // Stripe object $stripeacc = null; // Stripe Account $stripecu = null; // Remote stripe customer +$servicestatus = 0; +$site_account = 'UnknownSiteAccount'; + // Init Stripe objects if (isModEnabled('stripe')) { $service = 'StripeTest'; - $servicestatus = 0; if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; $servicestatus = 1; @@ -168,7 +170,8 @@ if (empty($reshook)) { } if (!$error) { - $companybankaccount->oldcopy = dol_clone($companybankaccount, 2); + $cbClassName = get_class($companybankaccount); + $cbClassName::$oldcopy = dol_clone($companybankaccount, 2); $companybankaccount->socid = $object->id; @@ -245,7 +248,8 @@ if (empty($reshook)) { $companypaymentmode->fetch($id); if (!$error) { - $companybankaccount->oldcopy = dol_clone($companybankaccount, 2); + $cbClassName = get_class($companybankaccount); + $cbClassName::$oldcopy = dol_clone($companybankaccount, 2); $companypaymentmode->fk_soc = $object->id; @@ -906,7 +910,7 @@ if (!$id) { // @phan-suppress-next-line PhanPluginSuspiciousParamPosition $companybankaccount->fetch(0, '', $object->id); // @phan-suppress-next-line PhanPluginSuspiciousParamPosition - $companypaymentmode->fetch(0, null, $object->id, 'card'); + $companypaymentmode->fetch(0, '', $object->id, 'card'); } else { $companybankaccount->fetch($id); $companypaymentmode->fetch($id); @@ -1143,6 +1147,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // Get list of remote payment modes $listofsources = array(); + $customerstripe = null; if (isset($stripe) && is_object($stripe)) { try { $customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus); @@ -1632,14 +1637,14 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // } elseif ($val == 'IBAN') { // $string .= $rib->iban.' ';*/ //} - } - if (!empty($rib->label) && $rib->number) { - if (!checkBanForAccount($rib)) { - $string .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning'); - } else { - $string .= ' '.img_picto($langs->trans("ValueIsValid"), 'info'); + if (!empty($rib->label) && $rib->number) { + if (!checkBanForAccount($rib)) { + $string .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning'); + } else { + $string .= ' '.img_picto($langs->trans("ValueIsValid"), 'info'); + } } - } + } // EndFor $rib_list as $rib print ''; print $string; print ''; @@ -1722,7 +1727,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($conf->browser->layout == 'phone') { $morecss = 'maxwidth100'; } - $out .= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss); + $out .= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, array(), 0, 0, 0, $morecss); } // Button $out .= 'fetch(0, null, $object->id, 'ban'); + $result = $companypaymentmodetemp->fetch(0, '', $object->id, 'ban'); include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; $ecmfile = new EcmFiles($db); @@ -1995,6 +2000,9 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { foreach ($bankaccount->getFieldsToShow(1) as $val) { $require = false; $tooltip = ''; + $name = 'Unset'; + $size = 8; + $content = 'NoContent'; if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; @@ -2032,6 +2040,7 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { print ''; print ''; if ($tooltip) { + // $tooltip looks like $tooltiptrigger so: @phan-suppress-next-line PhanPluginSuspiciousParamOrder print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name); } else { print $langs->trans($val); @@ -2167,6 +2176,9 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { foreach ($companybankaccount->getFieldsToShow(1) as $val) { $require = false; $tooltip = ''; + $size = 8; + $name = 'Unknown'; + $content = 'NoContent'; if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; @@ -2203,6 +2215,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print ''; if ($tooltip) { + // tooltip lookslike tooltip trigger so @phan-suppress-next-line PhanPluginSuspiciousParamOrder print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name); } else { print $langs->trans($val); diff --git a/htdocs/stripe/ajax/ajax.php b/htdocs/stripe/ajax/ajax.php index e7b9da70a3a..dadc639f0d9 100644 --- a/htdocs/stripe/ajax/ajax.php +++ b/htdocs/stripe/ajax/ajax.php @@ -110,7 +110,7 @@ if ($action == 'getConnexionToken') { $stripe = new Stripe($db); $customer = $stripe->customerStripe($object->thirdparty, $stripeacc, $servicestatus, 1); - $intent = $stripe->getPaymentIntent($json_obj->amount, $object->multicurrency_code, null, 'Stripe payment: '.$fulltag.(is_object($object) ? ' ref='.$object->ref : ''), $object, $customer, $stripeacc, $servicestatus, 1, 'terminal', false, null, 0, 1); + $intent = $stripe->getPaymentIntent($json_obj->amount, $object->multicurrency_code, '', 'Stripe payment: '.$fulltag.(is_object($object) ? ' ref='.$object->ref : ''), $object, $customer, $stripeacc, $servicestatus, 1, 'terminal', false, null, 0, 1); echo json_encode(array('client_secret' => $intent->client_secret)); } catch (Error $e) { diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 2f833af1336..7dbf68d7fb9 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -59,10 +59,10 @@ class ActionsStripeconnect extends CommonHookActions /** * formObjectOptions * - * @param array $parameters Parameters - * @param CommonObject $object Object - * @param string $action Action - * @return int + * @param array $parameters Parameters + * @param CommonObject $object Object + * @param string $action Action + * @return int */ public function formObjectOptions($parameters, &$object, &$action) { @@ -82,6 +82,7 @@ class ActionsStripeconnect extends CommonHookActions } if (is_object($object) && $object->element == 'societe') { + '@phan-var-force Societe $object'; $this->resprints .= ''; $this->resprints .= ''; } elseif ($object instanceof CommonObject && $object->element == 'member') { + '@phan-var-force Adherent $object'; $this->resprints .= '
'; $this->resprints .= $langs->trans('StripeCustomer'); @@ -99,6 +100,7 @@ class ActionsStripeconnect extends CommonHookActions } $this->resprints .= '
'; $this->resprints .= ''; } elseif ($object instanceof CommonObject && $object->element == 'adherent_type') { + '@phan-var-force Adherent $object'; $this->resprints .= '
'; $this->resprints .= $langs->trans('StripeCustomer'); @@ -133,6 +135,7 @@ class ActionsStripeconnect extends CommonHookActions } $this->resprints .= '
'; $this->resprints .= '
'; $this->resprints .= $langs->trans('PlanStripe'); @@ -157,9 +160,9 @@ class ActionsStripeconnect extends CommonHookActions /** * addMoreActionsButtons * - * @param array $parameters Parameters - * @param Object $object Object - * @param string $action action + * @param array $parameters Parameters + * @param Object $object Object + * @param string $action action * @return int 0 */ public function addMoreActionsButtons($parameters, &$object, &$action) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 8efe8ad7ad9..8ccb9a4d40f 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -170,13 +170,13 @@ class Stripe extends CommonObject * Get the Stripe customer of a thirdparty (with option to create it in Stripe if not linked yet). * Search on site_account = 0 or = $stripearrayofkeysbyenv[$status]['publishable_key'] * - * @param CommonObject $object Object thirdparty to check, or create on stripe (create on stripe also update the stripe_account table for current entity). Used for AdherentType and Societe. - * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect - * @param int $status Status (0=test, 1=live) - * @param int $createifnotlinkedtostripe 1=Create the stripe customer and the link if the thirdparty is not yet linked to a stripe customer + * @param Societe|Adherent $object Object thirdparty to check, or create on stripe (create on stripe also update the stripe_account table for current entity). Used for AdherentType and Societe. + * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect + * @param int<0,1> $status Status (0=test, 1=live) + * @param int<0,1> $createifnotlinkedtostripe 1=Create the stripe customer and the link if the thirdparty is not yet linked to a stripe customer * @return \Stripe\Customer|null Stripe Customer or null if not found */ - public function customerStripe(CommonObject $object, $key = '', $status = 0, $createifnotlinkedtostripe = 0) + public function customerStripe($object, $key = '', $status = 0, $createifnotlinkedtostripe = 0) { global $conf, $user; @@ -1362,7 +1362,7 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description", "stripe_account" => "$account")); } } - '@phan-var-force stdclass|\Stripe\Charge $charge'; + '@phan-var-force stdClass|\Stripe\Charge $charge'; if (isset($charge->id)) { } @@ -1377,7 +1377,7 @@ class Stripe extends CommonObject } elseif ($charge->source->type == 'three_d_secure') { $stripe = new Stripe($this->db); $src = \Stripe\Source::retrieve("".$charge->source->three_d_secure->card, array( - "stripe_account" => $stripe->getStripeAccount($service) + "stripe_account" => $stripe->getStripeAccount($service) )); $return->message = $src->card->brand." ....".$src->card->last4; } else { diff --git a/htdocs/ticket/class/ticketstats.class.php b/htdocs/ticket/class/ticketstats.class.php index a491775376e..3ec67e15f23 100644 --- a/htdocs/ticket/class/ticketstats.class.php +++ b/htdocs/ticket/class/ticketstats.class.php @@ -1,6 +1,7 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2016 Jean-François Ferry + * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,12 +36,15 @@ class TicketStats extends Stats */ public $table_element; + /** + * @var int thirdparty ID + */ public $socid; - public $userid; - public $from; - public $field; - public $where; + /** + * @var int User ID + */ + public $userid; /** * Constructor @@ -106,7 +110,7 @@ class TicketStats extends Stats $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getNbByMonth($year, $sql, $format); - //var_dump($res);print '
'; + return $res; } @@ -127,7 +131,7 @@ class TicketStats extends Stats $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getAmountByMonth($year, $sql, $format); - //var_dump($res);print '
'; + return $res; } diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 6ebf7baafcc..646886f579d 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -1,9 +1,9 @@ - * Copyright (C) 2008-2012 Regis Houssin - * Copyright (C) 2008-2011 Juanjo Menent - * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> - * Copyright (C) 2024 MDW +/* Copyright (C) 2007-2011 Laurent Destailleur + * Copyright (C) 2008-2012 Regis Houssin + * Copyright (C) 2008-2011 Juanjo Menent + * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -186,8 +186,18 @@ if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { $title = getDolGlobalString('MAIN_APPLICATION_TITLE'); } -// Select templates -if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php")) { +// Select templates dir +$template_dir = ''; +if (!empty($conf->modules_parts['tpl'])) { // Using this feature slow down application + $dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl/')); + foreach ($dirtpls as $reldir) { + $tmp = dol_buildpath($reldir.'passwordforgotten.tpl.php'); + if (file_exists($tmp)) { + $template_dir = preg_replace('/passwordforgotten\.tpl\.php$/', '', $tmp); + break; + } + } +} elseif (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten.tpl.php")) { $template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/"; } else { $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index 8cd151e30c4..955d844494c 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -113,6 +113,9 @@ class WebPortalInvoice extends Facture ); //public $rowid; //public $ref; + /** + * @var int date invoice + */ public $datef; //public $date_lim_reglement; //public $total_ht; diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index 1926d5579d3..922eeddeee5 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -142,6 +142,9 @@ class WebPortalMember extends Adherent 'status' => array('type' => 'smallint(6)', 'label' => 'Status', 'enabled' => 1, 'visible' => 5, 'notnull' => 1, 'position' => 500, 'arrayofkeyval' => self::ARRAY_STATUS_LABEL, 'showonheader' => 1,), ); + /** + * @var int + */ public $rowid; //public $ref; //public $lastname; @@ -159,6 +162,9 @@ class WebPortalMember extends Adherent //public $url; //public $socialnetworks; //public $login; + /** + * @var int + */ public $fk_adherent_type; //public $morphy; //public $societe; diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index f4d23edea3c..e716d4563ad 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -355,26 +355,10 @@ class Hook extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - //$this->fetchLines(); - } + return $result; } - /** - * Load object lines in memory from the database - * - * @return int Return integer <0 if KO, 0 if not found, >0 if OK - */ - /*public function fetchLines() - { - $this->lines=array(); - - // Load lines with object MyObjectLine - - return count($this->lines)?1:0; - }*/ - /** * Load list of objects in memory from the database. * @@ -385,7 +369,7 @@ class Hook extends CommonObject * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @return Hook[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6f87c5244eb..ed685c31da3 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -85,7 +85,6 @@ parameters: - '#(?:convertSecondToTime) expects int, float\|string given#' - '#(?:Comm(?:(?:ande::updateline|on(?:Invoice::getLibStatut|StickerGenerator::(?:Set_Char_Size|_Croix|convertMetric)))\(\))|Facture(?:(?:::update|FournisseurRec::add)line\(\))|(?:Holiday::addLogCP|Loan::getLibStatut|SupplierProposal::updateline)\(\)|c(?:alcul_price_total|onvert(?:DurationtoHour|SecondToTime))|dol_time_plus_duree|pdf_(?:azur::_tableau_(?:(?:info|tot)\(\))|ban(?:::_tableau\(\)|k)|c(?:anelle::_tableau_(?:(?:tot|versements)\(\))|ornas::_tableau_(?:(?:info|tot)\(\))|rabe::_tableau_(?:(?:info|tot|versements)\(\))|yan::draw(?:(?:Info|Total)Table\(\)))|e(?:agle(?:(?:::_tableau_tot|_proforma::drawTotalTable)\(\))|instein::_tableau_(?:(?:info|tot)\(\))|ratosthene::draw(?:(?:Info|Total)Table\(\))|spadon::_tableau_tot\(\))|muscadet::_tableau_(?:(?:info|tot)\(\))|octopus::(?:_table(?:(?:FirstPage|au)\(\))|draw(?:(?:Info|Total)Table\(\)))|page(?:foot|head)|(?:rouget::_tableau_tot|s(?:epamandate::_tableau(?:_info)?|ponge::draw(?:(?:Info|Total)Table)|quille::_tableau_tot|t(?:andard_(?:e(?:(?:valuation|xpensereport)::_tableau|xpensereport::tablePayments)|(?:myobjec|supplierpaymen)t::_tableau|supplierpayment::_tableau_cheque)|orm::_tableau_info|rato::tabSignature))|t(?:cpdflabel::writeBarcode|yphon::_tableau_info)|vinci::_tableau_info)\(\)|w(?:atermark|rite(?:LinkedObjects|linedesc))|zenith::_tableau_tot\(\))|usleep) expects int, float given\.#' - - '#::saveboxorder\(\) expects int, array#' - '#(?:dol_(?:mktime|remove_file_process)|fetchObjectByElement|print_actions_filter) expects int, array\|string given\.#' - '# (CSMSFile) constructor expects int, array\|string given.#' @@ -93,10 +92,8 @@ parameters: - '#(?:(?:Asset::addDepreciationL|Facture(?:(?:(?:Fournisseur)?::add|Fournisseur::update)l))ine\(\)|calcul_price_total|dol_convertToWord|(?:loanCalcMonthlyPaymen|print_paypal_redirec)t) expects float, string given.#' - '#EvalMath::trigger\(\) expects string\|null,#' - '#(?:F(?:acture(?:(?:Fournisseur)?Rec::addline\(\))|ichinterRec::addLineRec\(\))|dolMd2Html|setEventMessages) expects string\|null,#' - - '# (envoi_mail|sendEmailTo) expects string, \(float\|int\) given.#' - '#::printStdColumnContent\(\) expects string, float(\|(int|array)(\<.*\>)?)* given.#' - '#::HTML2OpenIDServer\(\) expects string, array given.#' - - '#create_line\(\) expects string, float given.#' - '# dol_stringtotime expects string, DateTime given.#' - '#expects string, bool\|mysqli_result\|resource given.#' - '#( |::)((multi)?selectarray)\(\) expects array#' @@ -104,7 +101,6 @@ parameters: - '#::(_validateMyObject|select_company)\(\) expects array,) string given\.#' + - '# (Workstation|WorkstationResource|WorkstationUserGroup|Zapier)::.* has no value type specified in iterable type array\.#' internalErrorsCountLimit: 50 cache: diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 6b7e5e09421..c9b027c3691 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -1,11 +1,11 @@ #!/usr/bin/env php - * Copyright (C) 2005-2013 Laurent Destailleur - * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2013 Laurent Destailleur + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -155,7 +155,7 @@ if ($resql) { if ($startbreak) { // Break onto sales representative (new email or cid) if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { - sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, (int) $duration_value); + sendEmailTo($mode, $oldemail, $message, price2num($total), $oldlang, $oldtarget, (int) $duration_value); $trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid; } else { if ($oldemail != 'none') { @@ -209,7 +209,7 @@ if ($resql) { // If there are remaining messages to send in the buffer if ($foundtoprocess) { if (dol_strlen($oldemail) && $oldemail != 'none' && empty($trackthirdpartiessent[$oldsid.'|'.$oldemail])) { // Break onto email (new email) - sendEmailTo($mode, $oldemail, $message, $total, $oldlang, $oldtarget, (int) $duration_value); + sendEmailTo($mode, $oldemail, $message, price2num($total), $oldlang, $oldtarget, (int) $duration_value); $trackthirdpartiessent[$oldsid.'|'.$oldemail] = 'contact id '.$oldcid; } else { if ($oldemail != 'none') { diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index a5b176c4f72..ce4347d8ebc 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -125,7 +125,7 @@ if ($resql) { if (($obj->email != $oldemail || $obj->uid != $olduid) || $oldemail == 'none') { // Break onto sales representative (new email or uid) if (dol_strlen($oldemail) && $oldemail != 'none') { - envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative); + envoi_mail($mode, $oldemail, $message, price2num($total), $oldlang, $oldsalerepresentative); } else { if ($oldemail != 'none') { print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n"; @@ -173,7 +173,7 @@ if ($resql) { // If there are remaining messages to send in the buffer if ($foundtoprocess) { if (dol_strlen($oldemail) && $oldemail != 'none') { // Break onto email (new email) - envoi_mail($mode, $oldemail, $message, $total, $oldlang, $oldsalerepresentative); + envoi_mail($mode, $oldemail, $message, price2num($total), $oldlang, $oldsalerepresentative); } else { if ($oldemail != 'none') { print "- No email sent for ".$oldsalerepresentative.", total: ".$total."\n";