From 297ed6c70c8a63c442e0650947eda820b65c18c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Dec 2024 22:53:32 +0100 Subject: [PATCH 01/37] Debug v21 --- htdocs/theme/eldy/global.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index b198e461b82..adab42af0fa 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -8724,9 +8724,9 @@ table.jPicker { .side-nav { z-index: 200; background: var(--colorbackvmenu1); - /* padding-top: 70px; */ - position: relative; - top: 70px; + padding-top: 75px; + /*position: relative; + top: 75px;*/ width: 245px; /* must be same than div.login_block */ box-shadow: none; } From 4954e84d560923b3a54d19b5d10dd15a96483101 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 04:53:07 +0100 Subject: [PATCH 02/37] Debug v21 --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/datapolicy/admin/setup.php | 37 +++++++++++++++---- htdocs/datapolicy/class/datapolicy.class.php | 25 +++++++------ .../datapolicy/class/datapolicycron.class.php | 11 +++++- htdocs/langs/en_US/datapolicy.lang | 6 ++- 5 files changed, 57 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0b3d5c1ef13..933a07f6d22 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1429,7 +1429,7 @@ function dol_include_once($relpath, $classname = '') * @param int $type 0=Used for a Filesystem path, * 1=Used for an URL path (output relative), * 2=Used for an URL path (output full path using same host that current url), - * 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file) + * 3=Used for an URL path (output full path using host defined into $dolibarr_main_url_root of conf file, for an access from internet) * @param int $returnemptyifnotfound 0:If $type==0 and if file was not found into alternate dir, return default path into main dir (no test on it) * 1:If $type==0 and if file was not found into alternate dir, return empty string * 2:If $type==0 and if file was not found into alternate dir, test into main dir, return default path if found, empty string if not found diff --git a/htdocs/datapolicy/admin/setup.php b/htdocs/datapolicy/admin/setup.php index ea3ae94a6d5..5351f256011 100644 --- a/htdocs/datapolicy/admin/setup.php +++ b/htdocs/datapolicy/admin/setup.php @@ -156,21 +156,37 @@ $head = datapolicyAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', '', -1, ''); // Setup page goes here -print ''.$langs->trans("datapolicySetupPage").'
'; -// print $form->textwithpicto('', $langs->trans('DATAPOLICY_Tooltip_SETUP')); +print ''.$langs->trans("datapolicySetupPage").''; +print $form->textwithpicto('', $langs->trans('DATAPOLICY_Tooltip_SETUP', $langs->trans("DATAPOLICYJob"), $langs->transnoentities("CronList"))); +print '
'; +print '
'; print '
'; +// TODO Show the last date of execution of the job DATAPOLICYJob if ($action == 'edit') { print '
'; print ''; print ''; - print ''; - //print ''; + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print '
'.$langs->trans("Parameter").'
'; + + print ''; + print ''; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + print ''; + } + print ''; foreach ($arrayofparameters as $title => $tab) { - print ''; + print ''; + print ''; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + print ''; + } + print ''; + foreach ($tab as $key => $val) { print ''; + print ''; + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + print ''; + } + + print ''; } } print '
'.$langs->trans("DelayForAnonymization").''.$langs->trans("DelayForDeletion").'
'.$langs->trans($title).'
'.$langs->trans($title).'
'; print $val['picto']; @@ -184,11 +200,19 @@ if ($action == 'edit') { } print ''; print ajax_combobox($key); - print '
'; + print $langs->trans("FeatureNotYetAvailable"); + print '
'; + print ''; print $form->buttonsSaveCancel("Save", ''); @@ -196,7 +220,6 @@ if ($action == 'edit') { print '
'; } else { print ''; - //print ''; foreach ($arrayofparameters as $title => $tab) { print ''; diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index 8421b84c924..21a19ae7ec6 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -21,6 +21,7 @@ * \file datapolicy/class/datapolicy.class.php * \ingroup datapolicy * \brief Class to manage feature of Data Policy module. + * This class file is not used. */ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -61,7 +62,7 @@ class DataPolicy */ public function getAllContactNotInformed() { - global $langs, $conf, $db, $user; + global $langs, $conf, $db; $langs->load("companies"); @@ -69,9 +70,9 @@ class DataPolicy $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as spe ON spe.fk_object = c.rowid"; - $sql .= " WHERE (c.statut=1 AND c.no_email=0 AND (spe.datapolicy_consentement=0 OR spe.datapolicy_consentement IS NULL) AND (spe.datapolicy_opposition_traitement=0 OR spe.datapolicy_opposition_traitement IS NULL) AND (spe.datapolicy_opposition_prospection=0 OR spe.datapolicy_opposition_prospection IS NULL))"; + $sql .= " WHERE (c.statut = 1 AND c.no_email = 0 AND (spe.datapolicy_consentement = 0 OR spe.datapolicy_consentement IS NULL) AND (spe.datapolicy_opposition_traitement = 0 OR spe.datapolicy_opposition_traitement IS NULL) AND (spe.datapolicy_opposition_prospection = 0 OR spe.datapolicy_opposition_prospection IS NULL))"; $sql .= " AND spe.datapolicy_send IS NULL"; - $sql .= " AND c.entity=".$conf->entity; + $sql .= " AND c.entity = ".((int) $conf->entity); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -99,16 +100,16 @@ class DataPolicy */ public function getAllCompaniesNotInformed() { - global $langs, $conf, $db, $user; + global $langs, $conf, $db; $langs->load("companies"); $sql = "SELECT s.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as se ON se.fk_object = s.rowid"; - $sql .= " WHERE s.statut=0 AND (se.datapolicy_consentement=0 OR se.datapolicy_consentement IS NULL) AND (se.datapolicy_opposition_traitement=0 OR se.datapolicy_opposition_traitement IS NULL) AND (se.datapolicy_opposition_prospection=0 OR se.datapolicy_opposition_prospection IS NULL)"; + $sql .= " WHERE s.statut = 0 AND (se.datapolicy_consentement = 0 OR se.datapolicy_consentement IS NULL) AND (se.datapolicy_opposition_traitement = 0 OR se.datapolicy_opposition_traitement IS NULL) AND (se.datapolicy_opposition_prospection = 0 OR se.datapolicy_opposition_prospection IS NULL)"; $sql .= " AND se.datapolicy_send IS NULL"; - $sql .= " AND s.entity=".$conf->entity; + $sql .= " AND s.entity = ".((int) $conf->entity); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -136,16 +137,16 @@ class DataPolicy */ public function getAllAdherentsNotInformed() { - global $langs, $conf, $db, $user; + global $langs, $conf, $db; $langs->load("adherent"); $sql = "SELECT a.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ae ON ae.fk_object = a.rowid"; - $sql .= " WHERE a.statut=0 AND (ae.datapolicy_consentement=0 OR ae.datapolicy_consentement IS NULL) AND (ae.datapolicy_opposition_traitement=0 OR ae.datapolicy_opposition_traitement IS NULL) AND (ae.datapolicy_opposition_prospection=0 OR ae.datapolicy_opposition_prospection IS NULL)"; + $sql .= " WHERE a.statut = 0 AND (ae.datapolicy_consentement = 0 OR ae.datapolicy_consentement IS NULL) AND (ae.datapolicy_opposition_traitement=0 OR ae.datapolicy_opposition_traitement IS NULL) AND (ae.datapolicy_opposition_prospection=0 OR ae.datapolicy_opposition_prospection IS NULL)"; $sql .= " AND ae.datapolicy_send IS NULL"; - $sql .= " AND a.entity=".$conf->entity; + $sql .= " AND a.entity = ".((int) $conf->entity); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -174,7 +175,7 @@ class DataPolicy */ public static function sendMailDataPolicyContact($contact) { - global $langs, $conf, $db, $user; + global $langs, $db, $user; $error = 0; @@ -252,7 +253,7 @@ class DataPolicy */ public static function sendMailDataPolicyCompany($societe) { - global $langs, $conf, $db, $user; + global $langs, $db, $user; $error = 0; @@ -327,7 +328,7 @@ class DataPolicy */ public static function sendMailDataPolicyAdherent($adherent) { - global $langs, $conf, $db, $user; + global $langs, $db, $user; $error = 0; diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index d2b8d88a1fa..6b588eda92c 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -468,6 +468,7 @@ class DataPolicyCron $this->db->begin(); + // Loop on each type of data foreach ($arrayofparameters as $key => $params) { if (getDolGlobalInt($key) > 0) { // @phan-suppress-next-line PhanPluginPrintfVariableFormatString @@ -488,10 +489,12 @@ class DataPolicyCron $object->fetch($obj->rowid); $object->id = $obj->rowid; - $action = 'anonymize'; // TODO Offer also action "delete" in setup of module + $action = 'anonymize'; // TODO Offer also action "delete" in the setup of the module + // Manage action 'anonymize' if ($action == 'anonymize') { - if ($object->isObjectUsed($obj->rowid) == 0) { // If object to clean is used + if ($object->isObjectUsed($obj->rowid) == 0) { // If object to clean is not used + // Loop on each field to anonymize foreach ($params['fields_anonym'] as $field => $val) { if ($val == 'MAKEANONYMOUS') { $object->$field = $field.'-anonymous-'.$obj->rowid; // @phpstan-ignore-line @@ -499,7 +502,10 @@ class DataPolicyCron $object->$field = $val; } } + + // Update record $result = $object->update($obj->rowid, $user); + if ($result > 0) { $errormsg = $object->error; $error++; @@ -508,6 +514,7 @@ class DataPolicyCron } } + // Manage action 'deletion' if ($action == 'delete') { // If object to clean is not used $result = $object->delete($user); if ($result < 0) { diff --git a/htdocs/langs/en_US/datapolicy.lang b/htdocs/langs/en_US/datapolicy.lang index 7cbc85b7475..73c23f457ee 100644 --- a/htdocs/langs/en_US/datapolicy.lang +++ b/htdocs/langs/en_US/datapolicy.lang @@ -18,7 +18,7 @@ Module4100Desc = Module to manage Data Privacy (Conformity with the GDPR) # Administration page datapolicySetup = Module Data Privacy Policy Setup Deletion = Deletion of data -datapolicySetupPage = Depending on the laws of your countries (Example Article 5 of the GDPR), personal data must be kept for a period not exceeding the duration the data is needed for the purpose for which it was collected, except for archival purposes.
The deletion will be done automatically after a certain duration without events (the duration which you will have indicated below). +datapolicySetupPage = Depending on the laws of your countries (Example Article 5 of the GDPR), personal data must be kept for a period not exceeding the duration the data is needed for the purpose for which it was collected, except for archival purposes.
This module will make an anonymization automatically after a certain duration without events (the duration which you will have indicated below) and if the object has no existing business object children. NB_MONTHS = %s months ONE_YEAR = 1 year NB_YEARS = %s years @@ -33,12 +33,14 @@ DATAPOLICY_CONTACT_PROSPECT_CLIENT = Prospect/Customer DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT = Nor prospect/Nor customer DATAPOLICY_CONTACT_FOURNISSEUR = Supplier DATAPOLICY_ADHERENT = Member -DATAPOLICY_Tooltip_SETUP=Define the delay with no interaction after which you want the record to be automatically purged. +DATAPOLICY_Tooltip_SETUP=The anonymization is done by the scheduled job "%s" ran by the module "%s", so this module must be enabled and working correctly. SendAgreementText = You can send a GDPR email to all your relevant contacts (who have not yet received an email and for which you have not registered anything about their GDPR agreement). To do this, use the following button. SendAgreement = Send emails AllAgreementSend = All emails have been sent TXTLINKDATAPOLICYACCEPT = Text for the link "agreement" TXTLINKDATAPOLICYREFUSE = Text for the link "disagreement" +DelayForAnonymization=Delay for anonymization +DelayForDeletion=Delay for deletion # Extrafields DATAPOLICY_BLOCKCHECKBOX = GDPR : Processing of personal data DATAPOLICY_consentement = Consent obtained for the processing of personal data From f7cdd5fd084ad24e7bcebcaa01affe891d507dc4 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 11:43:38 +0100 Subject: [PATCH 03/37] Debug v21 --- htdocs/datapolicy/lib/datapolicy.lib.php | 2 +- htdocs/langs/en_US/datapolicy.lang | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/datapolicy/lib/datapolicy.lib.php b/htdocs/datapolicy/lib/datapolicy.lib.php index 5d24333e0e4..a11e4bcbfbc 100644 --- a/htdocs/datapolicy/lib/datapolicy.lib.php +++ b/htdocs/datapolicy/lib/datapolicy.lib.php @@ -38,7 +38,7 @@ function datapolicyAdminPrepareHead() $head = array(); $head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setup.php"; - $head[$h][1] = $langs->trans("Deletion"); + $head[$h][1] = $langs->trans("DataAnonymization"); $head[$h][2] = 'settings'; $h++; diff --git a/htdocs/langs/en_US/datapolicy.lang b/htdocs/langs/en_US/datapolicy.lang index 73c23f457ee..38a4f48f39f 100644 --- a/htdocs/langs/en_US/datapolicy.lang +++ b/htdocs/langs/en_US/datapolicy.lang @@ -17,7 +17,8 @@ Module4100Name = Data Privacy Policy Module4100Desc = Module to manage Data Privacy (Conformity with the GDPR) # Administration page datapolicySetup = Module Data Privacy Policy Setup -Deletion = Deletion of data +DataDeletion=Deletion of data +DataAnonymization=Anonymization of data datapolicySetupPage = Depending on the laws of your countries (Example Article 5 of the GDPR), personal data must be kept for a period not exceeding the duration the data is needed for the purpose for which it was collected, except for archival purposes.
This module will make an anonymization automatically after a certain duration without events (the duration which you will have indicated below) and if the object has no existing business object children. NB_MONTHS = %s months ONE_YEAR = 1 year From a8f2e842b266e65b1d9d159375be44564656f22b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 11:50:47 +0100 Subject: [PATCH 04/37] Debug v21 --- htdocs/comm/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 5ed10dc2bd1..cce00f8b832 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -376,7 +376,7 @@ if ($object->id > 0) { } if ($object->client) { - $langs->load("compta"); + $langs->loadLangs(array("compta", "accountancy")); print '
\n"; + print '\n"; // User print ''; // Label @@ -909,12 +912,12 @@ if ($id > 0) { print '
'.$langs->trans("Parameter").'
'.$langs->trans($title).'
'; print $langs->trans('CustomerCode').''; From c0e83d0f18c6579442862a056517e8dca0289cfb Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 12:51:46 +0100 Subject: [PATCH 05/37] Prepare v21 --- build/makepack-dolibarr.pl | 177 +++++++++++++++++++------------------ 1 file changed, 89 insertions(+), 88 deletions(-) diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 629672d06c4..9370d504627 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -4,7 +4,7 @@ # \brief Dolibarr package builder (tgz, zip, rpm, deb, exe, aps) # \author (c)2004-2023 Laurent Destailleur # -# This is list of constant you can set to have generated packages moved into a specific dir: +# This is list of constant you can set to have generated packages moved into a specific dir: #DESTIBETARC='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/lastbuild' #DESTISTABLE='/media/HDDATA1_LD/Mes Sites/Web/Dolibarr/dolibarr.org/files/stable' #DESTIMODULES='/media/HDDATA1_LD/Mes Sites/Web/Admin1/wwwroot/files/modules' @@ -129,7 +129,7 @@ if (! $TEMP || ! -d $TEMP) { print "$PROG.$Extension aborted.\n"; sleep 2; exit 2; -} +} $BUILDROOT="$TEMP/buildroot"; @@ -172,7 +172,7 @@ $newbuild = $BUILD; $newbuild =~ s/(dev|alpha)/1/gi; # dev $newbuild =~ s/beta(.?)/2/gi; # beta (we want beta1, beta2, betax to be same package name) $newbuild =~ s/rc(.?)/3/gi; # rc (we want rc1, rc2, rcx to be same package name) -if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale is same than rc. +if ($newbuild !~ /-/) { $newbuild.='-4'; } # finale is same than rc. # now newbuild is 0-1 or 0-4 for example. Note that for native package (see debian/source/format), we should not use a dash part but to get a better version management $build = $newbuild; $build =~ s/-.*$//g; @@ -190,8 +190,8 @@ for (0..@ARGV-1) { if ($ARGV[$_] =~ /^-*target=(\w+)/i) { $target=$1; $batch=1; } if ($ARGV[$_] =~ /^-*desti=(.+)/i) { $DESTI=$1; } if ($ARGV[$_] =~ /^-*prefix=(.+)/i) { - $PREFIX=$1; - $FILENAMESNAPSHOT.="-".$PREFIX; + $PREFIX=$1; + $FILENAMESNAPSHOT.="-".$PREFIX; } } if ($ENV{"DESTIBETARC"} && $BUILD =~ /[a-z]/i) { $DESTI = $ENV{"DESTIBETARC"}; } # Force output dir if env DESTIBETARC is defined @@ -210,7 +210,7 @@ print "Target directory (DESTI) : $DESTI\n"; # Choose package targets #----------------------- if ($target) { - if ($target eq "ALL") { + if ($target eq "ALL") { foreach my $key (@LISTETARGET) { if ($key ne 'SNAPSHOT' && $key ne 'SF' && $key ne 'ASSO') { $CHOOSEDTARGET{$key}=1; } } @@ -236,10 +236,10 @@ else { printf(" %2d - %-14s (%s)\n",$cpt,"ASSO (publish)","Need ".$REQUIREMENTPUBLISH{"ASSO"}); $cpt=99; printf(" %2d - %-14s (%s)\n",$cpt,"SF (publish)","Need ".$REQUIREMENTPUBLISH{"SF"}); - + # Ask which target to build print "Choose one target number or several separated with space (0 - ".$cpt."): "; - $NUM_SCRIPT=; + $NUM_SCRIPT=; chomp($NUM_SCRIPT); if ($NUM_SCRIPT !~ /^[0-9\s]+$/) { @@ -286,11 +286,11 @@ foreach my $target (sort keys %CHOOSEDTARGET) { print "Error: You asked creation of several rpms. Because all rpm have same name, you must defined an environment variable DESTI to tell packager where it can create subdirs for each generated package.\n"; exit; } - $atleastonerpm=1; - } - foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) + $atleastonerpm=1; + } + foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) { - # Test + # Test print "Test requirement for target $target: Search '$req'... "; $newreq=$req; $newparam=''; if ($newreq eq 'zip') { $newparam.='-h'; } @@ -299,12 +299,12 @@ foreach my $target (sort keys %CHOOSEDTARGET) { print "Test command ".$cmd."... "; $ret=`$cmd`; $coderetour=$?; $coderetour2=$coderetour>>8; - if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) { + if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) { # Not found error, we try in PROGPATH $ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`; $coderetour=$?; $coderetour2=$coderetour>>8; $REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req"; - } + } if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) { # Not found error @@ -333,7 +333,7 @@ $nbofpublishneedchangelog=0; foreach my $target (sort keys %CHOOSEDTARGET) { if ($target eq '-CHKSUM') { $nbofpublishneedchangelog++; } if ($CHOOSEDTARGET{$target} < 0) { next; } - if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM') + if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP' && $target ne '-CHKSUM') { $nboftargetneedbuildroot++; } @@ -397,10 +397,10 @@ if ($nboftargetok) { print "Go to directory $SOURCE\n"; $olddir=getcwd(); chdir("$SOURCE"); - + print "Clean $SOURCE/htdocs/includes/autoload.php\n"; $ret=`rm -f $SOURCE/htdocs/includes/autoload.php`; - + $ret=`git ls-files . --exclude-standard --others`; if ($ret) { @@ -409,7 +409,7 @@ if ($nboftargetok) { print "Canceled.\n"; exit; } - + print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filelist_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n"; $ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`; print $ret."\n"; @@ -427,13 +427,13 @@ if ($nboftargetok) { print "Go to directory $SOURCE\n"; $olddir=getcwd(); chdir("$SOURCE"); - + print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`; if ($ret =~ /(already exists|existe déjà)/) { print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? "; - $QUESTIONOVERWRITETAG=; + $QUESTIONOVERWRITETAG=; chomp($QUESTIONOVERWRITETAG); if ($QUESTIONOVERWRITETAG =~ /(o|y)/) { @@ -452,7 +452,7 @@ if ($nboftargetok) { } chdir("$olddir"); } - + # Update buildroot if required #----------------------------- if ($nboftargetneedbuildroot) @@ -462,7 +462,7 @@ if ($nboftargetok) { print "Delete directory $BUILDROOT\n"; $ret=`rm -fr "$BUILDROOT"`; - + mkdir "$BUILDROOT"; mkdir "$BUILDROOT/$PROJECT"; print "Copy $SOURCE into $BUILDROOT/$PROJECT\n"; @@ -491,7 +491,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/phpstan.neon.dist`; $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`; - + $ret=`rm -fr $BUILDROOT/$PROJECT/build/html`; $ret=`rm -f $BUILDROOT/$PROJECT/build/Doli*-*`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`; @@ -507,6 +507,7 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`; $ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`; $ret=`rm -f $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`; + $ret=`rm -fr $BUILDROOT/$PROJECT/build/phpstan/phpstan`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`; @@ -560,20 +561,20 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot11.png`; $ret=`rm -f $BUILDROOT/$PROJECT/doc/images/dolibarr_screenshot12.png`; - # Security to avoid to package data files + # Security to avoid to package data files print "Remove documents dir\n"; $ret=`rm -fr $BUILDROOT/$PROJECT/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/documents`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; - + print "Remove subdir of custom dir\n"; print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n"; $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n"; $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files - # Removed known external modules to avoid any error when packaging from env where external modules are tested + # Removed known external modules to avoid any error when packaging from env where external modules are tested $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/abricot*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`; @@ -599,15 +600,15 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/common/fontawesome-5/svgs`; - + # Removed other test files $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; - - # Removed files installed by the awful composer + + # Removed files installed by the awful composer $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/bin`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries @@ -642,7 +643,7 @@ if ($nboftargetok) { $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`; - + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/bin`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/bin`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/*/bin`; @@ -652,14 +653,14 @@ if ($nboftargetok) { # Build package for each target #------------------------------ - foreach my $target (sort keys %CHOOSEDTARGET) + foreach my $target (sort keys %CHOOSEDTARGET) { if ($CHOOSEDTARGET{$target} < 0) { next; } if ($target eq '-CHKSUM') { next; } - + print "\nBuild package for target $target\n"; - if ($target eq 'SNAPSHOT') + if ($target eq 'SNAPSHOT') { $NEWDESTI=$DESTI; @@ -683,13 +684,13 @@ if ($nboftargetok) { next; } - if ($target eq 'TGZ') + if ($target eq 'TGZ') { $NEWDESTI=$DESTI; if ($NEWDESTI =~ /stable/) { mkdir($DESTI.'/standard'); - if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } + if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } } print "Remove target $FILENAMETGZ.tgz...\n"; @@ -703,7 +704,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$FILENAMETGZ/build/exe`; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages - + print "Compress $FILENAMETGZ into $FILENAMETGZ.tgz...\n"; $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMETGZ.tgz\" $FILENAMETGZ"; print "$cmd\n"; @@ -715,14 +716,14 @@ if ($nboftargetok) { next; } - if ($target eq 'XZ') + if ($target eq 'XZ') { $NEWDESTI=$DESTI; if ($NEWDESTI =~ /stable/) { mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } - } + } print "Remove target $FILENAMEXZ.xz...\n"; unlink("$NEWDESTI/$FILENAMEXZ.xz"); @@ -735,7 +736,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$FILENAMEXZ/build/exe`; $ret=`rm -fr $BUILDROOT/$FILENAMEXZ/htdocs/includes/ckeditor/_source`; # We can't remove it with exclude file, we need it for some tarball packages - + print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n"; print "Go to directory $BUILDROOT\n"; @@ -751,15 +752,15 @@ if ($nboftargetok) { $ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`; next; } - - if ($target eq 'ZIP') + + if ($target eq 'ZIP') { $NEWDESTI=$DESTI; if ($NEWDESTI =~ /stable/) { mkdir($DESTI.'/standard'); if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; } - } + } print "Remove target $FILENAMEZIP.zip...\n"; unlink("$NEWDESTI/$FILENAMEZIP.zip"); @@ -782,14 +783,14 @@ if ($nboftargetok) { print $cmd."\n"; $ret= `$cmd`; chdir("$olddir"); - + # Move to final dir print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n"; $ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`; next; } - - if ($target =~ /RPM/) # Linux only + + if ($target =~ /RPM/) # Linux only { $NEWDESTI=$DESTI; $subdir="package_rpm_generic"; @@ -800,7 +801,7 @@ if ($nboftargetok) { { mkdir($DESTI.'/'.$subdir); if (-d $DESTI.'/'.$subdir) { $NEWDESTI=$DESTI.'/'.$subdir; } - } + } if ($RPMDIR eq "") { $RPMDIR=$ENV{'HOME'}."/rpmbuild"; } @@ -813,7 +814,7 @@ if ($nboftargetok) { print "Create directory $BUILDROOT/$FILENAMETGZ2\n"; $ret=`rm -fr $BUILDROOT/$FILENAMETGZ2`; - + print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMETGZ2\n"; $cmd="cp -pr '$BUILDROOT/$PROJECT' '$BUILDROOT/$FILENAMETGZ2'"; $ret=`$cmd`; @@ -839,7 +840,7 @@ if ($nboftargetok) { if ($target =~ /FEDO/i) { $BUILDFICSRC="${FILENAME}_fedora.spec"; } if ($target =~ /MAND/i) { $BUILDFICSRC="${FILENAME}_mandriva.spec"; } if ($target =~ /OPEN/i) { $BUILDFICSRC="${FILENAME}_opensuse.spec"; } - + use Date::Language; $lang=Date::Language->new('English'); $datestring = $lang->time2str("%a %b %e %Y", time); @@ -857,7 +858,7 @@ if ($nboftargetok) { } close SPECFROM; close SPECTO; - + print "Copy patch file to $RPMDIR/SOURCES\n"; $ret=`cp "$SOURCE/build/rpm/dolibarr-forrpm.patch" "$RPMDIR/SOURCES"`; $ret=`chmod 644 $RPMDIR/SOURCES/dolibarr-forrpm.patch`; @@ -879,14 +880,14 @@ if ($nboftargetok) { next; } - if ($target eq 'DEB') + if ($target eq 'DEB') { $NEWDESTI=$DESTI; if ($NEWDESTI =~ /stable/) { mkdir($DESTI.'/package_debian-ubuntu'); if (-d $DESTI.'/package_debian-ubuntu') { $NEWDESTI=$DESTI.'/package_debian-ubuntu'; } - } + } $olddir=getcwd(); @@ -967,13 +968,13 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/jquery/plugins/select2/LICENSE`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mike42/escpos-php/LICENSE.md`; $ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/mobiledetect/mobiledetectlib/LICENSE.txt`; - + # Removed files we don't need (already removed) #$ret=`rm -fr $BUILDROOT/$PROJECT.tmp/htdocs/includes/ckeditor/ckeditor/_source`; - + # Rename upstream changelog to match debian rules $ret=`mv $BUILDROOT/$PROJECT.tmp/ChangeLog $BUILDROOT/$PROJECT.tmp/changelog`; - + # Prepare source package (init debian dir) print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n"; $ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`; @@ -1011,7 +1012,7 @@ if ($nboftargetok) { $ret=`cp -f "$SOURCE/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/dolibarr.templates" "$BUILDROOT/$PROJECT.tmp/debian"`; $ret=`cp -f "$SOURCE/build/debian/install.forced.php.install" "$BUILDROOT/$PROJECT.tmp/debian"`; - + # Set owners and permissions #print "Set owners on files/dir\n"; #$ret=`chown -R root.root $BUILDROOT/$PROJECT.tmp`; @@ -1042,8 +1043,8 @@ if ($nboftargetok) { $ret=`$cmd`; $cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; "; $ret=`$cmd`; - - + + print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; $cmd="mv $BUILDROOT/$PROJECT.tmp $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; $ret=`$cmd`; @@ -1051,14 +1052,14 @@ if ($nboftargetok) { print "Go into directory $BUILDROOT\n"; chdir("$BUILDROOT"); - + # We need a tarball to be able to build "quilt" debian package (not required for native but we need patch so it is not a native) print "Compress $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build into $BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz...\n"; $cmd="tar --exclude-vcs --exclude-from \"$BUILDROOT/$PROJECT/build/tgz/tar_exclude.txt\" --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$BUILDROOT/$FILENAMEDEBNATIVE.orig.tar.gz\" $PROJECT-$MAJOR.$MINOR.$build"; print $cmd."\n"; $ret=`$cmd`; - # Creation of source package + # Creation of source package print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"); #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; @@ -1077,12 +1078,12 @@ if ($nboftargetok) { $ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`; $ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`; $ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`; - #$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`; # xz file is generated when build/debian/sources/option + #$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`; # xz file is generated when build/debian/sources/option $ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`; $ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`; next; } - + if ($target eq 'EXEDOLIWAMP') { $NEWDESTI=$DESTI; @@ -1090,22 +1091,22 @@ if ($nboftargetok) { { mkdir($DESTI.'/package_windows'); if (-d $DESTI.'/package_windows') { $NEWDESTI=$DESTI.'/package_windows'; } - } + } print "Remove target $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe...\n"; unlink "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"; - + if ($OS eq 'windows') { print "Check that ISCC.exe is in your PATH.\n"; } else { print "Check that in your Wine setup, you have created a Z: drive that point to your / directory.\n"; } - + $SOURCEBACK=$SOURCE; $SOURCEBACK =~ s/\//\\/g; print "Prepare file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" from \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.iss\"\n"; - + #$ret=`cat "$SOURCE/build/exe/doliwamp/doliwamp.iss" | sed -e 's/__FILENAMEEXEDOLIWAMP__/$FILENAMEEXEDOLIWAMP/g' > "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`; open(IN, '<' . $SOURCE."/build/exe/doliwamp/doliwamp.iss") or die $!; open(OUT, '>' . "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss") or die $!; @@ -1118,7 +1119,7 @@ if ($nboftargetok) { close(OUT); print "Compil exe $FILENAMEEXEDOLIWAMP.exe file from iss file \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\" on OS $OS\n"; - + if ($OS eq 'windows') { $cmd= "ISCC.exe \"$SOURCEBACK\\build\\exe\\doliwamp\\doliwamp.tmp.iss\""; } else { @@ -1132,26 +1133,26 @@ if ($nboftargetok) { print "Move \"$SOURCE\\build\\$FILENAMEEXEDOLIWAMP.exe\" to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; rename("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe","$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"); print "Move $SOURCE/build/$FILENAMEEXEDOLIWAMP.exe to $NEWDESTI/$FILENAMEEXEDOLIWAMP.exe\n"; - + use File::Copy; #$ret=`mv "$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe" "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"`; $ret=move("$SOURCE/build/$FILENAMEEXEDOLIWAMP.exe", "$NEWDESTI/$FILENAMEEXEDOLIWAMP.exe"); - + print "Remove tmp file $SOURCE/build/exe/doliwamp/doliwamp.tmp.iss\n"; #$ret=`rm "$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"`; $ret=unlink("$SOURCE/build/exe/doliwamp/doliwamp.tmp.iss"); - + next; } } # Publish package for each target #-------------------------------- - foreach my $target (sort keys %CHOOSEDPUBLISH) + foreach my $target (sort keys %CHOOSEDPUBLISH) { if ($CHOOSEDPUBLISH{$target} < 0) { next; } - + print "\nList of files to publish (BUILD=$BUILD)\n"; %filestoscansf=( "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'none', # none means it won't be published on SF @@ -1209,26 +1210,26 @@ if ($nboftargetok) { print "\n"; } - if ($target eq 'SF' || $target eq 'ASSO') + if ($target eq 'SF' || $target eq 'ASSO') { print "\n"; - + if ($target eq 'SF') { $PUBLISH = $PUBLISHSTABLE; } if ($target eq 'ASSO' && $BUILD =~ /[a-z]/i) { $PUBLISH = $PUBLISHBETARC.'/lastbuild'; } if ($target eq 'ASSO' && $BUILD =~ /^[0-9]+$/) { $PUBLISH = $PUBLISHBETARC.'/stable'; } - + $NEWPUBLISH=$PUBLISH; print "Publish to target $NEWPUBLISH. Click enter or CTRL+C...\n"; # Ask which target to build - $NUM_SCRIPT=; + $NUM_SCRIPT=; chomp($NUM_SCRIPT); print "Create empty dir /tmp/emptydir. We need it to create target dir using rsync.\n"; $ret=`mkdir -p "/tmp/emptydir/"`; - + %filestoscan=%filestoscansf; - + foreach my $file (sort keys %filestoscan) { $found=0; @@ -1238,30 +1239,30 @@ if ($nboftargetok) { if ($target eq 'SF') { if ($filestoscan{$file} eq 'none') { next; - } + } $destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD; } elsif ($target eq 'ASSO' and $NEWPUBLISH =~ /stable/) { $destFolder="$NEWPUBLISH/$filestoscanstableasso{$file}"; - } + } elsif ($target eq 'ASSO' and $NEWPUBLISH !~ /stable/) { $destFolder="$NEWPUBLISH"; - } + } else # No more used { $dirnameonly=$file; - $dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/; + $dirnameonly =~ s/.*\/([^\/]+)\/[^\/]+$/$1/; $filenameonly=$file; - $filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/; + $filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/; $destFolder="$NEWPUBLISH/$dirnameonly"; } print "\n"; print "Publish file ".$file." to ".$destFolder."\n"; - # mkdir + # mkdir #my $ssh = Net::SSH::Perl->new("frs.sourceforge.net"); - #$ssh->login("$user","$pass"); + #$ssh->login("$user","$pass"); #use String::ShellQuote qw( shell_quote ); #$ssh->cmd('mkdir '.shell_quote($destFolder).' && exit'); @@ -1270,20 +1271,20 @@ if ($nboftargetok) { #$sftp->mkdir($destFolder) #$command="ssh eldy,dolibarr\@frs.sourceforge.net mkdir -p \"$destFolder\""; - #print "$command\n"; + #print "$command\n"; #my $ret=`$command 2>&1`; $command="rsync -s -e 'ssh' --recursive /tmp/emptydir/ \"".$destFolder."\""; - print "$command\n"; + print "$command\n"; my $ret=`$command 2>&1`; $command="rsync -s -e 'ssh' \"$file\" \"".$destFolder."\""; - print "$command\n"; + print "$command\n"; my $ret2=`$command 2>&1`; print "$ret2\n"; } } - } + } } print "\n----- Summary -----\n"; From e2c4f42093c77519aad3f82f7040929987f98c2b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 14:57:55 +0100 Subject: [PATCH 06/37] Trans --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 4ea49a160fa..9fd4ad9ce0e 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -125,6 +125,7 @@ Language_uk_UA=Ukrainian Language_ur_PK=Urdu Language_uz_UZ=Uzbek Language_vi_VN=Vietnamese +Language_wo_SN=Wolof Language_zh_CN=Chinese Language_zh_TW=Chinese (Taiwan) Language_zh_HK=Chinese (Hong Kong) From 4ec331a201e04ea50e0c2f3fc64eca1b28155d73 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 15:57:52 +0100 Subject: [PATCH 07/37] Debug v21 --- htdocs/compta/facture/prelevement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 503c21af370..6d74a72e2c3 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -1108,7 +1108,7 @@ if ($object->id > 0) { } // Date - print ''.dol_print_date($db->jdate($obj->date_demande), 'day')."'.dol_print_date($db->jdate($obj->date_demande), 'day', 'tzuserrel')."'; From 647238b94618b887486f66ad0bf25fe2a673d55d Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 16:50:22 +0100 Subject: [PATCH 08/37] Debug v21 --- htdocs/compta/facture/prelevement.php | 47 ++++------------- htdocs/core/class/commoninvoice.class.php | 62 +++++++++++++++++++++-- htdocs/langs/en_US/salaries.lang | 1 - 3 files changed, 69 insertions(+), 41 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 6d74a72e2c3..50a513a994f 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -300,7 +300,6 @@ if ($object->id > 0) { if ($object->paid) { $resteapayer = 0; } - $resteapayeraffiche = $resteapayer; if ($type == 'bank-transfer') { if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { // Not recommended @@ -333,7 +332,7 @@ if ($object->id > 0) { $author = new User($db); if (!empty($object->user_creation_id)) { $author->fetch($object->user_creation_id); - } elseif (!empty($object->fk_user_author)) { + } elseif (!empty($object->fk_user_author)) { // For backward compatibility $author->fetch($object->fk_user_author); } @@ -348,28 +347,8 @@ if ($object->id > 0) { $numclosed = 0; // How many Direct debit or Credit transfer open requests ? - - $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande"; - $sql .= " , pfd.date_traite as date_traite"; - $sql .= " , pfd.amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; - if ($type == 'bank-transfer') { - $sql .= " WHERE fk_facture_fourn = ".((int) $object->id); - } else { - $sql .= " WHERE fk_facture = ".((int) $object->id); - } - $sql .= " AND pfd.traite = 0"; - $sql .= " AND pfd.type = 'ban'"; - $sql .= " ORDER BY pfd.date_demande DESC"; - - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $numopen = $num; - } else { - dol_print_error($db); - } - + $listofopendirectdebitorcredittransfer = $object->getListOfOpenDirectDebitOrCreditTransfer($type); + $numopen = count($listofopendirectdebitorcredittransfer); print dol_get_fiche_head($head, 'standingorders', $title, -1, ($type == 'bank-transfer' ? 'supplier_invoice' : 'bill')); @@ -795,11 +774,7 @@ if ($object->id > 0) { print '
'; - //print ''; - //print ''; - //print ''; // Bank Transfer Amount - //print ''; - - //print '
'. print $langs->trans('CustomerIBAN').' '; - //print ''; // if societe rib in model invoice, we preselect it $selectedRib = ''; @@ -826,16 +801,16 @@ if ($object->id > 0) { print img_warning($langs->trans("NoDefaultIBANFound")); } - //print '
'; - print '     '; - //print ''; + print '     '; print ''; - //print '
'; // Button print '

