mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Qual: Fix phan notices
# Qual: Fix phan notices Fix phan notices in fourn/commande (+form class)
This commit is contained in:
parent
ae7cc3b95a
commit
f66e9553d5
|
|
@ -11,11 +11,11 @@ return [
|
|||
// # Issue statistics:
|
||||
// PhanUndeclaredProperty : 540+ occurrences
|
||||
// PhanPossiblyUndeclaredGlobalVariable : 210+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 210+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 200+ occurrences
|
||||
// PhanPluginUnknownArrayMethodReturnType : 180+ occurrences
|
||||
// PhanTypeMismatchArgumentProbablyReal : 160+ occurrences
|
||||
// PhanTypeMismatchProperty : 140+ occurrences
|
||||
// PhanPluginUnknownArrayMethodParamType : 120+ occurrences
|
||||
// PhanPluginUnknownArrayMethodParamType : 110+ occurrences
|
||||
// PhanRedefineFunction : 45+ occurrences
|
||||
// PhanPluginUndeclaredVariableIsset : 40+ occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
|
||||
|
|
@ -225,13 +225,7 @@ return [
|
|||
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
|
||||
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/commande/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimAssignment', 'PhanTypeMismatchProperty', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/commande/contact.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/commande/document.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/commande/info.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/commande/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/fourn/commande/note.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/contact.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/fourn/commande/card.php' => ['PhanTypeMismatchDimAssignment', 'PhanTypeSuspiciousStringExpression', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/facture/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/fourn/facture/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
|
||||
'htdocs/fourn/facture/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ return [
|
|||
'linkedObjectBlock' => '\CommonObject[]', // See htdocs/core/class/html.form.class.php
|
||||
'mainmenu' => 'string',
|
||||
'menumanager' => '\MenuManager',
|
||||
'mysoc' => '?\Societe',
|
||||
'mysoc' => '\Societe',
|
||||
'nblines' => '\int',
|
||||
'objectoffield' => '\CommonObject',
|
||||
'objsoc' => '\Societe',
|
||||
|
|
|
|||
|
|
@ -2968,7 +2968,7 @@ class Form
|
|||
if (count($warehouseStatusArray)) {
|
||||
$selectFieldsGrouped = ", sum(" . $this->db->ifsql("e.statut IS NULL", "0", "ps.reel") . ") as stock"; // e.statut is null if there is no record in stock
|
||||
} else {
|
||||
$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
|
||||
$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", '0', "p.stock") . " AS stock";
|
||||
}
|
||||
|
||||
$sql = "SELECT ";
|
||||
|
|
@ -3262,7 +3262,7 @@ class Form
|
|||
} else {
|
||||
if (isModEnabled('dynamicprices') && !empty($objp->fk_price_expression)) {
|
||||
$price_product = new Product($this->db);
|
||||
$price_product->fetch($objp->rowid, '', '', 1);
|
||||
$price_product->fetch($objp->rowid, '', '', '1');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
|
||||
$priceparser = new PriceParser($this->db);
|
||||
|
|
@ -3341,7 +3341,7 @@ class Form
|
|||
$outtva_tx = '';
|
||||
$outdefault_vat_code = '';
|
||||
$outqty = 1;
|
||||
$outdiscount = 0;
|
||||
$outdiscount = '0';
|
||||
|
||||
$maxlengtharticle = (!getDolGlobalString('PRODUCT_MAX_LENGTH_COMBO') ? 48 : $conf->global->PRODUCT_MAX_LENGTH_COMBO);
|
||||
|
||||
|
|
@ -3711,7 +3711,7 @@ class Form
|
|||
if ($selected > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
$producttmpselect = new Product($this->db);
|
||||
$producttmpselect->fetch($selected);
|
||||
$producttmpselect->fetch((int) $selected);
|
||||
$selected_input_value = $producttmpselect->ref;
|
||||
unset($producttmpselect);
|
||||
}
|
||||
|
|
@ -5172,14 +5172,14 @@ class Form
|
|||
*
|
||||
* @param int|'' $selected Id account preselected
|
||||
* @param string $htmlname Name of select zone
|
||||
* @param int $status Status of searched accounts (0=open, 1=closed, 2=both)
|
||||
* @param int<0,2> $status Status of searched accounts (0=open, 1=closed, 2=both)
|
||||
* @param string $filtre To filter the list. This parameter must not come from input of users
|
||||
* @param int|string $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||
* @param int<0,2>|string $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||
* @param string $moreattrib To add more attribute on select
|
||||
* @param int $showcurrency Show currency in label
|
||||
* @param int<0,1> $showcurrency Show currency in label
|
||||
* @param string $morecss More CSS
|
||||
* @param int<0,1> $nooutput 1=Return string, do not send to output
|
||||
* @return int|string If noouput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string.
|
||||
* @return int|string If nooutput=0: Return integer <0 if error, Num of bank account found if OK (0, 1, 2, ...), If nooutput=1: Return a HTML select string.
|
||||
*/
|
||||
public function select_comptes($selected = '', $htmlname = 'accountid', $status = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0, $morecss = '', $nooutput = 0)
|
||||
{
|
||||
|
|
@ -5418,7 +5418,7 @@ class Form
|
|||
* @param string $page Page
|
||||
* @param string $selected Id of bank account
|
||||
* @param string $htmlname Name of select html field
|
||||
* @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||
* @param int<0,2> $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
|
||||
* @return void
|
||||
*/
|
||||
public function formSelectAccount($page, $selected = '', $htmlname = 'fk_account', $addempty = 0)
|
||||
|
|
@ -5440,7 +5440,7 @@ class Form
|
|||
if ($selected) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
$bankstatic = new Account($this->db);
|
||||
$result = $bankstatic->fetch($selected);
|
||||
$result = $bankstatic->fetch((int) $selected);
|
||||
if ($result) {
|
||||
print $bankstatic->getNomUrl(1);
|
||||
}
|
||||
|
|
@ -5479,7 +5479,7 @@ class Form
|
|||
if ($selected) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
|
||||
$bankstatic = new CompanyBankAccount($this->db);
|
||||
$result = $bankstatic->fetch($selected);
|
||||
$result = $bankstatic->fetch((int) $selected);
|
||||
if ($result) {
|
||||
print $bankstatic->label;
|
||||
if ($showibanbic) {
|
||||
|
|
@ -6100,7 +6100,7 @@ class Form
|
|||
$out .= '<span class="project_head_block">';
|
||||
if ($selected) {
|
||||
$projet = new Project($this->db);
|
||||
$projet->fetch($selected);
|
||||
$projet->fetch((int) $selected);
|
||||
$out .= $projet->getNomUrl(0, '', 1);
|
||||
} else {
|
||||
$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
|
||||
|
|
@ -6123,8 +6123,8 @@ class Form
|
|||
* @param string $page Page
|
||||
* @param string $selected Id condition pre-selectionne
|
||||
* @param string $htmlname Name of select html field
|
||||
* @param int $addempty Add empty entry
|
||||
* @param string $type Type ('direct-debit' or 'bank-transfer')
|
||||
* @param int<0,1> $addempty Add empty entry
|
||||
* @param ''|'direct-debit'|'bank-transfer' $type Type ('direct-debit' or 'bank-transfer')
|
||||
* @param int $filtertype If > 0, include payment terms with deposit percentage (for objects other than invoices and invoice templates)
|
||||
* @param int $deposit_percent < 0 : deposit_percent input makes no sense (for example, in list filters)
|
||||
* 0 : use default deposit percentage from entry
|
||||
|
|
@ -6146,7 +6146,7 @@ class Form
|
|||
if ($type) {
|
||||
$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
|
||||
}
|
||||
$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
|
||||
$out .= $this->getSelectConditionsPaiements((int) $selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
|
||||
$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
|
||||
$out .= '</form>';
|
||||
} else {
|
||||
|
|
@ -6184,7 +6184,7 @@ class Form
|
|||
* @param string $page Page
|
||||
* @param string $selected Id condition pre-selectionne
|
||||
* @param string $htmlname Name of select html field
|
||||
* @param int $addempty Add an empty entry
|
||||
* @param int<0,1> $addempty Add an empty entry
|
||||
* @return void
|
||||
*/
|
||||
public function form_availability($page, $selected = '', $htmlname = 'availability', $addempty = 0)
|
||||
|
|
@ -6322,7 +6322,7 @@ class Form
|
|||
if ($selected) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
$theuser = new User($this->db);
|
||||
$theuser->fetch($selected);
|
||||
$theuser->fetch((int) $selected);
|
||||
print $theuser->getNomUrl(1);
|
||||
} else {
|
||||
print " ";
|
||||
|
|
@ -6340,8 +6340,8 @@ class Form
|
|||
* @param string $selected Id mode pre-selectionne
|
||||
* @param string $htmlname Name of select html field
|
||||
* @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
|
||||
* @param int $active Active or not, -1 = all
|
||||
* @param int $addempty 1=Add empty entry
|
||||
* @param int<-1,1> $active Active or not, -1 = all
|
||||
* @param int<0,1> $addempty 1=Add empty entry
|
||||
* @param string $type Type ('direct-debit' or 'bank-transfer')
|
||||
* @param int<0,1> $nooutput 1=Return string, no output
|
||||
* @return string HTML output or ''
|
||||
|
|
@ -6613,7 +6613,7 @@ class Form
|
|||
if ($selected) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
|
||||
$contact = new Contact($this->db);
|
||||
$contact->fetch($selected);
|
||||
$contact->fetch((int) $selected);
|
||||
print $contact->getFullName($langs);
|
||||
} else {
|
||||
print " ";
|
||||
|
|
@ -6656,7 +6656,7 @@ class Form
|
|||
if ($selected) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($selected);
|
||||
$soc->fetch((int) $selected);
|
||||
$out .= $soc->getNomUrl(0, '');
|
||||
} else {
|
||||
$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
|
||||
|
|
@ -6982,7 +6982,7 @@ class Form
|
|||
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
|
||||
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
|
||||
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
|
||||
if (isInEEC($societe_vendeuse) && isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()) {
|
||||
if (is_object($societe_vendeuse) && isInEEC($societe_vendeuse) && isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()) {
|
||||
// We also add the buyer country code
|
||||
if (is_numeric($type)) {
|
||||
if ($type == 1) { // We know product is a service
|
||||
|
|
@ -7029,7 +7029,7 @@ class Form
|
|||
|
||||
if ($num > 0) {
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0) {
|
||||
if (($defaulttx < 0 || dol_strlen($defaulttx) == 0) && is_object($societe_vendeuse)) {
|
||||
$tmpthirdparty = new Societe($this->db);
|
||||
|
||||
$defaulttx = get_default_tva($societe_vendeuse, (is_object($societe_acheteuse) ? $societe_acheteuse : $tmpthirdparty), $idprod);
|
||||
|
|
@ -7835,7 +7835,7 @@ class Form
|
|||
if ($selected && empty($selected_input_value)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
|
||||
$tickettmpselect = new Ticket($this->db);
|
||||
$tickettmpselect->fetch($selected);
|
||||
$tickettmpselect->fetch((int) $selected);
|
||||
$selected_input_value = $tickettmpselect->ref;
|
||||
unset($tickettmpselect);
|
||||
}
|
||||
|
|
@ -8031,7 +8031,7 @@ class Form
|
|||
* @param string $selected Preselected tickets
|
||||
* @param string $htmlname Name of HTML select field (must be unique in page).
|
||||
* @param string $filtertype To add a filter
|
||||
* @param int $limit Limit on number of returned lines
|
||||
* @param int<0,max> $limit Limit on number of returned lines
|
||||
* @param int $status Not used
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @param int<0,3> $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
|
||||
|
|
@ -8061,7 +8061,7 @@ class Form
|
|||
if ($selected && empty($selected_input_value)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
$projecttmpselect = new Project($this->db);
|
||||
$projecttmpselect->fetch($selected);
|
||||
$projecttmpselect->fetch((int) $selected);
|
||||
$selected_input_value = $projecttmpselect->ref;
|
||||
unset($projecttmpselect);
|
||||
}
|
||||
|
|
@ -8222,7 +8222,9 @@ class Form
|
|||
*
|
||||
* @param stdClass $objp Result set of fetch
|
||||
* @param string $opt Option (var used for returned value in string option format)
|
||||
* @param array{key:string,value:string,type:string} $optJson Option (var used for returned value in json format)
|
||||
* @param array{} $optJson Option (var used for returned value in json format) @phan-output-reference
|
||||
* @phan-param array{key:string,value:string,type:string} $optJson Option (var used for returned value in json format) @phan-output-reference
|
||||
* @phpstan-param-out array{key:string,value:string,type:string} $optJson
|
||||
* @param string $selected Preselected value
|
||||
* @param string $filterkey Filter key to highlight
|
||||
* @return void
|
||||
|
|
@ -8290,7 +8292,7 @@ class Form
|
|||
if ($selected && empty($selected_input_value)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
|
||||
$adherenttmpselect = new Adherent($this->db);
|
||||
$adherenttmpselect->fetch($selected);
|
||||
$adherenttmpselect->fetch((int) $selected);
|
||||
$selected_input_value = $adherenttmpselect->ref;
|
||||
unset($adherenttmpselect);
|
||||
}
|
||||
|
|
@ -8396,7 +8398,7 @@ class Form
|
|||
|
||||
if (!$forcecombo) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
|
||||
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT'));
|
||||
}
|
||||
|
||||
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
|
||||
|
|
@ -8915,14 +8917,14 @@ class Form
|
|||
* @param int<0,1> $value_as_key 1 to use value as key
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param int<0,1> $translate 1=Translate and encode value
|
||||
* @param int $maxlen Length maximum for labels
|
||||
* @param int<0,max> $maxlen Length maximum for labels
|
||||
* @param int<0,1> $disabled Html select box is disabled
|
||||
* @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order
|
||||
* @param ''|'ASC'|'DESC'|'NONE'|'POS' $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order
|
||||
* @param string $morecss Add more class to css styles
|
||||
* @param int $addjscombo Add js combo
|
||||
* @param int<0,1> $addjscombo Add js combo
|
||||
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set
|
||||
* @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry
|
||||
* @param int $nohtmlescape No html escaping (not recommended, use 'data-html' if you need to use label with HTML content).
|
||||
* @param int<0,1> $nohtmlescape No html escaping (not recommended, use 'data-html' if you need to use label with HTML content).
|
||||
* @return string HTML select string.
|
||||
* @see multiselectarray(), selectArrayAjax(), selectArrayFilter()
|
||||
*/
|
||||
|
|
@ -9447,7 +9449,7 @@ class Form
|
|||
* If a saved selection of fields exists for user (into $user->conf->MAIN_SELECTEDFIELDS_contextofpage), we use this one instead of default.
|
||||
*
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @param array<string,array{label:string,checked:string,enabled?:string,type?:string,langfile?:string,position?:int,help?:string}> $array Array with array of fields we could show. This array may be modified according to setup of user.
|
||||
* @param array<string,array{label:string,checked?:string,enabled?:string,type?:string,langfile?:string,position?:int,help?:string}> $array Array with array of fields we could show. This array may be modified according to setup of user.
|
||||
* @param string $varpage Id of context for page. Can be set by caller with $varpage=(empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage);
|
||||
* @param string $pos Position colon on liste value 'left' or '' (meaning 'right').
|
||||
* @return string HTML multiselect string
|
||||
|
|
@ -10313,7 +10315,7 @@ class Form
|
|||
|
||||
// For thirdparty, contact, user, member, the ref is the id, so we show something else
|
||||
if ($object->element == 'societe') {
|
||||
$ret .= dol_htmlentities($object->name);
|
||||
$ret .= dol_htmlentities((string) $object->name);
|
||||
|
||||
// List of extra languages
|
||||
$arrayoflangcode = array();
|
||||
|
|
@ -10350,14 +10352,14 @@ class Form
|
|||
$ret .= $object->ref . '<br>';
|
||||
$fullname = $object->getFullName($langs);
|
||||
if ($object->morphy == 'mor' && $object->societe) {
|
||||
$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
|
||||
$ret .= dol_htmlentities((string) $object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
|
||||
} else {
|
||||
$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
|
||||
$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities((string) $object->societe) . ')' : '');
|
||||
}
|
||||
} elseif (in_array($object->element, array('contact', 'user'))) {
|
||||
$ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt;
|
||||
} elseif ($object->element == 'usergroup') {
|
||||
$ret .= dol_htmlentities($object->name);
|
||||
$ret .= dol_htmlentities((string) $object->name);
|
||||
} elseif (in_array($object->element, array('action', 'agenda'))) {
|
||||
'@phan-var-force ActionComm $object';
|
||||
$ret .= $object->ref . '<br>' . $object->label;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2015 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -446,14 +446,14 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
|
|||
* Use ajax_combobox() only for small combo list! If not, use instead ajax_autocompleter().
|
||||
* 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 string $htmlname Name of html select field ('myid' or '.myclass')
|
||||
* @param array<array{method:string,url:string,htmlname:string,params?:array<string,string>}> $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'
|
||||
* @param string $idforemptyvalue '-1'
|
||||
* @param string $morecss More css
|
||||
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
|
||||
* @param int<0,max> $minLengthToAutocomplete Minimum length of input string to start autocomplete
|
||||
* @param int<0,1> $forcefocus Force focus on field
|
||||
* @param 'resolve'|'off' $widthTypeOfAutocomplete 'resolve' or 'off'
|
||||
* @param string $idforemptyvalue Defaults to '-1'
|
||||
* @param string $morecss More css
|
||||
* @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason.
|
||||
* @see selectArrayAjax() of html.form.class
|
||||
*/
|
||||
function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = 0, $forcefocus = 0, $widthTypeOfAutocomplete = 'resolve', $idforemptyvalue = '-1', $morecss = '')
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* Copyright (C) 2021 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2024 Solution Libre SAS <contact@solution-libre.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -1508,7 +1508,7 @@ class CommandeFournisseur extends CommonOrder
|
|||
* Submit a supplier order to supplier
|
||||
*
|
||||
* @param User $user User making change
|
||||
* @param integer $date Date
|
||||
* @param int $date Date
|
||||
* @param int $methode Method
|
||||
* @param string $comment Comment
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2023 Joachim Kueter <git-jk@bloxera.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Nick Fragoulis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -259,7 +259,7 @@ if (empty($reshook)) {
|
|||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
} elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
// Multicurrency rate
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOSTINT('calculation_mode'));
|
||||
$result = $object->setMulticurrencyRate((float) price2num(GETPOST('multicurrency_tx')), GETPOSTINT('calculation_mode'));
|
||||
}
|
||||
|
||||
// bank account
|
||||
|
|
@ -439,7 +439,7 @@ if (empty($reshook)) {
|
|||
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc);
|
||||
$localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc);
|
||||
foreach ($object->lines as $line) {
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->product_type, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier);
|
||||
$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, (float) $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->product_type, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier);
|
||||
}
|
||||
} elseif ($action == 'addline' && $usercancreate) {
|
||||
$db->begin();
|
||||
|
|
@ -529,7 +529,7 @@ if (empty($reshook)) {
|
|||
|
||||
$reg = array();
|
||||
if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice', 'alpha'), $reg)) {
|
||||
$idprod = $reg[1];
|
||||
$idprod = (int) $reg[1];
|
||||
$res = $productsupplier->fetch($idprod); // Load product from its id
|
||||
// Call to init some price properties of $productsupplier
|
||||
// So if a supplier price already exists for another thirdparty (first one found), we use it as reference price
|
||||
|
|
@ -543,10 +543,10 @@ if (empty($reshook)) {
|
|||
$fksoctosearch = $object->thirdparty->id;
|
||||
$productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist
|
||||
}
|
||||
} elseif (GETPOST('idprodfournprice', 'alpha') > 0) {
|
||||
$qtytosearch = $qty; // Just to see if a price exists for the quantity. Not used to found vat.
|
||||
} elseif (GETPOSTINT('idprodfournprice') > 0) { // field is not idprod_..., should be int
|
||||
$qtytosearch = (float) $qty; // Just to see if a price exists for the quantity. Not used to find vat.
|
||||
//$qtytosearch = -1; // We force qty to -1 to be sure to find if a supplier price exist
|
||||
$idprod = $productsupplier->get_buyprice(GETPOST('idprodfournprice', 'alpha'), $qtytosearch);
|
||||
$idprod = $productsupplier->get_buyprice(GETPOSTINT('idprodfournprice'), $qtytosearch);
|
||||
$res = $productsupplier->fetch($idprod);
|
||||
}
|
||||
|
||||
|
|
@ -636,7 +636,7 @@ if (empty($reshook)) {
|
|||
$result = $object->addline(
|
||||
$desc,
|
||||
($price_base_type == 'HT' ? $pu : 0),
|
||||
$qty,
|
||||
(float) $qty,
|
||||
$tva_tx,
|
||||
$localtax1_tx,
|
||||
$localtax2_tx,
|
||||
|
|
@ -676,10 +676,10 @@ if (empty($reshook)) {
|
|||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
$desc = $product_desc;
|
||||
$type = GETPOST('type');
|
||||
$type = GETPOSTINT('type');
|
||||
$ref_supplier = GETPOST('fourn_ref', 'alpha');
|
||||
|
||||
$fk_unit = GETPOST('units', 'alpha');
|
||||
$fk_unit = ((string) GETPOST('units')) == '' ? null : GETPOSTINT('units');
|
||||
|
||||
if (!preg_match('/\((.*)\)/', $tva_tx)) {
|
||||
$tva_tx = price2num($tva_tx); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
|
||||
|
|
@ -699,7 +699,7 @@ if (empty($reshook)) {
|
|||
$price_base_type = 'HT';
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'CU');
|
||||
|
||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, $pu_ttc, $type, 0, 0, $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise);
|
||||
$result = $object->addline($desc, (float) $pu_ht, (float) $qty, (float) $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, (float) $pu_ttc, $type, 0, 0, $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise);
|
||||
}
|
||||
|
||||
//print "xx".$tva_tx; exit;
|
||||
|
|
@ -789,7 +789,7 @@ if (empty($reshook)) {
|
|||
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
if (getDolGlobalInt('SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY') == 1) { // Not the common case
|
||||
if ($line->fk_product > 0 && $productsupplier->get_buyprice(0, price2num(GETPOSTINT('qty')), $line->fk_product, 'none', GETPOSTINT('socid')) < 0) {
|
||||
if ($line->fk_product > 0 && $productsupplier->get_buyprice(0, (float) price2num(GETPOSTFLOAT('qty')), $line->fk_product, 'none', GETPOSTINT('socid')) < 0) {
|
||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
|
@ -840,20 +840,20 @@ if (empty($reshook)) {
|
|||
$lineid,
|
||||
GETPOST('product_desc', 'restricthtml'),
|
||||
$ht,
|
||||
price2num(GETPOST('qty'), 'MS'),
|
||||
price2num(GETPOST('remise_percent'), '', 2),
|
||||
$vat_rate,
|
||||
(float) price2num(GETPOST('qty'), 'MS'),
|
||||
(float) price2num(GETPOST('remise_percent'), '', 2),
|
||||
(float) $vat_rate,
|
||||
$localtax1_rate,
|
||||
$localtax2_rate,
|
||||
$price_base_type,
|
||||
0,
|
||||
GETPOSTISSET("type") ? GETPOST("type") : $line->product_type,
|
||||
false,
|
||||
0,
|
||||
$date_start,
|
||||
$date_end,
|
||||
$array_options,
|
||||
GETPOST('units'),
|
||||
$pu_ht_devise,
|
||||
((string) GETPOST('units') === '') ? null : GETPOSTINT('units'),
|
||||
(float) $pu_ht_devise,
|
||||
GETPOST('fourn_ref', 'alpha')
|
||||
);
|
||||
unset($_POST['qty']);
|
||||
|
|
@ -1098,7 +1098,7 @@ if (empty($reshook)) {
|
|||
if ($action == 'confirm_commande' && $confirm == 'yes' && $usercanorder) {
|
||||
$db->begin();
|
||||
|
||||
$result = $object->commande($user, GETPOST("datecommande"), GETPOSTINT("methode"), GETPOSTINT('comment'));
|
||||
$result = $object->commande($user, GETPOSTINT("datecommande"), GETPOSTINT("methode"), GETPOST('comment'));
|
||||
if ($result > 0) {
|
||||
if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
|
||||
$outputlangs = $langs;
|
||||
|
|
@ -1340,7 +1340,7 @@ if (empty($reshook)) {
|
|||
$object->fk_incoterms = GETPOSTINT('incoterm_id');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = price2num(GETPOST('originmulticurrency_tx', 'alpha'));
|
||||
$object->multicurrency_tx = (float) price2num(GETPOSTFLOAT('originmulticurrency_tx'));
|
||||
$object->fk_project = GETPOSTINT('projectid');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
|
|
@ -1421,6 +1421,8 @@ if (empty($reshook)) {
|
|||
if (method_exists($lines[$i], 'fetch_optionals')) { // For avoid conflicts if
|
||||
$lines[$i]->fetch_optionals();
|
||||
$array_option = $lines[$i]->array_options;
|
||||
} else {
|
||||
$array_option = array();
|
||||
}
|
||||
|
||||
$ref_supplier = '';
|
||||
|
|
@ -1552,7 +1554,7 @@ if (empty($reshook)) {
|
|||
if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
|
||||
if ($action == 'addcontact' && $permissiontoadd) {
|
||||
if ($object->id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
|
||||
}
|
||||
|
|
@ -1836,7 +1838,7 @@ if ($action == 'create') {
|
|||
$langs->load("bank");
|
||||
print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
|
||||
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
|
||||
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
|
||||
$form->select_comptes($fk_account ?? '', 'fk_account', 0, '', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -2150,7 +2152,7 @@ if ($action == 'create') {
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, (int) $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>';
|
||||
|
|
@ -2182,7 +2184,7 @@ if ($action == 'create') {
|
|||
if ($action != 'classify' && $caneditproject) {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$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'), 1, 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'), 1, 0, 0, 1, '', 'maxwidth300');
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
@ -2268,9 +2270,9 @@ if ($action == 'create') {
|
|||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editconditions') {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id');
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
|
@ -2287,9 +2289,9 @@ if ($action == 'create') {
|
|||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1);
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'DBIT', 1, 1);
|
||||
} else {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'none');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
@ -2305,9 +2307,9 @@ if ($action == 'create') {
|
|||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'fk_account', 1);
|
||||
} else {
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
|
@ -2784,7 +2786,7 @@ if ($action == 'create') {
|
|||
$delallowed = $usercancreate;
|
||||
$modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (!getDolGlobalString('COMMANDE_SUPPLIER_ADDON_PDF') ? '' : $conf->global->COMMANDE_SUPPLIER_ADDON_PDF));
|
||||
|
||||
print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang, '', $object);
|
||||
print $formfile->showdocuments('commande_fournisseur', $objref, $filedir, $urlsource, (int) $genallowed, (int) $delallowed, $modelpdf, 1, 0, 0, 0, 0, '', '', '', $object->thirdparty->default_lang, '', $object);
|
||||
$somethingshown = $formfile->numoffiles;
|
||||
|
||||
// Show links to link elements
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -62,12 +63,13 @@ $object = new CommandeFournisseur($db);
|
|||
|
||||
$usercancreate = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer"));
|
||||
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$caneditproject = false;
|
||||
|
||||
/*
|
||||
* 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');
|
||||
|
|
@ -82,8 +84,8 @@ if (empty($reshook)) {
|
|||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOSTINT('typecontact') : GETPOSTINT('type'));
|
||||
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
|
||||
}
|
||||
|
||||
|
|
@ -165,10 +167,10 @@ if ($id > 0 || !empty($ref)) {
|
|||
$morehtmlref .= '<br>';
|
||||
if (0) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify' && $caneditproject) {
|
||||
if ($action != 'classify' && $caneditproject) { // Always false @phpstan-ignore-line
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$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($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -93,6 +94,7 @@ if ($user->socid) {
|
|||
$result = restrictedArea($user, 'fournisseur', $id, 'commande_fournisseur', 'commande');
|
||||
|
||||
$permissiontoadd = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer")); // Used by the include of actions_setnotes.inc.php
|
||||
$caneditproject = false;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -106,7 +108,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
|||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $object->ref." - ".$langs->trans('Documents');
|
||||
$help_url = 'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
|
||||
|
|
@ -146,10 +148,10 @@ if ($object->id > 0) {
|
|||
$morehtmlref .= '<br>';
|
||||
if (0) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify' && $caneditproject) {
|
||||
if ($action != 'classify' && $caneditproject) { // Always false @phpstan-ignore-line
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$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($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -96,13 +97,14 @@ if (!$user->hasRight("fournisseur", "commande", "lire")) {
|
|||
|
||||
$usercancreate = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer"));
|
||||
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$caneditproject = false;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('id'=>$id);
|
||||
$parameters = array('id' => $id);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
|
@ -120,7 +122,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$form = new Form($db);
|
||||
$object = new CommandeFournisseur($db);
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
|
|
@ -160,10 +162,10 @@ if (isModEnabled('project')) {
|
|||
$morehtmlref .= '<br>';
|
||||
if (0) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify' && $caneditproject) {
|
||||
if ($action != 'classify' && $caneditproject) { // Always false @phpstan-ignore-line
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$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($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
* Copyright (C) 2018-2022 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2019 Nicolas Zabouri <info@inovea-conseil.com>
|
||||
* Copyright (C) 2021-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -134,7 +134,7 @@ $search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'a
|
|||
$search_multicurrency_montant_tva = GETPOST('search_multicurrency_montant_tva', 'alpha');
|
||||
$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$search_billed = GETPOST('search_billed', 'intcomma');
|
||||
$billed = GETPOSTINT('billed');
|
||||
$search_project_ref = GETPOST('search_project_ref', 'alpha');
|
||||
$search_btn = GETPOST('button_search', 'alpha');
|
||||
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
|
||||
|
|
@ -218,7 +218,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$visible = (int) dol_eval((string) $val['visible'], 1);
|
||||
$arrayfields['cf.'.$key] = array(
|
||||
'label' => $val['label'],
|
||||
'checked' => (($visible < 0) ? 0 : 1),
|
||||
'checked' => (($visible < 0) ? '0' : '1'),
|
||||
'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
|
||||
'position' => $val['position'],
|
||||
'help' => isset($val['help']) ? $val['help'] : ''
|
||||
|
|
@ -230,7 +230,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
|||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
'@phan-var-force array<string,array{label:string,checked?:string,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
|
@ -336,7 +336,6 @@ if (empty($reshook)) {
|
|||
$search_date_approve_start = '';
|
||||
$search_date_approve_end = '';
|
||||
$billed = '';
|
||||
$search_billed = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
|
@ -508,7 +507,7 @@ if (empty($reshook)) {
|
|||
// Positive line
|
||||
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
||||
// Date start
|
||||
$date_start = false;
|
||||
$date_start = 0;
|
||||
if ($lines[$i]->date_debut_prevue) {
|
||||
$date_start = $lines[$i]->date_debut_prevue;
|
||||
}
|
||||
|
|
@ -519,7 +518,7 @@ if (empty($reshook)) {
|
|||
$date_start = $lines[$i]->date_start;
|
||||
}
|
||||
//Date end
|
||||
$date_end = false;
|
||||
$date_end = 0;
|
||||
if ($lines[$i]->date_fin_prevue) {
|
||||
$date_end = $lines[$i]->date_fin_prevue;
|
||||
}
|
||||
|
|
@ -549,15 +548,15 @@ if (empty($reshook)) {
|
|||
$lines[$i]->qty,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
(int) $date_start,
|
||||
(int) $date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
'HT',
|
||||
$product_type,
|
||||
// we don't use the rank from orderline because we may have lines from several orders
|
||||
-1,
|
||||
false,
|
||||
0,
|
||||
$lines[$i]->array_options,
|
||||
$lines[$i]->fk_unit,
|
||||
// we use the id of each order, not the id of the first one stored in $objecttmp->origin_id
|
||||
|
|
@ -765,7 +764,7 @@ if (empty($reshook)) {
|
|||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($billed != '') {
|
||||
$param .= '&billed='.urlencode($billed);
|
||||
$param .= '&billed='.((int) ($billed));
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
|
||||
|
|
@ -803,7 +802,7 @@ if ($socid > 0) {
|
|||
$title .= ' - '.$fourn->name;
|
||||
}
|
||||
|
||||
if ($search_billed > 0) {
|
||||
if ($billed > 0) {
|
||||
$title .= ' - '.$langs->trans("Billed");
|
||||
}
|
||||
|
||||
|
|
@ -883,8 +882,8 @@ if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
|
|||
if ($search_request_author) {
|
||||
$sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_request_author);
|
||||
}
|
||||
if ($search_billed != '' && $search_billed >= 0) {
|
||||
$sql .= " AND cf.billed = ".((int) $search_billed);
|
||||
if ($billed != '' && $billed != '-1') {
|
||||
$sql .= " AND cf.billed = ".((int) $billed);
|
||||
}
|
||||
//Required triple check because statut=0 means draft filter
|
||||
if (GETPOST('statut', 'intcomma') !== '') {
|
||||
|
|
@ -1203,8 +1202,8 @@ if ($resql) {
|
|||
if ($search_project_ref >= 0) {
|
||||
$param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||
}
|
||||
if ($search_billed != '') {
|
||||
$param .= "&search_billed=".urlencode($search_billed);
|
||||
if ($billed != '') {
|
||||
$param .= "&billed=".((int) $billed);
|
||||
}
|
||||
if ($show_files) {
|
||||
$param .= '&show_files='.urlencode((string) ($show_files));
|
||||
|
|
@ -1346,7 +1345,7 @@ if ($resql) {
|
|||
if ($user->hasRight("user", "user", "lire")) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view prospects other than his'
|
||||
|
|
@ -1354,8 +1353,8 @@ if ($resql) {
|
|||
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('IncludingProductWithTag');
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1);
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, 0, 1);
|
||||
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, '', 'maxwidth300 widthcentpercentminusx', 1);
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// alert on late date
|
||||
|
|
@ -1543,7 +1542,7 @@ if ($resql) {
|
|||
// Billed
|
||||
if (!empty($arrayfields['cf.billed']['checked'])) {
|
||||
print '<td class="liste_titre center parentonrightofpage">';
|
||||
print $form->selectyesno('search_billed', $search_billed, 1, false, 1, 1, 'search_status width100 onrightofpage');
|
||||
print $form->selectyesno('billed', $billed, 1, false, 1, 1, 'search_status width100 onrightofpage');
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
|
|
@ -1787,7 +1786,7 @@ if ($resql) {
|
|||
$thirdpartytmp->client = $obj->client;
|
||||
$thirdpartytmp->fournisseur = $obj->fournisseur;
|
||||
// Output Kanban
|
||||
print $objectstatic->getKanbanView('', array('thirdparty' => $thirdpartytmp->getNomUrl('supplier', 0, 0, -1), 'selected' => in_array($objectstatic->id, $arrayofselected)));
|
||||
print $objectstatic->getKanbanView('', array('thirdparty' => $thirdpartytmp->getNomUrl(1, 'supplier', 0, 0, -1), 'selected' => in_array($objectstatic->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
@ -2176,7 +2175,7 @@ if ($resql) {
|
|||
$genallowed = $permissiontoread;
|
||||
$delallowed = $permissiontoadd;
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_supplier_order', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
print $formfile->showdocuments('massfilesarea_supplier_order', '', $filedir, $urlsource, 0, (int) $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -67,6 +68,7 @@ $object->fetch($id, $ref);
|
|||
$permissionnote = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer")); // Used by the include of actions_setnotes.inc.php
|
||||
$usercancreate = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer"));
|
||||
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php
|
||||
$caneditproject = false;
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -128,10 +130,10 @@ if ($id > 0 || !empty($ref)) {
|
|||
$morehtmlref .= '<br>';
|
||||
if (0) {
|
||||
$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
|
||||
if ($action != 'classify' && $caneditproject) {
|
||||
if ($action != 'classify' && $caneditproject) { // Always false @phpstan-ignore-line
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
|
||||
}
|
||||
$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($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -67,6 +68,7 @@ if (!$sortfield) {
|
|||
$sortfield = "p.lastname";
|
||||
}
|
||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||
$begin = '';
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -3009,15 +3009,15 @@ class Societe extends CommonObject
|
|||
/**
|
||||
* Return a link on thirdparty (with picto)
|
||||
*
|
||||
* @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
|
||||
* @param string $option Target of link (''=auto, 'nolink'=no link, 'customer', 'prospect', 'supplier', 'project', 'agenda', ...)
|
||||
* @param int $maxlen Max length of name
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int $noaliasinname 1=Do not add alias into the link ref
|
||||
* @param string $target add attribute target
|
||||
* @param string $morecss More CSS
|
||||
* @return string String with URL
|
||||
* @param int<0,2> $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
|
||||
* @param string $option Target of link (''=auto, 'nolink'=no link, 'customer', 'prospect', 'supplier', 'project', 'agenda', ...)
|
||||
* @param int<0,max> $maxlen Max length of name
|
||||
* @param int<0,1> $notooltip 1=Disable tooltip
|
||||
* @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @param int<0,1> $noaliasinname 1=Do not add alias into the link ref
|
||||
* @param string $target add attribute target
|
||||
* @param string $morecss More CSS
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $notooltip = 0, $save_lastsearch_value = -1, $noaliasinname = 0, $target = '', $morecss = '')
|
||||
{
|
||||
|
|
@ -5443,7 +5443,6 @@ class Societe extends CommonObject
|
|||
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
|
||||
* @param string $element Filter on this element of default contact type ('facture', 'propal', 'commande' ...)
|
||||
* @return array|int Array of contacts, -1 if error
|
||||
*
|
||||
*/
|
||||
public function getContacts($list = 0, $code = '', $element = '')
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user