From e5c385999d73490e1b0ab68477444178b2984f88 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 19 Jan 2025 02:30:36 +0100 Subject: [PATCH] Qual: Fix multiple phan notices # Qual: Fix multiple phan notices Fix multiple phan notices --- htdocs/comm/propal/class/propal.class.php | 14 +++---- htdocs/commande/class/commande.class.php | 38 +++++++++--------- htdocs/compta/facture/class/facture.class.php | 7 ++-- htdocs/core/class/html.form.class.php | 38 +++++++++--------- htdocs/ecm/dir_card.php | 4 +- htdocs/ecm/index.php | 14 ++++--- .../conferenceorbooth_card.php | 10 ++--- .../conferenceorbooth_list.php | 7 ++-- .../conferenceorboothattendee_card.php | 18 +++++---- .../conferenceorboothattendee_list.php | 37 ++++++++--------- htdocs/expedition/card.php | 40 +++++++++---------- htdocs/expedition/class/expedition.class.php | 12 +++--- htdocs/expedition/contact.php | 6 ++- htdocs/expedition/dispatch.php | 18 +++++---- htdocs/expedition/document.php | 4 +- htdocs/expedition/list.php | 19 ++++----- htdocs/expedition/note.php | 4 +- htdocs/expedition/shipment.php | 33 +++++++-------- htdocs/expensereport/card.php | 35 ++++++++-------- 19 files changed, 187 insertions(+), 171 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index eb81c4c084e..ecd6898734c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -19,7 +19,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -146,23 +146,23 @@ class Propal extends CommonObject /** * @var int|'' - * @deprecated + * @deprecated Use $date_validation * @see $date_validation */ public $datev; /** - * @var integer|'' $date_validation; + * @var int|'' */ public $date_validation; /** - * @var integer|'' $date_signature; + * @var int|'' */ public $date_signature; /** - * @var User $user_signature + * @var User */ public $user_signature; @@ -715,7 +715,7 @@ class Propal extends CommonObject if ($qty < $product->packaging) { $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); @@ -772,7 +772,7 @@ class Propal extends CommonObject $this->line->fk_propal = $this->id; $this->line->label = $label; $this->line->desc = $desc; - $this->line->qty = $qty; + $this->line->qty = (float) $qty; $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 71e03085f69..6c747d2602b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021-2025 Frédéric France * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -1637,10 +1637,10 @@ class Commande extends CommonOrder if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { $product = new Product($this->db); $result = $product->fetch($fk_product); - if ($qty < $product->packaging) { + if ($qty < (float) $product->packaging) { $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); @@ -1703,7 +1703,7 @@ class Commande extends CommonOrder $this->line->fk_commande = $this->id; $this->line->label = $label; $this->line->desc = $desc; - $this->line->qty = $qty; + $this->line->qty = (float) $qty; $this->line->ref_ext = $ref_ext; $this->line->vat_src_code = $vat_src_code; @@ -1863,21 +1863,21 @@ class Commande extends CommonOrder $this->lines[] = $line; /** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE - if (getDolGlobalString('PRODUIT_SOUSPRODUITS')) { - $prod = new Product($this->db); - $prod->fetch($idproduct); - $prod -> get_sousproduits_arbo(); - $prods_arbo = $prod->get_arbo_each_prod(); - if(count($prods_arbo) > 0) - { - foreach($prods_arbo as $key => $value) - { - // print "id : ".$value[1].' :qty: '.$value[0].'
'; - if not in lines { - $this->add_product($value[1], $value[0]); - } - } - } + * if (getDolGlobalString('PRODUIT_SOUSPRODUITS')) { + * $prod = new Product($this->db); + * $prod->fetch($idproduct); + * $prod -> get_sousproduits_arbo(); + * $prods_arbo = $prod->get_arbo_each_prod(); + * if(count($prods_arbo) > 0) + * { + * foreach($prods_arbo as $key => $value) + * { + * // print "id : ".$value[1].' :qty: '.$value[0].'
'; + * if not in lines { + * $this->add_product($value[1], $value[0]); + * } + * } + * } **/ } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 09dddafbbd5..88430241586 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -20,7 +20,7 @@ * Copyright (C) 2022 Sylvain Legrand * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -174,7 +174,6 @@ class Facture extends CommonInvoice public $resteapayer; /** - * * @var int<0,1> 1 if invoice paid COMPLETELY, 0 otherwise * @deprecated * Use statut and close_code) */ @@ -4002,10 +4001,10 @@ class Facture extends CommonInvoice if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { $product = new Product($this->db); $result = $product->fetch($fk_product); - if ($qty < $product->packaging) { + if ($qty < (float) $product->packaging) { $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e374296cf13..143cc1a07d9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -107,9 +107,9 @@ class Form * @param object $object Object (on the page we show) * @param int<0,1> $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) - * @param string $moreparam More param to add on a href URL. - * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' + * @param string $moreparam More param to add on a href URL. + * @param int<0,1> $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. + * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' * @param string $paramid Key of parameter for id ('id', 'socid') * @param string $help Tooltip help * @return string HTML edit field @@ -624,19 +624,19 @@ class Form * Show a text and picto with tooltip on text or picto. * Can be called by an instancied $form->textwithtooltip or by a static call Form::textwithtooltip * - * @param string $text Text to show - * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. - * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip on both - * @param int $direction -1=image is before, 0=no image, 1=image is after - * @param string $img Html code for image (use img_xxx() function to get it) - * @param string $extracss Add a CSS style to td tags - * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param string $incbefore Include code before the text - * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) - * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) - * @return string Code html du tooltip (texte+picto) - * @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can. + * @param string $text Text to show + * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. + * @param int<0,3> $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip on both + * @param int<-1,1> $direction -1=image is before, 0=no image, 1=image is after + * @param string $img Html code for image (use img_xxx() function to get it) + * @param string $extracss Add a CSS style to td tags + * @param int<0,3> $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span + * @param string $incbefore Include code before the text + * @param int<0,1> $noencodehtmltext Do not encode into html entity the htmltext + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param int<0,1> $forcenowrap Force no wrap between text and picto (works with notabs=2 only) + * @return string Code html du tooltip (texte+picto) + * @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can. */ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) { @@ -5645,9 +5645,9 @@ class Form * @param string $title Title * @param string $question Question * @param string $action Action - * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) - * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', - * 'other', 'onecolumn' or 'hidden'... + * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) + * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', + * 'other', 'onecolumn' or 'hidden'... * @param int<0,1>|''|'no'|'yes'|'1'|'0' $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 * @param int<0,2>|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $height Force height of box (0 = auto) diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index fcfff57f74a..cf7d8c159c9 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -1,6 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 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 @@ -85,7 +86,7 @@ $ecmdir = new EcmDirectory($db); if ($module == 'ecm') { // $section should be an int except if it is dir not yet created into EcmDirectory - $result = $ecmdir->fetch($section); + $result = preg_match('/^\d+$/', $section) ? $ecmdir->fetch((int) $section) : 0; if ($result > 0) { $relativepath = $ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; @@ -199,6 +200,7 @@ if ($action == 'confirm_deletedir' && $confirm == 'yes' && $permissiontoupload) // Update dirname or description if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permissiontoadd) { $error = 0; + $oldlabel = ''; if ($module == 'ecm') { $oldlabel = $ecmdir->label; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 0f3e5cd7c24..213d60c4a17 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2008-2017 Laurent Destailleur * Copyright (C) 2008-2010 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -109,10 +110,11 @@ $permissiontodeletedir = $user->hasRight('ecm', 'setup'); //$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid; // used after a confirm_deletefile into actions_linkedfiles.inc.php //include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; +$relativepath = ''; + // Upload file (code similar but different than actions_linkedfiles.inc.php) if (GETPOST("sendit", 'alphanohtml') && getDolGlobalString('MAIN_UPLOAD_DOC') && $permissiontocreate) { // Define relativepath and upload_dir - $relativepath = ''; if ($ecmdir->id) { $relativepath = $ecmdir->getRelativePath(); } else { @@ -277,11 +279,11 @@ if ($action == 'refreshmanual' && $permissiontoread) { //print $ecmdirtmp->cachenbofdoc."
\n";exit; $id = $ecmdirtmp->create($user); if ($id > 0) { - $newdirsql = array('id'=>$id, - 'id_mere'=>$ecmdirtmp->fk_parent, - 'label'=>$ecmdirtmp->label, - 'description'=>$ecmdirtmp->description, - 'fullrelativename'=>$relativepathmissing); + $newdirsql = array('id' => $id, + 'id_mere' => $ecmdirtmp->fk_parent, + 'label' => $ecmdirtmp->label, + 'description' => $ecmdirtmp->description, + 'fullrelativename' => $relativepathmissing); $sqltree[] = $newdirsql; // We complete fulltree for following loops //var_dump($sqltree); $adirwascreated = 1; diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 69162c5fca8..ff6d66b04f3 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -3,7 +3,7 @@ * Copyright (C) 2021 Florian Henry * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -187,7 +187,7 @@ $help_url = 'EN:Module_Event_Organization'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-card'); if ($action == 'create') { - $result = $projectstatic->fetch(GETPOST('fk_project')); + $result = $projectstatic->fetch(GETPOSTINT('fk_project')); } else { $result = $projectstatic->fetch($object->fk_project); } @@ -351,7 +351,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -359,7 +359,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -377,7 +377,7 @@ if (!empty($withproject)) { print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 46bb260a6be..dcaecaf7f4e 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Florian Henry * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 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 @@ -880,7 +881,7 @@ foreach ($object->fields as $key => $val) { } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } @@ -1032,7 +1033,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { @@ -1040,7 +1041,7 @@ while ($i < $imaxinloop) { } elseif ($key == 'ref') { print $object->getNomUrl(1, 0, '', (($projectid > 0) ? 'withproject' : '')); } else { - print $object->showOutputField($val, $key, $object->$key, ''); + print $object->showOutputField($val, $key, (string) $object->$key, ''); } print ''; if (!$i) { diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index b7010dadaf5..041e671a8f0 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -75,6 +75,8 @@ $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneratio $hookmanager->initHooks(array('conferenceorboothattendeecard', 'globalcard')); // Note that conf->hooks_modules contains array +$confOrBooth = null; + if ($conf_or_booth_id > 0) { $confOrBooth = new ConferenceOrBooth($db); $result = $confOrBooth->fetch($id > 0 ? $id : $conf_or_booth_id); @@ -221,7 +223,7 @@ $help_url = 'EN:Module_Event_Organization'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-attendee-card'); -$result = $projectstatic->fetch(empty($confOrBooth->fk_project) ? $fk_project : $confOrBooth->fk_project); +$result = $projectstatic->fetch(($confOrBooth === null || empty($confOrBooth->fk_project)) ? $fk_project : $confOrBooth->fk_project); if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } @@ -357,7 +359,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -365,7 +367,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -377,7 +379,7 @@ if (!empty($withproject)) { print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; @@ -439,7 +441,7 @@ if (!empty($withproject)) { } // Part to create -if ($action == 'create') { +if ($action == 'create' && $confOrBooth !== null) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto); @@ -484,7 +486,7 @@ if ($action == 'create') { } // Part to edit record -if (($id || $ref) && $action == 'edit') { +if (($id || $ref) && $action == 'edit' && $confOrBooth !== null) { print load_fiche_titre($langs->trans("ConferenceOrBoothAttendee"), '', 'object_'.$object->picto); print '
'; @@ -527,7 +529,7 @@ if (($id || $ref) && $action == 'edit') { } // Part to show record -if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { +if ($confOrBooth !== null && $object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { $object->fetch_optionals(); $moreparam = ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index c5934e13ecd..3cabcb13528 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Florian Henry * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -564,7 +565,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -572,39 +573,39 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '&withproject=1', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, 0, '&withproject=1', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '&withproject=1', 0, '', 'projectid'); print ""; - // Link to ICS for the event - print ''.$langs->trans("EventOrganizationICSLinkProject").''; + // Link to ICS for the event + print ''.$langs->trans("EventOrganizationICSLinkProject").''; // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; - // Show message - $message = ''.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; - print $message; - print ""; + // Show message + $message = ''.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; + print $message; + print ""; print ''.$langs->trans("EventOrganizationICSLink").''; // Define $urlwithroot @@ -870,7 +871,7 @@ foreach ($object->fields as $key => $val) { } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } @@ -1021,7 +1022,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { @@ -1033,7 +1034,7 @@ while ($i < $imaxinloop) { } print $object->getNomUrl(1, $optionLink); } else { - print $object->showOutputField($val, $key, $object->$key, ''); + print $object->showOutputField($val, $key, (string) $object->$key, ''); } print ''; if (!$i) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 1b74583596c..a19523f9d7b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -14,7 +14,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Lenin Rivas * Copyright (C) 2022 Josep Lluís Amador - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -388,7 +388,7 @@ if (empty($reshook)) { } // Extrafields - $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i); + $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, (string) $i); // Unset extrafield if (isset($extrafields->attributes[$object->table_element_line]['label']) && is_array($extrafields->attributes[$object->table_element_line]['label'])) { // Get extra fields @@ -528,7 +528,7 @@ if (empty($reshook)) { } } elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $user->hasRight('expedition', 'supprimer')) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); - $result = $object->cancel(0, $also_update_stock); + $result = $object->cancel(0, (bool) $also_update_stock); if ($result > 0) { $result = $object->setStatut(-1); } else { @@ -536,7 +536,7 @@ if (empty($reshook)) { } } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('expedition', 'supprimer')) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); - $result = $object->delete($user, 0, $also_update_stock); + $result = $object->delete($user, 0, (bool) $also_update_stock); if ($result > 0) { header("Location: ".DOL_URL_ROOT.'/expedition/index.php'); exit; @@ -1035,7 +1035,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"'); - $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + $numprojet = $formproject->select_projects($soc->id, (string) $projectid, 'projectid', 0); print ' id).'">'; print ''; print ''; @@ -1081,7 +1081,7 @@ if ($action == 'create') { print ''; print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"'); print ' '; - $text = $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTINT('weight_units'), 0, 2); + $text = $formproduct->selectMeasuringUnits("weight_units", "weight", (string) GETPOSTINT('weight_units'), 0, 2); $htmltext = $langs->trans("KeepEmptyForAutoCalculation"); print $form->textwithpicto($text, $htmltext); print ''; @@ -1094,7 +1094,7 @@ if ($action == 'create') { print ' x '; print ' x '; print ' '; - $text = $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTINT('size_units'), 0, 2); + $text = $formproduct->selectMeasuringUnits("size_units", "size", (string) GETPOSTINT('size_units'), 0, 2); $htmltext = $langs->trans("KeepEmptyForAutoCalculation"); print $form->textwithpicto($text, $htmltext); print ''; @@ -1277,7 +1277,7 @@ if ($action == 'create') { $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); $description = ($showdescinproductdesc ? '' : dol_htmlentitiesbr($line->desc)); - print $form->textwithtooltip($text, $description, 3, 0, '', $i); + print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i); // Show range print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); @@ -1298,7 +1298,7 @@ if ($action == 'create') { if (!empty($line->label)) { $text .= ' '.$line->label.''; - print $form->textwithtooltip($text, $line->desc, 3, 0, '', $i); + print $form->textwithtooltip($text, $line->desc, 3, 0, '', (string) $i); } else { print $text.' '.nl2br($line->desc); } @@ -1856,7 +1856,7 @@ if ($action == 'create') { $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options); - print $expLine->showOptionals($extrafields, 'edit', array('style' => 'class="drag drop oddeven"', 'colspan' => $colspan), $indiceAsked, '', 1); + print $expLine->showOptionals($extrafields, 'edit', array('style' => 'class="drag drop oddeven"', 'colspan' => $colspan), (string) $indiceAsked, '', '1'); } } @@ -2003,7 +2003,7 @@ if ($action == 'create') { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); @@ -2107,13 +2107,13 @@ if ($action == 'create') { print ''; print ''; print ''; - print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2, 'maxwidth125 valignmiddle'); + print $formproduct->selectMeasuringUnits("weight_units", "weight", (string) $object->weight_units, 0, 2, 'maxwidth125 valignmiddle'); print ' '; print ' '; print ''; } else { print $object->trueWeight; - print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; + print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", (string) $object->weight_units) : ''; } // Calculated @@ -2228,7 +2228,7 @@ if ($action == 'create') { } else { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey - $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); + $code = $langs->getLabelFromKey($db, (string) $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); print $langs->trans("SendingMethod".strtoupper($code)); } } @@ -2462,7 +2462,7 @@ if ($action == 'create') { $text = $product_static->getNomUrl(1); $text .= ' - '.$label; $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->description)); - print $form->textwithtooltip($text, $description, 3, 0, '', $i); + print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i); print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : '', !empty($lines[$i]->date_end) ? $lines[$i]->date_end : ''); if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '
'.dol_htmlentitiesbr($lines[$i]->description) : ''; @@ -2478,7 +2478,7 @@ if ($action == 'create') { if (!empty($lines[$i]->label)) { $text .= ' '.$lines[$i]->label.''; - print $form->textwithtooltip($text, $lines[$i]->description, 3, 0, '', $i); + print $form->textwithtooltip($text, $lines[$i]->description, 3, 0, '', (string) $i); } else { print $text.' '.nl2br($lines[$i]->description); } @@ -2489,7 +2489,7 @@ if ($action == 'create') { $unit_order = ''; if (getDolGlobalString('PRODUCT_USE_UNITS')) { - $unit_order = measuringUnitString($lines[$i]->fk_unit); + $unit_order = measuringUnitString((int) $lines[$i]->fk_unit); } // Qty ordered @@ -2529,7 +2529,7 @@ if ($action == 'create') { } } } - print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1, 'info', '', 0, 3, 'tooltip'.$lines[$i]->id); + print $form->textwithpicto((string) $qtyalreadysent, $htmltooltip, 1, 'info', '', 0, 3, 'tooltip'.$lines[$i]->id); print ''; } @@ -2738,9 +2738,9 @@ if ($action == 'create') { // TODO Show all in same line by setting $display_type = 'line' if ($action == 'editline' && $line->id == $line_id) { - print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', '', 'card'); } else { - print $lines[$i]->showOptionals($extrafields, 'view', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + print $lines[$i]->showOptionals($extrafields, 'view', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', '', 'card'); } } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 61e50c14373..d3ecb5adad9 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2020 Lenin Rivas - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -306,7 +306,6 @@ class Expedition extends CommonObject * Closed status * -> parcel was received by customer / end of process * prev status : validated or shipment_in_progress - * */ const STATUS_CLOSED = 2; @@ -1476,10 +1475,10 @@ class Expedition extends CommonObject * Delete shipment. * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) * - * @param User $user User making the deletion - * @param int $notrigger Disable triggers - * @param bool $also_update_stock true if the stock should be increased back (false by default) - * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO + * @param ?User $user User making the deletion + * @param int<0,1> $notrigger Disable triggers + * @param bool $also_update_stock true if the stock should be increased back (false by default) + * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO */ public function delete($user = null, $notrigger = 0, $also_update_stock = false) { @@ -2437,7 +2436,6 @@ class Expedition extends CommonObject * @param string $labelmovement Label of movement * @return int Return integer <0 if KO, >0 if OK * @throws Exception - * */ private function manageStockMvtOnEvt($user, $labelmovement = 'ShipmentClassifyClosedInDolibarr') { diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 3818847e84e..534515a84f6 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2023 Christian Foellmann * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -52,6 +53,7 @@ $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); +$typeobject = null; $object = new Expedition($db); if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); @@ -85,7 +87,7 @@ $result = restrictedArea($user, 'expedition', $object->id, ''); * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -172,7 +174,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index e1340a8b0d7..67c30c5ff95 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -9,7 +9,7 @@ * Copyright (C) 2017-2022 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -141,6 +141,7 @@ if ($action == 'updatelines' && $usercancreate) { $reg = array(); if (preg_match('/^product_.*([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos++; + $modebatch = null; if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $modebatch = "barcode"; } elseif (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { // With batchmode enabled @@ -156,7 +157,7 @@ if ($action == 'updatelines' && $usercancreate) { $qty = "qty_".$reg[1].'_'.$reg[2]; $ent = "entrepot_".$reg[1].'_'.$reg[2]; $fk_commandedet = "fk_commandedet_".$reg[1].'_'.$reg[2]; - $idline = GETPOST("idline_".$reg[1].'_'.$reg[2]); + $idline = GETPOSTINT("idline_".$reg[1].'_'.$reg[2]); $warehouse_id = GETPOSTINT($ent); $prod_id = GETPOSTINT($prod); //$pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount @@ -245,6 +246,7 @@ if ($action == 'updatelines' && $usercancreate) { $sqlsearchdet .= " AND batch = '".$db->escape($lot)."'"; $resqlsearchdet = $db->query($sqlsearchdet); + $objsearchdet = null; if ($resqlsearchdet) { $objsearchdet = $db->fetch_object($resqlsearchdet); } else { @@ -384,6 +386,7 @@ $warehouse_static = new Entrepot($db); $title = $object->ref." - ".$langs->trans('ShipmentDistribution'); $help_url = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen'; $morejs = array('/expedition/js/lib_dispatch.js.php'); +$typeobject = null; llxHeader('', $title, $help_url, '', 0, 0, $morejs, '', '', 'mod-expedition page-card_dispatch'); @@ -459,7 +462,7 @@ if ($object->id > 0 || !empty($object->ref)) { if ($action != 'classify' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); @@ -546,6 +549,11 @@ if ($object->id > 0 || !empty($object->ref)) { $entrepot = new Entrepot($db); $listwarehouses = $entrepot->list_array(1); + $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. + + print '
'; @@ -683,10 +691,6 @@ if ($object->id > 0 || !empty($object->ref)) { print "\n"; } - $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. - $conf->cache['product'] = array(); // Loop on each line of origin order diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index f8b1cc3ad85..4dc74e52a72 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -79,6 +80,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); + $typeobject = null; if (!empty($object->origin)) { $typeobject = $object->origin; $origin = $object->origin; @@ -159,7 +161,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc->fk_project)) { $proj = new Project($db); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index b45450396bc..03a6a11db5d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2023 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Vincent Maury * Copyright (C) 2024 William Mead @@ -557,9 +557,6 @@ if (empty($reshook)) { if ($search_company) { $param .= "&search_company=".urlencode($search_company); } - if ($search_shipping_method_id) { - $param .= "&search_shipping_method_id=".urlencode($search_shipping_method_id); - } if ($search_tracking) { $param .= "&search_tracking=".urlencode($search_tracking); } @@ -1089,7 +1086,7 @@ if ($massaction == 'createbills') { print $langs->trans('DateInvoice'); print ''; print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', 0, 0, 0, '', 1, 1); print ''; print ''; print ''; @@ -1106,7 +1103,7 @@ if ($massaction == 'createbills') { print ''; print ''; if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - print $form->selectyesno('validate_invoices', 0, 1, 1); + print $form->selectyesno('validate_invoices', 0, 1, true); $langs->load("errors"); print ' ('.$langs->trans("WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").')'; } else { @@ -1152,7 +1149,7 @@ if ($user->hasRight('user', 'user', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"'); - $moreforfilter .= $form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200'); + $moreforfilter .= $form->select_dolusers($search_user, 'search_user', $tmptitle, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter .= '
'; } // If the user can view prospects other than his' @@ -1190,7 +1187,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // @phan-suppress-current-line PhanTypeMismatchArgument if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); // This also change content of $arrayfields } @@ -1223,7 +1220,7 @@ if (!empty($arrayfields['e.ref_customer']['checked'])) { // Thirdparty if (!empty($arrayfields['s.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } // Town @@ -1353,7 +1350,7 @@ if (!empty($arrayfields['e.signed_status']['checked'])) { // Status billed if (!empty($arrayfields['e.billed']['checked'])) { print ''; - print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); + print $form->selectyesno('search_billed', $search_billed, 1, false, 1); print ''; } // Action column @@ -1649,7 +1646,7 @@ while ($i < $imaxinloop) { } if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Get code using getLabelFromKey - $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); + $code = $langs->getLabelFromKey($db, (string) $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); print ''; if ($object->shipping_method_id > 0) { print $langs->trans("SendingMethod".strtoupper($code)); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 862253ba2ce..f2186c1be04 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 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 @@ -54,6 +55,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); + $typeobject = null; if (!empty($object->origin)) { $typeobject = $object->origin; $origin = $object->origin; @@ -128,7 +130,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 89930ef944c..e7ecf387ec1 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -5,7 +5,7 @@ * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018-2022 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -146,7 +146,7 @@ if (empty($reshook)) { if ($action == 'setavailability' && $permissiontoadd) { $object->fetch($id); - $result = $object->availability(GETPOST('availability_id')); + $result = $object->availability(GETPOSTINT('availability_id')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -154,7 +154,7 @@ if (empty($reshook)) { if ($action == 'setdemandreason' && $permissiontoadd) { $object->fetch($id); - $result = $object->demand_reason(GETPOST('demand_reason_id')); + $result = $object->demand_reason(GETPOSTINT('demand_reason_id')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -301,7 +301,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); @@ -336,8 +336,8 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans('Discounts').''; - $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); - $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); + $absolute_discount = $soc->getAvailableDiscounts(null, $filterabsolutediscount); + $absolute_creditnote = $soc->getAvailableDiscounts(null, $filtercreditnote); $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); @@ -396,9 +396,9 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'availability_id', 1); } else { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'none', 1); } print ''; @@ -413,9 +413,9 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1); } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'none'); } print ''; print ''; @@ -453,9 +453,9 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none'); } // Terms of payment @@ -620,6 +620,9 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE cd.fk_commande = ".((int) $object->id); $sql .= " ORDER BY cd.rang, cd.rowid"; + $toBeShipped = array(); + $toBeShippedTotal = 0; + //print $sql; dol_syslog("shipment.php", LOG_DEBUG); $resql = $db->query($sql); @@ -643,8 +646,6 @@ if ($id > 0 || !empty($ref)) { print "\n"; print ''; - $toBeShipped = array(); - $toBeShippedTotal = 0; while ($i < $num) { $objp = $db->fetch_object($resql); @@ -733,7 +734,7 @@ if ($id > 0 || !empty($ref)) { $text .= ' - '.$label; $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'
'; $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); - print $form->textwithtooltip($text, $description, 3, '', '', $i); + print $form->textwithtooltip($text, $description, 3, '', 0, (string) $i); // Show range print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end)); @@ -754,7 +755,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($objp->label)) { $text .= ' '.$objp->label.''; - print $form->textwithtooltip($text, $objp->description, 3, '', '', $i); + print $form->textwithtooltip($text, $objp->description, 3, 0, '', (string) $i); } else { print $text.' '.nl2br($objp->description); } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e0cd273c028..d931c854afb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2015-2023 Alexandre Spangaro * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 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 @@ -234,6 +234,7 @@ if (empty($reshook)) { // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { + // @phan-suppress-next-line PhanPluginBothLiteralsBinaryOp if (1 == 0 && !GETPOST('clone_content', 'alpha') && !GETPOST('clone_receivers', 'alpha')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { @@ -1358,7 +1359,7 @@ if (empty($reshook)) { if (!$error) { // TODO Use update method of ExpenseReportLine - $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id, $fk_c_exp_tax_cat, $fk_ecm_files); + $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, (float) $qty, (float) $value_unit, $date, $id, $fk_c_exp_tax_cat, $fk_ecm_files); if ($result >= 0) { if ($result > 0) { // Define output language @@ -1431,6 +1432,7 @@ $paymentexpensereportstatic = new PaymentExpenseReport($db); $bankaccountstatic = new Account($db); $ecmfilesstatic = new EcmFiles($db); $formexpensereport = new FormExpenseReport($db); +$remaintopay = 0; // Create if ($action == 'create') { @@ -1474,7 +1476,7 @@ if ($action == 'create') { if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('expensereport', 'writeall_advance')) { $include_users = array(); } - $s = $form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users, '', '0,'.$conf->entity); + $s = $form->select_dolusers($defaultselectuser, "fk_user_author", 0, null, 0, $include_users, '', '0,'.$conf->entity); print $s; print ''; print ''; @@ -1495,7 +1497,7 @@ if ($action == 'create') { if (GETPOSTINT('fk_user_validator') > 0) { $defaultselectuser = GETPOSTINT('fk_user_validator'); } - $s = $form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", ((empty($defaultselectuser) || !getDolGlobalString('EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE')) ? 0 : 1), $include_users); + $s = $form->select_dolusers($defaultselectuser, "fk_user_validator", 1, null, ((empty($defaultselectuser) || !getDolGlobalString('EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE')) ? 0 : 1), $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); } print ''; @@ -1552,6 +1554,7 @@ if ($action == 'create') { print ''; } elseif ($id > 0 || $ref) { + $userauthor = null; $result = $object->fetch($id, $ref); if ($result > 0) { @@ -1624,7 +1627,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("ModePaiement").''; print ''; - $form->select_types_paiements($object->fk_c_paiement, 'fk_c_paiement'); + $form->select_types_paiements((string) $object->fk_c_paiement, 'fk_c_paiement'); print ''; print ''; } @@ -1634,7 +1637,7 @@ if ($action == 'create') { print ''.$langs->trans("VALIDATOR").''; // Approbator print ''; $include_users = $object->fetch_users_approver_expensereport(); - $s = $form->select_dolusers($object->fk_user_validator, "fk_user_validator", 1, "", 0, $include_users); + $s = $form->select_dolusers($object->fk_user_validator, "fk_user_validator", 1, null, 0, $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); print ''; print ''; @@ -2225,7 +2228,7 @@ if ($action == 'create') { print ''.price($line->value_unit).''; - print ''.dol_escape_htmltag($line->qty).''; + print ''.dol_escape_htmltag((string) $line->qty).''; if ($action != 'editline') { print ''.price($line->total_ht).''; @@ -2400,7 +2403,7 @@ if ($action == 'create') { // Select project if (isModEnabled('project')) { print ''; - $formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + $formproject->select_projects(-1, (string) $line->fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; } @@ -2412,7 +2415,7 @@ if ($action == 'create') { if (getDolGlobalString('MAIN_USE_EXPENSE_IK')) { print ''; $params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->id, 'date' => $line->date); - print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params); + print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', (string) $userauthor->default_c_exp_tax_cat, $params); print ''; } @@ -2424,7 +2427,7 @@ if ($action == 'create') { // VAT $selectedvat = price2num($line->vatrate).(!empty($line->vat_src_code) ? ' ('.$line->vat_src_code.')' : ''); print ''; - print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1, 2); + print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, null, 0, 0, '', false, 1, 2); print ''; // Unit price @@ -2439,7 +2442,7 @@ if ($action == 'create') { // Quantity print ''; - print ''; // We must be able to enter decimal qty + print ''; // We must be able to enter decimal qty print ''; //print ''.$langs->trans('AmountHT').''; @@ -2455,7 +2458,7 @@ if ($action == 'create') { print ''; print ''; - print $form->buttonsSaveCancel('Save', 'Cancel', array(), 0, 'small'); + print $form->buttonsSaveCancel('Save', 'Cancel', array(), false, 'small'); print ''; print ''; @@ -2582,7 +2585,7 @@ if ($action == 'create') { // Select project if (isModEnabled('project')) { print ''; - $formproject->select_projects(-1, !empty($fk_project) ? $fk_project : 0, 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + $formproject->select_projects(-1, !empty($fk_project) ? (string) $fk_project : '0', 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; } @@ -2610,7 +2613,7 @@ if ($action == 'create') { // If option to have no default VAT on expense report is on, we force MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; } - print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1); + print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, null, 0, 0, '', false, 1); print ''; // Unit price net @@ -2638,7 +2641,7 @@ if ($action == 'create') { } print ''; - print $form->buttonsSaveCancel("Add", '', '', 1, 'reposition'); + print $form->buttonsSaveCancel("Add", '', array(), true, 'reposition'); print ''; print ''; @@ -2938,7 +2941,7 @@ if ($action != 'presend') { // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'expensereport', null); + $somethingshown = $formactions->showactions($object, 'expensereport', 0); print ''; }