'; @@ -849,7 +824,7 @@ if ($object->id > 0) { if (getDolGlobalString('STRIPE_SEPA_DIRECT_DEBIT_SHOW_OLD_BUTTON')) { // This is hidden, prefer to use mode enabled with STRIPE_SEPA_DIRECT_DEBIT // TODO Replace this with a checkbox for each payment mode: "Send request to XXX immediately..." print "
"; - //add stripe sepa button + // Add stripe sepa button $buttonlabel = $langs->trans("MakeWithdrawRequestStripe"); print ''; print ''; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 748d7e8bc50..c54b9d149a4 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -154,9 +154,13 @@ abstract class CommonInvoice extends CommonObject */ public $sumcreditnote_multicurrency; /** - * @var string + * @var int|float|string May be used for status */ public $remaintopay; + /** + * @var int May be used for status + */ + public $nbofopendirectdebitorcredittransfer; /** * @var int @@ -486,6 +490,55 @@ abstract class CommonInvoice extends CommonObject } } + /** + * Return list of open direct debit or credit transfer + * + * @param string $type 'bank-transfer' or 'direct-debit' + * @return array Array with list of payments + */ + public function getListOfOpenDirectDebitOrCreditTransfer($type) + { + $listofopendirectdebitorcredittransfer = array(); + + // TODO Add a cache to store array of open requests for each invoice ID + + $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande, pfd.date_traite as date_traite, pfd.amount"; + $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; + if ($type == 'bank-transfer') { + $sql .= " WHERE fk_facture_fourn = ".((int) $this->id); + } else { + $sql .= " WHERE fk_facture = ".((int) $this->id); + } + $sql .= " AND pfd.traite = 0"; + $sql .= " AND pfd.type = 'ban'"; + $sql .= " ORDER BY pfd.date_demande DESC"; + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + if ($obj) { + $listofopendirectdebitorcredittransfer[] = array( + 'id' => $obj->rowid, + 'invoiceid' => (int) $this->id, + 'date' => $this->db->jdate($obj->date_demande), + 'amount' => $obj->amount + ); + } + + $i++; + } + } else { + $this->error = $this->db->lasterror(); + } + + $this->nbofopendirectdebitorcredittransfer = $num; + + return $listofopendirectdebitorcredittransfer; + } + /** * Return list of payments * @@ -849,7 +902,7 @@ abstract class CommonInvoice extends CommonObject */ public function getLibStatut($mode = 0, $alreadypaid = -1) { - return $this->LibStatut($this->paye, $this->status, $mode, $alreadypaid, $this->type); + return $this->LibStatut($this->paye, $this->status, $mode, $alreadypaid, $this->type, $this->nbofopendirectdebitorcredittransfer); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -861,9 +914,10 @@ abstract class CommonInvoice extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, -1 otherwise) * @param int $type Type invoice. If -1, we use $this->type + * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer * @return string Label of status */ - public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1) + public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1, $nbofopendirectdebitorcredittransfer = 0) { // phpcs:enable global $langs, $hookmanager; @@ -892,7 +946,7 @@ abstract class CommonInvoice extends CommonObject $labelStatus = $langs->transnoentitiesnoconv('BillStatusClosedPaidPartially'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusClosedPaidPartially'); $statusType = 'status9'; - } elseif ($alreadypaid == 0) { + } elseif ($alreadypaid == 0 && $nbofopendirectdebitorcredittransfer == 0) { $labelStatus = $langs->transnoentitiesnoconv('BillStatusNotPaid'); $labelStatusShort = $langs->transnoentitiesnoconv('Bill'.$prefix.'StatusNotPaid'); $statusType = 'status1'; diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index 202c88c7d18..2987021be4e 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -29,7 +29,6 @@ FillFieldFirst=Fill employee field first UpdateAmountWithLastSalary=Set amount of last salary MakeTransferRequest=Make transfer request VirementOrder=Credit transfer request -BankTransferAmount=Amount of credit transfer WithdrawalReceipt=Credit transfer order OrderWaiting=Pending order FillEndOfMonth=Fill with end of month From 56571b09ecf79910ba3006b0116cf493490800e0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 16:59:16 +0100 Subject: [PATCH 09/37] Debug v21 --- htdocs/holiday/card_group.php | 2 +- htdocs/salaries/card.php | 9 ++++++--- htdocs/salaries/virement_request.php | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/holiday/card_group.php b/htdocs/holiday/card_group.php index 10b0d02d497..34b5f24109e 100644 --- a/htdocs/holiday/card_group.php +++ b/htdocs/holiday/card_group.php @@ -521,7 +521,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { $sql = 'SELECT u.rowid, u.lastname, u.firstname, u.login, u.photo FROM '.MAIN_DB_PREFIX.'user as u'; $sql .= ' WHERE 1 = 1'; - $sql .= !empty($morefilter) ? $morefilter : ''; + $sql .= empty($morefilter) ? '' : $morefilter; $userlist = array(); $userstatic = new User($db); diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index f395d0011d6..9bbf3f4b97c 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -467,6 +467,8 @@ if ($action == "update_extras" && $permissiontoadd) { $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha'); } + $triggermodname = 'SALARY_MODIFY'; + $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); if ($result > 0) { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); @@ -477,6 +479,7 @@ if ($action == "update_extras" && $permissiontoadd) { } } + /* * View */ @@ -577,7 +580,7 @@ if ($action == 'create' && $permissiontoadd) { print '
'; print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).''; $noactive = 0; // We keep active and unactive users - print img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers(GETPOSTINT('fk_user'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); + print img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers(GETPOSTINT('fk_user'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'employee:=:1', 0, '', 'maxwidth300', $noactive); print '
'; if ($action == 'edit') { - print '"; } else { print ""; - print ''; } diff --git a/htdocs/salaries/virement_request.php b/htdocs/salaries/virement_request.php index 71adbc34e3b..de001535e3f 100644 --- a/htdocs/salaries/virement_request.php +++ b/htdocs/salaries/virement_request.php @@ -276,12 +276,12 @@ print '
'; print '
'.$langs->trans("DateStartPeriod").""; + print '
'.$langs->trans("DateStartPeriod").""; print $form->selectDate($object->datesp, 'datesp', 0, 0, 0, 'datesp', 1); print "
' . $langs->trans("DateStartPeriod") . ''; + print '' . $langs->trans("DateStartPeriod") . ''; print dol_print_date($object->datesp, 'day'); print '
'; if ($action == 'edit') { - print '"; } else { print ""; - print ''; } From 08c676731271b9f39ce719ff5ca0491ac6b46ee7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 17:57:30 +0100 Subject: [PATCH 10/37] Fix the fetch of ModelMail. --- htdocs/core/class/html.formmail.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index c9475f163ab..7eabcd349ff 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -2436,7 +2436,10 @@ class ModelMail extends CommonObject */ public function fetch($id, $ref = null, $noextrafields = 0, $nolines = 0) { - $result = $this->fetchCommon($id, $ref, '', $noextrafields); + // The table llx_c_mail_template has no field ref. The field ref was named "label" instead. So we change the call to fetchCommon. + //$result = $this->fetchCommon($id, $ref, '', $noextrafields); + $result = $this->fetchCommon($id, '', "AND t.label = '".$this->db->escape($ref)."'", $noextrafields); + if ($result > 0 && !empty($this->table_element_line) && empty($nolines)) { $this->fetchLines($noextrafields); } From 42137dd55deec02c4f6b39c661d3b2f4562ae493 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 17:59:20 +0100 Subject: [PATCH 11/37] Code comment --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 7eabcd349ff..22238016c61 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -2436,7 +2436,7 @@ class ModelMail extends CommonObject */ public function fetch($id, $ref = null, $noextrafields = 0, $nolines = 0) { - // The table llx_c_mail_template has no field ref. The field ref was named "label" instead. So we change the call to fetchCommon. + // The table llx_c_email_templates has no field ref. The field ref was named "label" instead. So we change the call to fetchCommon. //$result = $this->fetchCommon($id, $ref, '', $noextrafields); $result = $this->fetchCommon($id, '', "AND t.label = '".$this->db->escape($ref)."'", $noextrafields); From 95032a8d1d908a64c5be7ede233a03af610904ab Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 18:13:30 +0100 Subject: [PATCH 12/37] Fix syntax error --- htdocs/core/class/html.formmail.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 22238016c61..3f09d2816f7 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -2438,7 +2438,7 @@ class ModelMail extends CommonObject { // The table llx_c_email_templates has no field ref. The field ref was named "label" instead. So we change the call to fetchCommon. //$result = $this->fetchCommon($id, $ref, '', $noextrafields); - $result = $this->fetchCommon($id, '', "AND t.label = '".$this->db->escape($ref)."'", $noextrafields); + $result = $this->fetchCommon($id, '', " AND t.label = '".$this->db->escape($ref)."'", $noextrafields); if ($result > 0 && !empty($this->table_element_line) && empty($nolines)) { $this->fetchLines($noextrafields); From 54fea8510524331c12a670dedee8fa0fdfb6e141 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 18:25:05 +0100 Subject: [PATCH 13/37] Fix bad balance of transaction --- htdocs/website/class/website.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index c8c6c71ee3e..4e5d9d8e8f9 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1820,6 +1820,8 @@ class Website extends CommonObject */ public function setTemplateName($name_template) { + $this->db->begin(); + $sql = "UPDATE ".$this->db->prefix()."website SET"; $sql .= " name_template = '".$this->db->escape($name_template)."'"; $sql .= " WHERE rowid = ".(int) $this->id; From 0fda35a920b13e329001dd03f1e35f8388b21e13 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 18:38:42 +0100 Subject: [PATCH 14/37] Debug v21 --- htdocs/admin/website.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 52275a3f80b..8979ee62e67 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -456,6 +456,8 @@ if ($id) { print ''; print ''; + + print '
'; print '
'.$langs->trans("DateStartPeriod").""; + print '
'.$langs->trans("DateStartPeriod").""; print $form->selectDate($object->datesp, 'datesp', 0, 0, 0, 'datesp', 1); print "
' . $langs->trans("DateStartPeriod") . ''; + print '' . $langs->trans("DateStartPeriod") . ''; print dol_print_date($object->datesp, 'day'); print '
'; // Form to add a new line @@ -471,12 +473,12 @@ if ($id) { // dans les dictionnaires de donnees $valuetoshow = ucfirst($fieldlist[$field]); // By default $valuetoshow = $langs->trans($valuetoshow); // try to translate - $align = ''; + $css = ''; if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); } if ($valuetoshow != '') { - print '
'; + print ''; if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; } elseif (!empty($tabhelp[$id][$value])) { @@ -523,6 +525,8 @@ if ($id) { } print '
'; + print ''; + print '
'; @@ -631,15 +635,24 @@ if ($id) { foreach ($fieldlist as $field => $value) { $showfield = 1; $fieldname = $fieldlist[$field]; - $align = "left"; + $css = ""; + if ($fieldlist[$field] == 'description') { + $css .= ' tdoverflowmax300'; + } if (in_array($fieldname, array('pageviews_total', 'pageviews_previous_month'))) { - $align = 'right'; + $css = 'right'; + } + if ($fieldlist[$field] == 'date_creation') { + $css .= ' nowraponall'; + } + if ($fieldlist[$field] == 'lastaccess') { + $css .= ' nowraponall'; } $valuetoshow = $obj->$fieldname; // Show value for field if ($showfield) { - print ''.$valuetoshow.''; + print ''.$valuetoshow.''; } } } From 8a80ee0a5be226f4fcdb958aab590319bdb5f563 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 18:40:02 +0100 Subject: [PATCH 15/37] Debug v21 --- htdocs/langs/en_US/website.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index fc793f5cf2a..629d5a114cf 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -88,7 +88,7 @@ WebsiteAccount=Website account WebsiteAccounts=Website accounts AddWebsiteAccount=Create web site account BackToListForThirdParty=Back to list for the third parties -DisableSiteFirst=Disable website first +DisableSiteFirst=Put website offline first MyContainerTitle=My web site title AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists) SorryWebsiteIsCurrentlyOffLine=Sorry, this website is currently off line. Please comme back later... From 2eaa7a27a962152782e81b99dc69b86c77de7e31 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 19:14:44 +0100 Subject: [PATCH 16/37] Debug v21 --- htdocs/website/class/website.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 4e5d9d8e8f9..7ebe585c1f9 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1245,15 +1245,17 @@ class Website extends CommonObject dol_mkdir($conf->website->dir_temp.'/'.$object->ref); $filename = basename($pathtofile); + $reg = array(); if (!preg_match('/^website_(.*)-(.*)$/', $filename, $reg)) { $this->errors[] = 'Bad format for filename '.$filename.'. Must be website_XXX-VERSION.'; return -3; } + // Uncompress the zip $result = dol_uncompress($pathtofile, $conf->website->dir_temp.'/'.$object->ref); if (!empty($result['error'])) { - $this->errors[] = 'Failed to unzip file '.$pathtofile.'.'; + $this->errors[] = 'Failed to unzip file '.$pathtofile; return -4; } From e556dfe60484f350462d2fc6b8b6fd14e89a1969 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 20:49:50 +0100 Subject: [PATCH 17/37] Debug v21 --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 81653feaa85..3e9aff3b1f1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -689,7 +689,7 @@ class Form $paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag } if ($tooltipon == 1 || $tooltipon == 3) { - $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; + $paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ($tag != 'td' ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" '; if ($tooltiptrigger == '') { $paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip } else { From 7b69b6c17b276058f492eab46cd026c8cb1bdf15 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Mon, 30 Dec 2024 21:05:21 +0100 Subject: [PATCH 18/37] FIX we should not allow to validate negative invoice if invoice is not a credit note. --- htdocs/compta/facture/card.php | 5 +++- htdocs/fourn/facture/card.php | 44 ++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8352fac6d48..9f66c23211d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2166,6 +2166,7 @@ if (empty($reshook)) { $price_ht_devise = ''; $price_ttc = ''; $price_ttc_devise = ''; + $price_min = ''; $price_min_ttc = ''; @@ -5837,7 +5838,9 @@ if ($action == 'create') { } // Validate - if ($object->status == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (getDolGlobalString('FACTURE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { + if ($object->status == Facture::STATUS_DRAFT && count($object->lines) > 0 + && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (getDolGlobalString('FACTURE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) + || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if ($usercanvalidate) { unset($params['attr']['title']); print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 1506bc57e17..873a4a7b9a2 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1591,12 +1591,26 @@ if (empty($reshook)) { $idprod = GETPOSTINT('idprod'); } + $price_ht = ''; + $price_ht_devise = ''; + $price_ttc = ''; + $price_ttc_devise = ''; + + if (GETPOST('price_ht') !== '') { + $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); + } + if (GETPOST('multicurrency_price_ht') !== '') { + $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); + } + if (GETPOST('price_ttc') !== '') { + $price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2); + } + if (GETPOST('multicurrency_price_ttc') !== '') { + $price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2); + } + $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)' - $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); - $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2); - $price_ttc = price2num(GETPOST('price_ttc'), 'MU', 2); - $price_ttc_devise = price2num(GETPOST('multicurrency_price_ttc'), 'CU', 2); $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0); @@ -1623,6 +1637,24 @@ if (empty($reshook)) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error++; } + + if ($prod_entry_mode == 'free' && (!GETPOST('idprodfournprice') || GETPOST('idprodfournprice') == '-1') && (($price_ht < 0 && !getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE_LINES')) || $price_ht == '') && (($price_ht_devise < 0 && !getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE_LINES')) || $price_ht_devise == '') && $price_ttc === '' && $price_ttc_devise === '' && $object->type != FactureFournisseur::TYPE_CREDIT_NOTE) { // Unit price can be 0 but not '' + if (($price_ht < 0 || $price_ttc < 0) && !getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE_LINES')) { + $langs->load("errors"); + if ($object->type == $object::TYPE_DEPOSIT) { + // Using negative lines on deposit lead to headach and blocking problems when you want to consume them. + setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors'); + } else { + setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors'); + } + $error++; + } else { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); + $error++; + } + } + + if ($prod_entry_mode == 'free' && GETPOST('price_ht') === '' && GETPOST('price_ttc') === '' && $price_ht_devise === '') { // Unit price can be 0 but not '' setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice')), null, 'errors'); $error++; @@ -4034,7 +4066,9 @@ if ($action == 'create') { } // Validate - if ($action != 'confirm_edit' && $object->status == FactureFournisseur::STATUS_DRAFT) { + if ($action != 'confirm_edit' && $object->status == FactureFournisseur::STATUS_DRAFT && count($object->lines) > 0 + && ((($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_PROFORMA || $object->type == FactureFournisseur::TYPE_SITUATION) && (getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) + || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if (count($object->lines)) { if ($usercanvalidate) { print ' Date: Mon, 30 Dec 2024 22:23:37 +0100 Subject: [PATCH 19/37] Fix signature --- htdocs/compta/facture/class/facture-rec.class.php | 3 ++- htdocs/core/class/commoninvoice.class.php | 2 -- htdocs/fourn/class/fournisseur.facture-rec.class.php | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f011ecc05ab..2d4481daa54 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1604,9 +1604,10 @@ class FactureRec extends CommonInvoice * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto * @param integer $alreadypaid Not used for recurring invoices * @param int $type Type invoice + * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer * @return string Label of status */ - public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0) + public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0, $nbofopendirectdebitorcredittransfer = 0) { // phpcs:enable global $langs; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index c54b9d149a4..c2cb6cbf036 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -984,8 +984,6 @@ abstract class CommonInvoice extends CommonObject return $hookmanager->resPrint; } - - return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode); } diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 0550fe43cb8..15ed1c9bb4c 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1600,9 +1600,10 @@ class FactureFournisseurRec extends CommonInvoice * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto * @param integer $alreadypaid Not used for recurring invoices * @param int $type Type invoice + * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer * @return string Label of status */ - public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0) + public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0, $nbofopendirectdebitorcredittransfer = 0) { // phpcs:enable global $langs; From b579ff9cd81f0b140fa68f8c3ee2a03146738e7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 31 Dec 2024 02:45:40 +0100 Subject: [PATCH 20/37] Debug v21 --- htdocs/societe/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 70fe8a2f34f..ab2571bfcfb 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -420,7 +420,7 @@ if (empty($reshook)) { $searchCategorySupplierOperator = 0; $searchCategoryCustomerList = array(); $searchCategorySupplierList = array(); - $search_sale = ''; + $search_sale = array(); $search_barcode = ""; $search_customer_code = ''; $search_supplier_code = ''; @@ -617,7 +617,7 @@ if (!$user->hasRight('fournisseur', 'lire')) { // Force the sales representative if they don't have permissions if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { - $search_sale = $user->id; + $search_sale = array($user->id); } // Search on sale representative if (!empty($search_sale) && $search_sale != '-1') { From ed1b28ad2146642834b19b4fa446109787b2cee7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 31 Dec 2024 13:19:24 +0100 Subject: [PATCH 21/37] Code comment --- htdocs/website/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 46d428bac93..ce9fa0070af 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2498,7 +2498,8 @@ if ($action == 'overwritesite' && $user->hasRight('website', 'export')) { } // Regenerate site if ($action == 'regeneratesite' && $usercanedit) { - // Check symlink to medias and restore it if ko. Recreate also dir of website if not found. + // Check symlink documents/website/mywebsite/medias to point to documents/medias and restore it if ko. + // Recreate also dir of website if not found. $pathtomedias = DOL_DATA_ROOT.'/medias'; $pathtomediasinwebsite = $pathofwebsite.'/medias'; if (!is_link(dol_osencode($pathtomediasinwebsite))) { From f67fad110593960ed8a0f1be58e5543e1ffd94a7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 31 Dec 2024 14:04:14 +0100 Subject: [PATCH 22/37] Debug v21 --- htdocs/core/lib/functions.lib.php | 9 ++++++++- htdocs/website/class/website.class.php | 17 ++++++++++++++++- htdocs/website/index.php | 21 ++++++++++++++++----- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 933a07f6d22..b2fed05b758 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1672,7 +1672,12 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1) // Char '>' '<' '|' '$' and ';' are special chars for shells. // Chars '--' can be used into filename to inject special parameters like --use-compress-program to make command with file as parameter making remote execution of command $filesystem_forbidden_chars = array('<', '>', '?', '*', '|', '"', '°', '$', ';', '`'); - $tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars); + + $tmp = $str; + if ($unaccent) { + $tmp = dol_string_unaccent($tmp); + } + $tmp = dol_string_nospecial($tmp, $newstr, $filesystem_forbidden_chars); $tmp = preg_replace('/\-\-+/', '_', $tmp); $tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp); $tmp = preg_replace('/\s+\-$/', '', $tmp); @@ -7948,6 +7953,8 @@ function dol_mkdir($dir, $dataroot = '', $newmask = '') dol_syslog("functions.lib::dol_mkdir: dir=".$dir, LOG_INFO); + $dir = dol_sanitizePathName($dir, '_', 0); + $dir_osencoded = dol_osencode($dir); if (@is_dir($dir_osencoded)) { return 0; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 7ebe585c1f9..225a8433829 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -250,10 +250,25 @@ class Website extends CommonObject } } - // Create subdirectory for images and js + // Create subdirectory for images and js into documents/medias directory dol_mkdir($conf->medias->multidir_output[$conf->entity].'/image/'.$this->ref, DOL_DATA_ROOT); dol_mkdir($conf->medias->multidir_output[$conf->entity].'/js/'.$this->ref, DOL_DATA_ROOT); + $pathofwebsite = $conf->website->dir_output.'/'.$this->ref; + + // Check symlink documents/website/mywebsite/medias to point to documents/medias and restore it if ko. + // Recreate also dir of website if not found. + $pathtomedias = DOL_DATA_ROOT.'/medias'; + $pathtomediasinwebsite = $pathofwebsite.'/medias'; + if (!is_link(dol_osencode($pathtomediasinwebsite))) { + dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite); + dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure that the directory for website exists + $result = symlink($pathtomedias, $pathtomediasinwebsite); + if (!$result) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailedToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); + } + } // Uncomment this and change WEBSITE to your own tag if you // want this action to call a trigger. // if (!$notrigger) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ce9fa0070af..3147fc4b6bd 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1325,13 +1325,18 @@ if ($action == 'addcontainer' && $usercanedit) { // To generate the CSS, robot and htmlheader file. - // Check symlink to medias and restore it if ko + // Check symlink documents/website/mywebsite/medias to point to documents/medias and restore it if ko. + // Recreate also dir of website if not found. $pathtomedias = DOL_DATA_ROOT.'/medias'; $pathtomediasinwebsite = $pathofwebsite.'/medias'; if (!is_link(dol_osencode($pathtomediasinwebsite))) { dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite); - dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists + dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure that the directory for website exists $result = symlink($pathtomedias, $pathtomediasinwebsite); + if (!$result) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailedToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); + } } // Now generate the master.inc.php page if it does not exists yet @@ -2296,13 +2301,18 @@ if ((($action == 'updatesource' || $action == 'updatecontent' || $action == 'con $res = 0; if (!$error) { - // Check symlink to medias and restore it if ko + // Check symlink documents/website/mywebsite/medias to point to documents/medias and restore it if ko. + // Recreate also dir of website if not found. $pathtomedias = DOL_DATA_ROOT.'/medias'; $pathtomediasinwebsite = $pathofwebsite.'/medias'; if (!is_link(dol_osencode($pathtomediasinwebsite))) { dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite); - dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists + dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure that the directory for website exists $result = symlink($pathtomedias, $pathtomediasinwebsite); + if (!$result) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailedToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); + } } /*if (GETPOST('savevirtualhost') && $object->virtualhost != GETPOST('previewsite')) @@ -2537,7 +2547,8 @@ if ($action == 'importsiteconfirm' && $usercanedit) { $action = 'importsite'; } else { if (!empty($_FILES) || GETPOSTISSET('templateuserfile')) { - // Check symlink to medias and restore it if ko. Recreate also dir of website if not found. + // Check symlink documents/website/mywebsite/medias to point to documents/medias and restore it if ko. + // Recreate also dir of website if not found. $pathtomedias = DOL_DATA_ROOT.'/medias'; $pathtomediasinwebsite = $pathofwebsite.'/medias'; if (!is_link(dol_osencode($pathtomediasinwebsite))) { From 5af06d6614bc3b9a9ab53f3ccea1ce766a23afa1 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 31 Dec 2024 14:56:18 +0100 Subject: [PATCH 23/37] Debug v21 --- htdocs/website/class/website.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 225a8433829..2f59aa95bcb 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -266,13 +266,12 @@ class Website extends CommonObject $result = symlink($pathtomedias, $pathtomediasinwebsite); if (!$result) { $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailedToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); + //setEventMessages($langs->trans("ErrorFailedToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); + $error++; } } - // Uncomment this and change WEBSITE to your own tag if you - // want this action to call a trigger. - // if (!$notrigger) { + // if (!$notrigger) { // // Call triggers // $result = $this->call_trigger('WEBSITE_CREATE',$user); // if ($result < 0) $error++; From d417eb2fcbd36ba7cbde8820c552bda7c96f0ad8 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 17:34:25 +0100 Subject: [PATCH 24/37] Qual: Avoid suspicious order with better arg name --- htdocs/core/class/html.form.class.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3e9aff3b1f1..a23db2adf8a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -737,17 +737,17 @@ class Form * Show a text with a picto and a tooltip on picto * * @param string $text Text to show - * @param string $htmltext Content of tooltip - * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon + * @param string $htmltooltip Content of tooltip + * @param int<-1,1> $direction 1=Icon is after text, -1=Icon is before text, 0=no icon * @param string $type Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none' * @param string $extracss Add a CSS style to td, div or span tag - * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span + * @param int<0,1> $noencodehtmltext Do not encode into html entity the htmltext + * @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 $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable') - * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) + * @param int<0,1> $forcenowrap Force no wrap between text and picto (works with notabs=2 only) * @return string HTML code of text, picto, tooltip */ - public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = 'valignmiddle', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0) + public function textwithpicto($text, $htmltooltip, $direction = 1, $type = 'help', $extracss = 'valignmiddle', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0) { global $conf, $langs; @@ -773,8 +773,8 @@ class Form if ($type == 'info' || $type == 'infoclickable' || $type == 'help' || $type == 'helpclickable') { return $text; } else { - $alt = $htmltext; - $htmltext = ''; + $alt = $htmltooltip; + $htmltooltip = ''; } } @@ -810,7 +810,7 @@ class Form $img = img_picto($alt, $type); // $type can be an image path } - return $this->textwithtooltip($text, $htmltext, ((($tooltiptrigger && !$img) || strpos($type, 'clickable')) ? 3 : 2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap); + return $this->textwithtooltip($text, $htmltooltip, ((($tooltiptrigger && !$img) || strpos($type, 'clickable')) ? 3 : 2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap); } /** @@ -5275,7 +5275,7 @@ class Form $sql = "SELECT rowid, label, bank, status, iban_prefix, bic"; $sql .= " FROM " . $this->db->prefix() . "societe_rib"; - $sql.= " WHERE type = 'ban'"; + $sql .= " WHERE type = 'ban'"; if ($filtre) { // TODO Support USF $sql .= " AND " . $filtre; } @@ -5469,7 +5469,9 @@ class Form $result = $bankstatic->fetch($selected); if ($result) { print $bankstatic->label; - if ($showibanbic) print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')'; + if ($showibanbic) { + print ' (' . $bankstatic->iban . '/' .$bankstatic->bic. ')'; + } } } else { print " "; @@ -8769,7 +8771,7 @@ class Form } $splittedfieldstoshow = explode(',', $fieldstoshow); foreach ($splittedfieldstoshow as &$field2) { - if (is_numeric($pos=strpos($field2, ' '))) { + if (is_numeric($pos = strpos($field2, ' '))) { $field2 = substr($field2, 0, $pos); } } From afc9b928af8a9479218e5c62bf5655f8734a1673 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 17:51:53 +0100 Subject: [PATCH 25/37] Match LibStatut function signature --- .../compta/facture/class/facture-rec.class.php | 17 +++++++++-------- htdocs/core/class/commoninvoice.class.php | 14 +++++++------- .../class/fournisseur.facture-rec.class.php | 14 +++++++------- .../webportal/class/webportalinvoice.class.php | 15 ++++++++------- 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2d4481daa54..3968e297ec3 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -571,7 +571,8 @@ class FactureRec extends CommonInvoice $sql .= " localtax2 = ".((float) $this->total_localtax2).","; $sql .= " total_ht = ".((float) $this->total_ht).","; $sql .= " total_ttc = ".((float) $this->total_ttc).","; - $sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL');; + $sql .= " fk_societe_rib = ".(!empty($this->fk_societe_rib) ? ((int) $this->fk_societe_rib) : 'NULL'); + ; // TODO Add missing fields $sql .= " WHERE rowid = ".((int) $this->id); @@ -1599,13 +1600,13 @@ class FactureRec extends CommonInvoice /** * Return label of a status * - * @param int $recur Is it a recurring invoice ? - * @param int $status Id status (suspended or not) - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto - * @param integer $alreadypaid Not used for recurring invoices - * @param int $type Type invoice - * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer - * @return string Label of status + * @param int $recur Is it a recurring invoice ? + * @param int $status Id status (suspended or not) + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto + * @param int $alreadypaid Not used for recurring invoices + * @param int $type Type invoice + * @param int $nbofopendirectdebitorcredittransfer @unused-param Nb of open direct debit or credit transfer + * @return string Label of status */ public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0, $nbofopendirectdebitorcredittransfer = 0) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index c2cb6cbf036..ed6066233af 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -909,13 +909,13 @@ abstract class CommonInvoice extends CommonObject /** * Return label of a status * - * @param int $paye Status field paye - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto - * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, -1 otherwise) - * @param int $type Type invoice. If -1, we use $this->type - * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer - * @return string Label of status + * @param int $paye Status field paye (or $recur) + * @param int $status Id status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto + * @param int $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommend to put here amount paid if you have it, -1 otherwise) + * @param int $type Type invoice. If -1, we use $this->type + * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer + * @return string Label of status */ public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1, $nbofopendirectdebitorcredittransfer = 0) { diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 15ed1c9bb4c..9853bffe6c5 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1595,13 +1595,13 @@ class FactureFournisseurRec extends CommonInvoice /** * Return label of a status * - * @param int $recur Is it a recurring invoice ? - * @param int $status Id status (suspended or not) - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto - * @param integer $alreadypaid Not used for recurring invoices - * @param int $type Type invoice - * @param int $nbofopendirectdebitorcredittransfer Nb of open direct debit or credit transfer - * @return string Label of status + * @param int $recur Is it a recurring invoice ? + * @param int $status Id status (suspended or not) + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto + * @param int $alreadypaid Not used for recurring invoices + * @param int $type Type invoice + * @param int $nbofopendirectdebitorcredittransfer @unused-param Nb of open direct debit or credit transfer + * @return string Label of status */ public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0, $nbofopendirectdebitorcredittransfer = 0) { diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index d8760f38be3..c317c412541 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -331,14 +331,15 @@ class WebPortalInvoice extends Facture /** * Return label of a status * - * @param int $paye Status field paye - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto - * @param int $alreadypaid 0=No payment already done, >0=Some payments were already done - * @param int $type Type invoice. If -1, we use $this->type - * @return string Label of status + * @param int $paye Status field paye + * @param int $status Id status + * @param int<0,6> $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=long label + picto + * @param int $alreadypaid 0=No payment already done, >0=Some payments were already done + * @param int $type Type invoice. If -1, we use $this->type + * @param int $arg6 @unused-param Unused arg, keep function compatible with parent class + * @return string Label of status */ - public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1) + public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1, $arg6 = 0) { // phpcs:enable return $this->getInvoiceStatic()->LibStatut($paye, $status, $mode, $alreadypaid, $type); From 12c6937d0f6dd2605017d693176c784d0804df53 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 17:54:31 +0100 Subject: [PATCH 26/37] Initialize variable --- htdocs/core/class/commoninvoice.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index ed6066233af..8d746df687b 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -514,6 +514,7 @@ abstract class CommonInvoice extends CommonObject $sql .= " ORDER BY pfd.date_demande DESC"; $resql = $this->db->query($sql); + $num = 0; if ($resql) { $num = $this->db->num_rows($resql); $i = 0; From 47849c2dab3d96e2dc1a807b651399fa5bc9bf59 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 18:17:24 +0100 Subject: [PATCH 27/37] Comment invalid and unused code to avoid phan notices --- htdocs/projet/activity/index.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 695aa9cff00..e07848404a7 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -518,6 +518,7 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_SHO $taskstatic->dateo = $db->jdate($obj->date_start); $taskstatic->datee = $db->jdate($obj->date_end); + /* username and userstatic not used + not defined $username = ''; if ($obj->userid && $userstatic->id != $obj->userid) { // We have a user and it is not last loaded user $result = $userstatic->fetch($obj->userid); @@ -528,6 +529,7 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_SHO if ($userstatic->id) { $username = $userstatic->getNomUrl(0, 0); } + */ print ''; //print ''.$username.''; From 3e85d35cad9885a8766a36f081dfcf2e36c6ffc1 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 18:19:47 +0100 Subject: [PATCH 28/37] Comment useless if, correct arguments to match type --- htdocs/mrp/mo_production.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 13f5aca1700..bf68267ee2b 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -944,24 +944,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Product print ''; - print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth150'); + print $form->select_produits(0, 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth150'); print ''; // Qty print ''; // Unit print ''; - if (getDolGlobalInt('PRODUCT_USE_UNITS')) { - //... - } + //if (getDolGlobalInt('PRODUCT_USE_UNITS')) { + //... + //} print ''; // Cost price if ($permissiontoupdatecost && getDolGlobalString('MRP_SHOW_COST_FOR_CONSUMPTION')) { print ''; } - $colspan="3"; + $colspan = 3; if (isModEnabled('stock')) { - $colspan++;; + $colspan++; } if (isModEnabled('productbatch')) { $colspan++; @@ -1598,7 +1598,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Product print ''; - print $form->select_produits('', 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth300'); + print $form->select_produits(0, 'productidtoadd', '', 0, 0, -1, 2, '', 1, array(), 0, '1', 0, 'maxwidth300'); print ''; // Qty print ''; From 6127e3c3b1794a4c44afa4202f8439a2712c48ef Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 18:24:06 +0100 Subject: [PATCH 29/37] Rename var to avoid suspicious order message, add type ints --- htdocs/projet/index.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 8ca6b536c11..905deae6c5b 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -138,21 +139,37 @@ $morehtml .= 'trans("MyProjectsDesc"); + $htmltooltip = $langs->trans("MyProjectsDesc"); } else { if ($user->hasRight('projet', 'all', 'lire') && !$socid) { - $tooltiphelp = $langs->trans("ProjectsDesc"); + $htmltooltip = $langs->trans("ProjectsDesc"); } else { - $tooltiphelp = $langs->trans("ProjectsPublicDesc"); + $htmltooltip = $langs->trans("ProjectsPublicDesc"); } } -print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'project', 0, $morehtml); +print_barre_liste($form->textwithpicto($title, $htmltooltip), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'project', 0, $morehtml); // Get list of ponderated percent and colors for each status include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; -$listofoppstatus = array(); $listofopplabel = array(); $listofoppcode = array(); $colorseries = array(); +// Available from theme_vars: +' +@phan-var-force string $badgeStatus0 +@phan-var-force string $badgeStatus1 +@phan-var-force string $badgeStatus2 +@phan-var-force string $badgeStatus3 +@phan-var-force string $badgeStatus4 +@phan-var-force string $badgeStatus5 +@phan-var-force string $badgeStatus6 +@phan-var-force string $badgeStatus7 +@phan-var-force string $badgeStatus8 +@phan-var-force string $badgeStatus9 +'; +$listofoppstatus = array(); +$listofopplabel = array(); +$listofoppcode = array(); +$colorseries = array(); $sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label"; $sql .= " FROM ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= " WHERE active=1"; From 6d2d34cff414a8250d55fd08dfdbc269be96f56a Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 18:27:44 +0100 Subject: [PATCH 30/37] Fix unset variable, and fix suspicious arg order by renaming var --- htdocs/projet/tasks/list.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index a358aec466e..056860cd47e 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -309,7 +309,8 @@ if ($id) { $projectstatic->fetch_thirdparty(); } -// Get list of project id allowed to user (in a string list separated by coma) +$projectsListId = '0'; +// Get list of project id allowed to user (in a comma separated string list) if (!$user->hasRight('projet', 'all', 'lire')) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); } @@ -756,18 +757,18 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('NewTask'), '', 'fa fa-plus-ci // Show description of content -$texthelp = ''; +$htmltooltip = ''; if ($search_task_user == $user->id) { - $texthelp .= $langs->trans("MyTasksDesc"); + $htmltooltip .= $langs->trans("MyTasksDesc"); } else { if ($user->hasRight('projet', 'all', 'lire') && !$socid) { - $texthelp .= $langs->trans("TasksOnProjectsDesc"); + $htmltooltip .= $langs->trans("TasksOnProjectsDesc"); } else { - $texthelp .= $langs->trans("TasksOnProjectsPublicDesc"); + $htmltooltip .= $langs->trans("TasksOnProjectsPublicDesc"); } } -print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'projecttask', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($form->textwithpicto($title, $htmltooltip), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'projecttask', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "task"; From dee6a8853ba72fadcd5104df92a7d688f127e933 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 20:06:51 +0100 Subject: [PATCH 31/37] Fix new suspiciousparamorder and other notices --- htdocs/projet/activity/index.php | 8 ++++---- htdocs/projet/list.php | 25 ++++++++++++++----------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index e07848404a7..527cac25891 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -132,16 +132,16 @@ $morehtml .= ajax_combobox("search_project_user", array(), 0, 0, 'resolve', '-1' $morehtml .= ''; if ($mine) { - $tooltiphelp = $langs->trans("MyTasksDesc"); + $htmltooltip = $langs->trans("MyTasksDesc"); } else { if ($user->hasRight('projet', 'all', 'lire') && !$socid) { - $tooltiphelp = $langs->trans("TasksDesc"); + $htmltooltip = $langs->trans("TasksDesc"); } else { - $tooltiphelp = $langs->trans("TasksPublicDesc"); + $htmltooltip = $langs->trans("TasksPublicDesc"); } } -print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'projecttask', 0, $morehtml); +print_barre_liste($form->textwithpicto($title, $htmltooltip), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'projecttask', 0, $morehtml); print '
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 77eda021f11..c606b0d14f1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -137,6 +137,7 @@ if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT'); } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); +$search_omitChildren = 0; if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) { $search_omitChildren = GETPOST('search_omitChildren', 'alpha') == 'on' ? 1 : 0; } @@ -264,10 +265,10 @@ $arrayfields['c.assigned'] = array('label' => "AssignedTo", 'checked' => 1, 'pos $arrayfields['opp_weighted_amount'] = array('label' => 'OpportunityWeightedAmountShort', 'checked' => 0, 'enabled' => (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES') ? 0 : 1), 'position' => 106); $arrayfields['u.login'] = array('label' => "Author", 'checked' => -1, 'position' => 165); // Force some fields according to search_usage filter... -if (GETPOST('search_usage_opportunity')) { - //$arrayfields['p.usage_opportunity']['visible'] = 1; // Not require, filter on search_opp_status is enough - //$arrayfields['p.usage_opportunity']['checked'] = 1; // Not require, filter on search_opp_status is enough -} +//if (GETPOST('search_usage_opportunity')) { +//$arrayfields['p.usage_opportunity']['visible'] = 1; // Not required, filter on search_opp_status is enough +//$arrayfields['p.usage_opportunity']['checked'] = 1; // Not required, filter on search_opp_status is enough +//} if (GETPOST('search_usage_event_organization')) { $arrayfields['p.fk_opp_status']['enabled'] = 0; $arrayfields['p.opp_amount']['enabled'] = 0; @@ -293,8 +294,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); // TODO Move this into a inc file $groupbyvalues = array(); $groupofcollpasedvalues = array(); +$groupbyold = null; if ($mode == 'kanban' && $groupby) { - $groupbyold = null; $groupbyfield = preg_replace('/[a-z]\./', '', $groupby); if (!empty($object->fields[$groupbyfield]['alias'])) { $groupbyfield = $object->fields[$groupbyfield]['alias']; @@ -1165,18 +1166,18 @@ print ''; print ''; // Show description of content -$texthelp = ''; +$htmltooltip = ''; if ($search_project_user == $user->id) { - $texthelp .= $langs->trans("MyProjectsDesc"); + $htmltooltip .= $langs->trans("MyProjectsDesc"); } else { if ($user->hasRight('projet', 'all', 'lire') && !$socid) { - $texthelp .= $langs->trans("ProjectsDesc"); + $htmltooltip .= $langs->trans("ProjectsDesc"); } else { - $texthelp .= $langs->trans("ProjectsPublicDesc"); + $htmltooltip .= $langs->trans("ProjectsPublicDesc"); } } -print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($form->textwithpicto($title, $htmltooltip), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; @@ -1699,7 +1700,7 @@ while ($i < $imaxinloop) { if (get_class($c) == 'User') { $stringassignedusers .= $c->getNomUrl(-2, '', 0, 0, 24, 1, '', 'valignmiddle'.($ifisrt ? '' : ' notfirst')); } else { - $stringassignedusers .= $c->getNomUrl(-2, '', 0, '', -1, 0, 'valignmiddle'.($ifisrt ? '' : ' notfirst')); + $stringassignedusers .= $c->getNomUrl(-2, '', 0, 0, -1, 0, 'valignmiddle'.($ifisrt ? '' : ' notfirst')); } $ifisrt = 0; } @@ -1712,6 +1713,8 @@ while ($i < $imaxinloop) { print ''; } + $groupbyvalue = 'unset'; + $groupbyfield = 'unsetfield'; if (!empty($groupby)) { if (is_null($groupbyold)) { print '
'; // Start div for all kanban columns From 116c3d01ee55582bf5bc873e8391b1fb60d78452 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 22:00:30 +0100 Subject: [PATCH 32/37] Update phan baseline --- dev/tools/phan/baseline.txt | 119 ++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 67 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 6d3df7446b4..1a5fe5af39c 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,8 +9,8 @@ */ return [ // # Issue statistics: - // PhanUndeclaredProperty : 560+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 320+ occurrences + // PhanUndeclaredProperty : 570+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 310+ occurrences // PhanUndeclaredGlobalVariable : 290+ occurrences // PhanTypeMismatchArgumentProbablyReal : 230+ occurrences // PhanPluginUnknownArrayMethodReturnType : 180+ occurrences @@ -18,35 +18,35 @@ return [ // PhanPluginUnknownArrayMethodParamType : 120+ occurrences // PhanPluginUnknownPropertyType : 110+ occurrences // PhanPossiblyUndeclaredVariable : 65+ occurrences + // PhanPluginUndeclaredVariableIsset : 60+ occurrences // PhanRedefineFunction : 45+ occurrences // PhanTypeExpectedObjectPropAccess : 45+ occurrences // PhanTypeMismatchArgumentNullableInternal : 40+ occurrences - // PhanPluginSuspiciousParamOrder : 35+ occurrences // PhanTypeInvalidDimOffset : 30+ occurrences // PhanTypeMismatchDimFetch : 30+ occurrences // PhanPluginEmptyStatementIf : 15+ occurrences - // PhanPluginUnknownObjectMethodCall : 10+ occurrences + // PhanUndeclaredConstant : 15+ occurrences // PhanTypeComparisonFromArray : 10+ occurrences // PhanTypeMismatchDimFetchNullable : 10+ occurrences // PhanUndeclaredMethod : 10+ occurrences // PhanEmptyForeach : 8 occurrences + // PhanPluginUnknownObjectMethodCall : 8 occurrences // PhanPluginBothLiteralsBinaryOp : 7 occurrences // PhanPluginDuplicateExpressionBinaryOp : 7 occurrences // PhanPluginSuspiciousParamPosition : 7 occurrences // PhanTypeArraySuspiciousNull : 6 occurrences // PhanParamTooMany : 5 occurrences // PhanPossiblyNullTypeMismatchProperty : 5 occurrences + // PhanPluginDuplicateArrayKey : 4 occurrences // PhanEmptyFQSENInClasslike : 3 occurrences // PhanInvalidFQSENInClasslike : 3 occurrences // PhanTypeMismatchReturn : 3 occurrences - // PhanTypeExpectedObjectPropAccessButGotNull : 2 occurrences // PhanTypeMismatchDimAssignment : 2 occurrences // PhanTypeSuspiciousStringExpression : 2 occurrences - // PhanUndeclaredTypeParameter : 2 occurrences // PhanAccessMethodProtected : 1 occurrence // PhanPluginUnknownArrayPropertyType : 1 occurrence // PhanTypeConversionFromArray : 1 occurrence - // PhanTypeMismatchArgumentInternalProbablyReal : 1 occurrence + // PhanTypeExpectedObjectPropAccessButGotNull : 1 occurrence // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ @@ -60,7 +60,7 @@ return [ 'htdocs/api/class/api_login.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_setup.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'], - 'htdocs/asset/class/asset.class.php' => ['PhanTypeInvalidDimOffset'], + 'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanTypeInvalidDimOffset'], 'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'], 'htdocs/asset/tpl/accountancy_codes_edit.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -133,7 +133,7 @@ return [ 'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'], 'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/actions_sendmails.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/core/ajax/ajaxdirtree.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/class/canvas.class.php' => ['PhanParamTooMany', 'PhanUndeclaredMethod'], 'htdocs/core/class/ccountry.class.php' => ['PhanUndeclaredProperty'], @@ -151,7 +151,6 @@ return [ 'htdocs/core/class/html.formcompany.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formfile.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/html.formmail.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/class/ldap.class.php' => ['PhanTypeMismatchArgumentInternalProbablyReal'], 'htdocs/core/class/notify.class.php' => ['PhanUndeclaredProperty'], 'htdocs/core/class/smtps.class.php' => ['PhanTypeConversionFromArray'], 'htdocs/core/class/timespent.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], @@ -169,65 +168,49 @@ return [ 'htdocs/core/lib/project.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/lib/xcal.lib.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/asset/mod_asset_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/barcode/doc/phpbarcode.modules.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/barcode/mod_barcode_thirdparty_standard.php' => ['PhanPluginSuspiciousParamOrder'], - 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/cheque/mod_chequereceipt_thyme.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/core/modules/barcode/mod_barcode_product_standard.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/bom/mod_bom_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/commande/doc/pdf_einstein.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/commande/mod_commande_saphir.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/commande/modules_commande.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/contract/doc/pdf_strato.modules.php' => ['PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/core/modules/contract/mod_contract_magre.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/delivery/doc/pdf_storm.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/delivery/doc/pdf_typhon.modules.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/delivery/mod_delivery_saphir.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/expedition/doc/pdf_merou.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/expedition/mod_expedition_ribera.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/expensereport/mod_expensereport_sand.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/facture/modules_facture.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/fichinter/mod_arctic.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/fichinter/mod_pacific.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/hrm/doc/pdf_standard_evaluation.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/hrm/mod_evaluation_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/import/import_csv.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/import/import_xlsx.modules.php' => ['PhanTypeMismatchProperty'], 'htdocs/core/modules/mailings/contacts1.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/mailings/thirdparties.modules.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/modules/payment/mod_payment_ant.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanTypeMismatchDimFetch'], 'htdocs/core/modules/product/doc/pdf_standard.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/product/mod_codeproduct_elephant.php' => ['PhanPluginSuspiciousParamOrder'], - 'htdocs/core/modules/product_batch/mod_lot_advanced.php' => ['PhanPluginSuspiciousParamOrder'], - 'htdocs/core/modules/product_batch/mod_sn_advanced.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/project/doc/pdf_timespent.modules.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/modules/project/mod_project_universal.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/project/task/mod_task_universal.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/propale/doc/pdf_azur.modules.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/propale/doc/pdf_cyan.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/propale/mod_propale_saphir.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/propale/modules_propale.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/reception/doc/pdf_squille.modules.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/reception/mod_reception_moonstone.php' => ['PhanPluginSuspiciousParamOrder'], - 'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginSuspiciousParamOrder', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], + 'htdocs/core/modules/societe/mod_codecompta_aquarium.php' => ['PhanPluginUnknownPropertyType'], + 'htdocs/core/modules/societe/mod_codecompta_digitaria.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/core/modules/stock/doc/pdf_standard_stock.modules.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'], 'htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php' => ['PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/stocktransfer/mod_stocktransfer_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_invoice/doc/doc_generic_supplier_invoice_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty'], 'htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], @@ -236,24 +219,24 @@ return [ 'htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/core/modules/supplier_order/modules_commandefournisseur.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/modules/supplier_payment/doc/pdf_standard_supplierpayment.modules.php' => ['PhanPluginUnknownPropertyType'], - 'htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/core/modules/supplier_proposal/doc/pdf_zenith.modules.php' => ['PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], - 'htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php' => ['PhanPluginSuspiciousParamOrder'], - 'htdocs/core/modules/takepos/mod_takepos_ref_universal.php' => ['PhanPluginSuspiciousParamOrder'], + 'htdocs/core/modules/syslog/mod_syslog_file.php' => ['PhanPluginDuplicateArrayKey'], 'htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/ticket/mod_ticket_universal.php' => ['PhanPluginSuspiciousParamOrder'], 'htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php' => ['PhanPossiblyUndeclaredVariable'], - 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/core/search_page.php' => ['PhanEmptyForeach', 'PhanPluginBothLiteralsBinaryOp'], - 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/commonfields_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/extrafields_edit.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], + 'htdocs/core/tpl/extrafields_list_search_title.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/core/tpl/extrafields_view.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/core/tpl/notes.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/core/tpl/filemanager.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/formlayoutai.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/tpl/list_print_total.tpl.php' => ['PhanPluginUndeclaredVariableIsset'], + 'htdocs/core/tpl/massactions_pre.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/core/tpl/notes.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/core/tpl/object_discounts.tpl.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/objectline_create.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/tpl/objectline_view.tpl.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -277,10 +260,11 @@ return [ 'htdocs/delivery/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/document.php' => ['PhanRedefineFunction'], 'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'], - 'htdocs/don/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/don/card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/don/class/api_donations.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/don/class/don.class.php' => ['PhanParamTooMany'], 'htdocs/don/document.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/don/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/don/info.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/don/list.php' => ['PhanTypeMismatchProperty'], 'htdocs/don/note.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], @@ -291,7 +275,6 @@ return [ 'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'], - 'htdocs/emailcollector/lib/emailcollector.lib.php' => ['PhanUndeclaredTypeParameter'], 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -317,12 +300,12 @@ return [ 'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/fichinter/card-rec.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'], 'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/filefunc.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], + 'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'], @@ -367,10 +350,12 @@ return [ 'htdocs/imports/emptyexample.php' => ['PhanRedefineFunction', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/imports/import.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/install/check.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], - 'htdocs/install/fileconf.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/install/fileconf.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/install/inc.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/install/index.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/install/repair.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/install/repair.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/install/step2.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'], + 'htdocs/install/step5.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/install/upgrade.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'], 'htdocs/intracommreport/card.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -388,7 +373,6 @@ return [ 'htdocs/mrp/class/mo.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/mrp/mo_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/mo_movements.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], - 'htdocs/mrp/mo_production.php' => ['PhanPluginEmptyStatementIf', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/mrp/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/mrp/tpl/originproductline.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/multicurrency/class/api_multicurrencies.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], @@ -396,6 +380,7 @@ return [ 'htdocs/opcachepreload.php' => ['PhanEmptyForeach'], 'htdocs/opensurvey/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/class/opensurveysondage.class.php' => ['PhanTypeMismatchProperty'], + 'htdocs/opensurvey/list.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/opensurvey/results.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/choix_date.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/opensurvey/wizard/create_survey.php' => ['PhanPossiblyUndeclaredGlobalVariable'], @@ -412,11 +397,12 @@ return [ 'htdocs/product/class/html.formproduct.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/inventory/class/inventory.class.php' => ['PhanUndeclaredProperty'], 'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/product/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], + 'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'], 'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'], @@ -427,8 +413,8 @@ return [ 'htdocs/product/stock/class/mouvementstock.class.php' => ['PhanPossiblyUndeclaredVariable'], 'htdocs/product/stock/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], - 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/product/stock/movement_list.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/product/stock/product.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/productlot_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -443,7 +429,6 @@ return [ 'htdocs/product/stock/stocktransfer/stocktransfer_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/product/stock/tpl/stockcorrection.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/product/stock/tpl/stocktransfer.tpl.php' => ['PhanUndeclaredProperty'], - 'htdocs/projet/activity/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeExpectedObjectPropAccessButGotNull', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/admin/project.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/ajax/projects.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/card.php' => ['PhanUndeclaredGlobalVariable'], @@ -452,18 +437,15 @@ return [ 'htdocs/projet/element.php' => ['PhanUndeclaredProperty'], 'htdocs/projet/ganttchart.inc.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/ganttview.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/graph_opportunities.inc.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/projet/index.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/projet/list.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/projet/graph_opportunities.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'], 'htdocs/projet/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/projet/tasks.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/comment.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/contact.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/document.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/tasks/list.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/projet/tasks/note.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/projet/tasks/task.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], + 'htdocs/projet/tasks/time.php' => ['PhanEmptyForeach', 'PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/projet/tasks/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'], 'htdocs/public/agenda/agendaexport.php' => ['PhanRedefineFunction'], 'htdocs/public/bookcal/index.php' => ['PhanRedefineFunction'], @@ -490,6 +472,7 @@ return [ 'htdocs/public/project/viewandvote.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/recruitment/view.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/public/stripe/ipn.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], + 'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'], 'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/public/webportal/tpl/menu.tpl.php' => ['PhanUndeclaredProperty'], @@ -501,15 +484,15 @@ return [ 'htdocs/reception/class/reception.class.php' => ['PhanUndeclaredProperty'], 'htdocs/reception/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'], 'htdocs/reception/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/reception/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], + 'htdocs/reception/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/reception/note.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/recruitment/admin/setup.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/admin/setup_candidatures.php' => ['PhanEmptyForeach'], 'htdocs/recruitment/class/recruitmentcandidature.class.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/class/recruitmentjobposition.class.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], - 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanPluginSuspiciousParamOrder', 'PhanUndeclaredProperty'], + 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentcandidature_advanced.php' => ['PhanUndeclaredProperty'], + 'htdocs/recruitment/core/modules/recruitment/mod_recruitmentjobposition_advanced.php' => ['PhanUndeclaredProperty'], 'htdocs/recruitment/index.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/recruitment/recruitmentcandidature_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/recruitment/recruitmentcandidature_list.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], @@ -531,7 +514,7 @@ return [ 'htdocs/societe/class/api_thirdparties.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/societe/class/societe.class.php' => ['PhanTypeMismatchProperty'], 'htdocs/societe/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/societe/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/societe/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/paymentmodes.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanUndeclaredGlobalVariable'], 'htdocs/societe/price.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/societe/tpl/linesalesrepresentative.tpl.php' => ['PhanTypeMismatchArgumentProbablyReal'], @@ -545,9 +528,10 @@ return [ 'htdocs/takepos/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/takepos/floors.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/takepos/freezone.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/takepos/index.php' => ['PhanPluginUndeclaredVariableIsset'], 'htdocs/takepos/invoice.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/takepos/pay.php' => ['PhanPossiblyUndeclaredGlobalVariable'], - 'htdocs/takepos/split.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/takepos/split.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/theme/eldy/badges.inc.php' => ['PhanRedefineFunction'], 'htdocs/theme/eldy/btn.inc.php' => ['PhanUndeclaredGlobalVariable'], 'htdocs/theme/eldy/dropdown.inc.php' => ['PhanUndeclaredGlobalVariable'], @@ -605,6 +589,7 @@ return [ 'htdocs/workstation/workstation_list.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/zapier/class/api_zapier.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'], 'htdocs/zapier/class/hook.class.php' => ['PhanUndeclaredProperty'], + 'internal' => ['PhanUndeclaredConstant'], ], // 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed. // (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases) From 3d6c60c7781b7306d4fb220292e706517e0def9c Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 22:15:21 +0100 Subject: [PATCH 33/37] Ignore use of deprecated constant --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 873a4a7b9a2..0912bdb2a77 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -4067,7 +4067,7 @@ if ($action == 'create') { // Validate if ($action != 'confirm_edit' && $object->status == FactureFournisseur::STATUS_DRAFT && count($object->lines) > 0 - && ((($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_PROFORMA || $object->type == FactureFournisseur::TYPE_SITUATION) && (getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) + && ((($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT || $object->type == FactureFournisseur::TYPE_DEPOSIT || $object->type == FactureFournisseur::TYPE_PROFORMA || $object->type == FactureFournisseur::TYPE_SITUATION) && (getDolGlobalString('SUPPLIER_INVOICE_ENABLE_NEGATIVE') || $object->total_ttc >= 0)) // @phan-suppress-current-line PhanDeprecatedClassConstant || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) { if (count($object->lines)) { if ($usercanvalidate) { From c6520e89bba8ba18bc7e907fc228579bfe5e4964 Mon Sep 17 00:00:00 2001 From: MDW Date: Mon, 30 Dec 2024 22:19:17 +0100 Subject: [PATCH 34/37] Update typing for getListOfOpenDirectDebitOrCreditTransfer --- htdocs/core/class/commoninvoice.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 8d746df687b..52234601582 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -493,8 +493,8 @@ abstract class CommonInvoice extends CommonObject /** * Return list of open direct debit or credit transfer * - * @param string $type 'bank-transfer' or 'direct-debit' - * @return array Array with list of payments + * @param 'bank-transfer'|'direct-debit' $type 'bank-transfer' or 'direct-debit' + * @return array Array with list of payments */ public function getListOfOpenDirectDebitOrCreditTransfer($type) { @@ -522,10 +522,10 @@ abstract class CommonInvoice extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj) { $listofopendirectdebitorcredittransfer[] = array( - 'id' => $obj->rowid, + 'id' => (int) $obj->rowid, 'invoiceid' => (int) $this->id, 'date' => $this->db->jdate($obj->date_demande), - 'amount' => $obj->amount + 'amount' => (float) $obj->amount ); } From 3cad54e4d1a366b5158e27d70c92026c77b7f359 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Tue, 31 Dec 2024 16:14:51 +0100 Subject: [PATCH 35/37] Add option to restore backward compatibility --- htdocs/core/lib/functions.lib.php | 21 ++++++++++++++++----- htdocs/website/index.php | 1 + 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b2fed05b758..6ba4b005383 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8130,13 +8130,14 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = * @param int $allowiframe Allow iframe tags. * @param string[] $allowed_tags List of allowed tags to replace the default list * @param int $allowlink Allow "link" tags (for head html section) - * @param int $allowscript Allow "script" tags (for head html section) - * @param int $allowstyle Allow "style" tags (for head html section) + * @param int $allowscript Allow "script" tags (for head html section when using GETPOST with mode 'restricthtmlallowlinkscript') + * @param int $allowstyle Allow "style" tags (for head html section when using GETPOST with mode 'restricthtmlallowlinkscript') + * @param int $allowphp Allow "php" tags (Deprecated. Should never be used. If you can add php, you can also print in the php the code to output the other non allowed tags) * @return string String cleaned * * @see dol_htmlwithnojs() dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags() */ -function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $removeclassattribute = 1, $cleanalsojavascript = 0, $allowiframe = 0, $allowed_tags = array(), $allowlink = 0, $allowscript = 0, $allowstyle = 0) +function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $removeclassattribute = 1, $cleanalsojavascript = 0, $allowiframe = 0, $allowed_tags = array(), $allowlink = 0, $allowscript = 0, $allowstyle = 0, $allowphp = 0) { if (empty($allowed_tags)) { $allowed_tags = array( @@ -8177,6 +8178,12 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, //$stringtoclean = preg_replace('//', '', $stringtoclean); $stringtoclean = preg_replace('//', '\1', $stringtoclean); + if ($allowphp) { + $allowed_tags[] = "commentphp"; + $stringtoclean = preg_replace('/^<\?php([^"]+)\?>$/i', '\1__', $stringtoclean); // Note: is allowed only if on the same line + $stringtoclean = preg_replace('/"<\?php([^"]+)\?>"/i', '"\1"', $stringtoclean); // Note: "" is allowed only if on the same line + } + $stringtoclean = preg_replace('/:/i', ':', $stringtoclean); $stringtoclean = preg_replace('/:|�+58|:/i', '', $stringtoclean); // refused string ':' encoded (no reason to have a : encoded like this) to disable 'javascript:...' @@ -8190,7 +8197,7 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $temp = preg_replace('/(<[^>]+)\s+class=((["\']).*?\\3|\\w*)/i', '\\1', $temp); } - // Remove 'javascript:' that we should not find into a text with + // Remove 'javascript:' that we should not find into a text // Warning: This is not reliable to fight against obfuscated javascript, there is a lot of other solution to include js into a common html tag (only filtered by a GETPOST(.., powerfullfilter)). if ($cleanalsojavascript) { $temp = preg_replace('/j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t\s*:/i', '', $temp); @@ -8198,6 +8205,10 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, $temp = str_replace('__!DOCTYPE_HTML__', '', $temp); // Restore the DOCTYPE + if ($allowphp) { + $temp = preg_replace('/(.*)<\/commentphp>/', '', $temp); // Restore php code + } + $temp = preg_replace('/([^>]*)<\/comment>/', '', $temp); // Restore html comments @@ -8542,7 +8553,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' // Keep only some html tags and remove also some 'javascript:' strings if ($check == 'restricthtmlallowlinkscript') { - $out = dol_string_onlythesehtmltags($out, 0, 1, 0, 0, array(), 1, 1, 1); + $out = dol_string_onlythesehtmltags($out, 0, 1, 0, 0, array(), 1, 1, 1, getDolGlobalInt("UNSECURED_restricthtmlallowlinkscript_ALLOW_PHP")); } elseif ($check == 'restricthtmlallowclass' || $check == 'restricthtmlallowunvalid') { $out = dol_string_onlythesehtmltags($out, 0, 0, 1); } else { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3147fc4b6bd..aa9b1a64c50 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1614,6 +1614,7 @@ if ($action == 'updatecss' && $usercanedit) { $dataposted = trim(GETPOST('WEBSITE_HTML_HEADER', 'restricthtmlallowlinkscript')); // Must accept tags like '