diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index 5853729bdd0..e37cecf0a43 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -65,7 +65,17 @@ jobs:
- name: Setup PHPCS
uses: shivammathur/setup-php@v2
- if: steps.changed-php.outputs.any_changed == 'true'
+ # Install when we're going to run phpcs
+ if: |
+ steps.changed-php.outputs.any_changed == 'true'
+ ||
+ (
+ github.event_name == 'push'
+ && (
+ github.event.ref == 'refs/heads/develop'
+ || endsWith(github.event.ref, '.0')
+ )
+ )
with:
php-version: 8.1
coverage: none # disable xdebug, pcov
@@ -79,6 +89,17 @@ jobs:
set -o pipefail
pre-commit run php-cs --files ${ALL_CHANGED_FILES} | tee -a ${RAW_LOG}
+ - name: Run some pre-commit hooks on all files on push to "main" branches
+ if: |
+ github.event_name == 'push'
+ && (
+ github.event.ref == 'refs/heads/develop'
+ || endsWith(github.event.ref, '.0')
+ )
+ run: |
+ set -o pipefail
+ pre-commit run -a php-cs | tee -a ${RAW_LOG}
+
# If error, we convert log in the checkstyle format
- name: Convert Raw Log to CheckStyle format
if: ${{ failure() }}
diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index a784792ae02..b17753d66b8 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -40,6 +40,7 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09');
$value = GETPOST('value', 'alpha');
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'stock';
@@ -48,6 +49,7 @@ $type = 'stock';
/*
* Action
*/
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array();
@@ -196,7 +198,7 @@ if (isModEnabled('productbatch')) {
// STOCK_CALCULATE_ON_RECEPTION_CLOSE
$incmode = $langs->trans('StockOnReceptionOnClosing');
}
- print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced", $descmode, $incmode));
+ print info_admin($langs->transnoentitiesnoconv("WhenProductBatchModuleOnOptionAreForced", $descmode, $incmode));
}
diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php
index 1f46ee6df1b..16560b838ba 100644
--- a/htdocs/comm/action/document.php
+++ b/htdocs/comm/action/document.php
@@ -149,7 +149,7 @@ if ($object->id > 0) {
print dol_get_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action');
// Link to other agenda views
- $linkback .= '';
+ $linkback = '';
$linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
$linkback .= ''.$langs->trans("BackToList").'';
$linkback .= '';
diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php
index 2301e3e329c..7b39a4556c9 100644
--- a/htdocs/comm/action/info.php
+++ b/htdocs/comm/action/info.php
@@ -73,7 +73,7 @@ $head = actions_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action');
// Link to other agenda views
-$linkback .= '';
+$linkback = '';
$linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
$linkback .= ''.$langs->trans("BackToList").'';
$linkback .= '';
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 8aa8ac23537..5df4e184b93 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -915,6 +915,12 @@ while ($currentdaytoshow < $lastdaytoshow) {
}
}
$sql .= " AND u.statut = 1";
+ if ($filtert > 0) {
+ $sql .= " AND u.rowid = ".((int) $filtert);
+ }
+ if ($usergroup > 0) {
+ $sql .= " AND ug.fk_usergroup = ".((int) $usergroup);
+ }
if ($user->socid > 0) {
// External users should see only contacts of their company
$sql .= " AND u.fk_soc = ".((int) $user->socid);
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 9a0127134fa..66a8140e252 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -738,8 +738,6 @@ class FactureRec extends CommonInvoice
$line->total_tva = $objp->total_tva;
$line->total_ttc = $objp->total_ttc;
- //$line->code_ventilation = $objp->fk_code_ventilation;
-
$line->fk_product_fournisseur_price = $objp->fk_product_fournisseur_price;
$line->fk_fournprice = $objp->fk_product_fournisseur_price; // For backward compatibility
@@ -2276,7 +2274,7 @@ class FactureLigneRec extends CommonInvoiceLine
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
- //$this->code_ventilation = $objp->fk_code_ventilation;
+
$this->rang = $objp->rang;
$this->special_code = $objp->special_code;
$this->fk_unit = $objp->fk_unit;
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index fa7dbe14cde..41daf8bd39c 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2347,6 +2347,7 @@ class Facture extends CommonInvoice
$line->total_localtax1 = $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc;
+
$line->code_ventilation = $objp->fk_code_ventilation;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index f66b13dca46..078a19d9437 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -65,9 +65,9 @@ $langs->loadLangs(array('bills', 'companies', 'products', 'categories'));
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
-$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
+$id = (GETPOST('id', 'int') ? GETPOSTINT('id') : GETPOSTINT('facid')); // For backward compatibility
$ref = GETPOST('ref', 'alpha');
-$socid = GETPOST('socid', 'int');
+$socid = GETPOSTINT('socid');
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
@@ -82,7 +82,6 @@ if ($contextpage == 'poslist') {
$optioncss = 'print';
}
-$lineid = GETPOST('lineid', 'int');
$userid = GETPOST('userid', 'int');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_refcustomer = GETPOST('search_refcustomer', 'alpha');
@@ -580,9 +579,19 @@ $facturestatic = new Facture($db);
$formcompany = new FormCompany($db);
$companystatic = new Societe($db);
$companyparent = new Societe($db);
+
$company_url_list = array();
$subtypearray = $object->getArrayOfInvoiceSubtypes(0);
-$title = $langs->trans('BillsCustomers').' '.($socid > 0 ? ' '.$soc->name : '');
+
+if ($socid > 0) {
+ $soc = new Societe($db);
+ $soc->fetch($socid);
+ if (empty($search_company)) {
+ $search_company = $soc->name;
+ }
+}
+
+$title = $langs->trans('BillsCustomers').' '.($socid > 0 ? ' - '.$soc->name : '');
$help_url = 'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
@@ -970,14 +979,6 @@ if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $s
llxHeader('', $title, $help_url);
-if ($socid > 0) {
- $soc = new Societe($db);
- $soc->fetch($socid);
- if (empty($search_company)) {
- $search_company = $soc->name;
- }
-}
-
$param = '&socid='.urlencode($socid);
if (!empty($mode)) {
$param .= '&mode='.urlencode($mode);
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 82a713b8f3c..8c425f3f9db 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -9514,7 +9514,7 @@ abstract class CommonObject
$this->$field = (float) $obj->$field;
}
} else {
- if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
+ if (isset($obj->$field) && (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1))) {
$this->$field = (int) $obj->$field;
} else {
$this->$field = null;
@@ -9529,7 +9529,7 @@ abstract class CommonObject
$this->$field = (float) $obj->$field;
}
} else {
- if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) {
+ if (isset($obj->$field) && (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1))) {
$this->$field = (float) $obj->$field;
} else {
$this->$field = null;
diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php
index e09a6ce88fb..0c620cb8bd3 100644
--- a/htdocs/core/class/cunits.class.php
+++ b/htdocs/core/class/cunits.class.php
@@ -85,7 +85,7 @@ class CUnits extends CommonDict
$this->libelle = trim($this->short_label);
}
if (isset($this->unit_type)) {
- $this->active = trim($this->unit_type);
+ $this->unit_type = trim($this->unit_type);
}
if (isset($this->active)) {
$this->active = trim($this->active);
@@ -103,14 +103,14 @@ class CUnits extends CommonDict
$sql .= "code,";
$sql .= "label,";
$sql .= "short_label,";
- $sql .= "unit_type";
+ $sql .= "unit_type,";
$sql .= "scale";
$sql .= ") VALUES (";
$sql .= " ".(!isset($this->id) ? 'NULL' : "'".$this->db->escape($this->id)."'").",";
$sql .= " ".(!isset($this->code) ? 'NULL' : "'".$this->db->escape($this->code)."'").",";
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'").",";
$sql .= " ".(!isset($this->short_label) ? 'NULL' : "'".$this->db->escape($this->short_label)."'").",";
- $sql .= " ".(!isset($this->unit_type) ? 'NULL' : "'".$this->db->escape($this->unit_type)."'");
+ $sql .= " ".(!isset($this->unit_type) ? 'NULL' : "'".$this->db->escape($this->unit_type)."'").",";
$sql .= " ".(!isset($this->scale) ? 'NULL' : "'".$this->db->escape($this->scale)."'");
$sql .= ")";
@@ -402,7 +402,7 @@ class CUnits extends CommonDict
* @param string $code code of unit
* @param string $mode 0= id , short_label=Use short label as value, code=use code
* @param string $unit_type weight,size,surface,volume,qty,time...
- * @return int Return integer <0 if KO, Id of code if OK
+ * @return int|string Return integer <0 if KO, Id of code if OK (or $code if $mode is different from '', 'short_label' or 'code')
*/
public function getUnitFromCode($code, $mode = 'code', $unit_type = '')
{
diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php
index c4dd83ddb7e..4b61beba6b2 100644
--- a/htdocs/core/modules/facture/modules_facture.php
+++ b/htdocs/core/modules/facture/modules_facture.php
@@ -196,7 +196,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
* @param Translate $langs Translation object
* @return int Height in mm of the bottom-page QR invoice. Can be zero if not on right page; not enabled
*/
- protected function getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs): int
+ protected function getHeightForQRInvoice(int $pagenbr, Facture $object, Translate $langs)
{
if (getDolGlobalString('INVOICE_ADD_SWISS_QR_CODE') == 'bottom') {
// Keep it, to reset it after QRinvoice getter
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index 31514673a21..42e0e277797 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -201,6 +201,7 @@ foreach (array('internal', 'external') as $source) {
$entry->type = $contact['libelle'];
$entry->nature = "";
$entry->nature_html = "";
+ $entry->thirdparty_id = 0;
$entry->thirdparty_html = "";
$entry->thirdparty_name = "";
$entry->contact_html = "";
diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php
index 854d2c37cff..26d36a678db 100644
--- a/htdocs/core/triggers/interface_20_all_Logevents.class.php
+++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php
@@ -88,7 +88,7 @@ class InterfaceLogevents extends DolibarrTriggers
* @return int if KO: <0, if no trigger ran: 0, if OK: >0
* @throws Exception dol_syslog can throw Exceptions
*/
- public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf): int
+ public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (getDolGlobalString('MAIN_LOGEVENTS_DISABLE_ALL')) {
return 0; // Log events is disabled (hidden features)
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index fa4fcbe9ebd..1cd3886e63e 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -2044,7 +2044,7 @@ class CommandeFournisseur extends CommonOrder
$this->line->total_localtax2 = $total_localtax2;
$this->line->total_ttc = $total_ttc;
$this->line->product_type = $type;
- $this->line->special_code = (!empty($this->special_code) ? $this->special_code : 0);
+ $this->line->special_code = (!empty($special_code) ? $special_code : 0);
$this->line->origin = $origin;
$this->line->origin_id = $origin_id;
$this->line->fk_unit = $fk_unit;
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index a65fca4d55c..b61ec85ab97 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -407,7 +407,15 @@ $thirdparty = new Societe($db);
$subtypearray = $object->getArrayOfInvoiceSubtypes(0);
$now = dol_now();
-$title = $langs->trans("BillsSuppliers").($socid ? ' '.$soc->name : '');
+if ($socid > 0) {
+ $soc = new Societe($db);
+ $soc->fetch($socid);
+ if (empty($search_company)) {
+ $search_company = $soc->name;
+ }
+}
+
+$title = $langs->trans("BillsSuppliers").($socid ? ' - '.$soc->name : '');
$help_url = 'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores';
// Build and execute select
diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php
index 75cf03d1bb8..b4827ac1b78 100644
--- a/htdocs/resource/element_resource.php
+++ b/htdocs/resource/element_resource.php
@@ -333,7 +333,7 @@ if (!$ret) {
print dol_get_fiche_head($head, 'resources', $langs->trans("Action"), -1, 'action');
- $linkback .= '';
+ $linkback = '';
$linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"');
$linkback .= ''.$langs->trans("BackToList").'';
$linkback .= '';
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 2531a2d25cc..0e5305640bc 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -294,7 +294,7 @@ if (empty($reshook)) {
if ($pay != "delayed") {
$payment->create($user);
- $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
+ $res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
if ($res < 0) {
$error++;
dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1);
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index f3da2f3e84e..b7c75c7a2e9 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -334,7 +334,7 @@ class Ticket extends CommonObject
'fk_contract' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'visible'=>-1, 'enabled'=>'$conf->contract->enabled', 'position'=>53, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToContract"),
//'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ?
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1, 'csslist'=>'nowraponall'),
- 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1),
+ 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1, 'csslist'=>'nowraponall'),
'date_last_msg_sent' => array('type'=>'datetime', 'label'=>'TicketLastMessageDate', 'visible'=>0, 'enabled'=>1, 'position'=>502, 'notnull'=>-1),
'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'csslist'=>'tdoverflowmax100 maxwidth150onsmartphone'),
'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1),
@@ -344,7 +344,7 @@ class Ticket extends CommonObject
'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541),
'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'),
'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>'getDolGlobalString("TICKET_ENABLE_RESOLUTION")', 'position'=>550, 'notnull'=>1),
- 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'SolvedClosed', 9 => 'Deleted')),
+ 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 2 => 'Assigned', 3 => 'InProgress', 5 => 'NeedMoreInformation', 7 => 'OnHold', 8 => 'SolvedClosed', 9 => 'Deleted')),
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
);
// END MODULEBUILDER PROPERTIES