diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index 9b055ffc31c..d8806427808 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -1188,18 +1188,6 @@ parameters: count: 1 path: ../../htdocs/adherents/partnership.php - - - message: '#^Variable \$label might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/adherents/stats/geo.php - - - - message: '#^Variable \$theme_datacolor might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/adherents/stats/geo.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -7626,12 +7614,6 @@ parameters: count: 3 path: ../../htdocs/compta/tva/payments.php - - - message: '#^Call to function is_array\(\) with list\ will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/compta/tva/quadri_detail.php - - message: '#^Call to function is_array\(\) with list\ will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -35682,114 +35664,18 @@ parameters: count: 1 path: ../../scripts/bank/export-bank-receipts.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 6 - path: ../../scripts/company/sync_contacts_dolibarr2ldap.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 5 - path: ../../scripts/company/sync_contacts_dolibarr2ldap.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/company/sync_contacts_dolibarr2ldap.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/company/sync_contacts_dolibarr2ldap.php - - - - message: '#^Variable \$user might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/company/sync_contacts_dolibarr2ldap.php - - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/contracts/email_expire_services_to_customers.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 8 - path: ../../scripts/contracts/email_expire_services_to_customers.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/contracts/email_expire_services_to_customers.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/contracts/email_expire_services_to_customers.php - - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../scripts/contracts/email_expire_services_to_representatives.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/contracts/email_expire_services_to_representatives.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/contracts/email_expire_services_to_representatives.php - - message: '#^Result of \|\| is always false\.$#' identifier: booleanOr.alwaysFalse count: 1 path: ../../scripts/doc/regenerate_docs.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/doc/regenerate_docs.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/doc/regenerate_docs.php - - message: '#^Variable \$dir in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable count: 1 path: ../../scripts/doc/regenerate_docs.php - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/doc/regenerate_docs.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/doc/regenerate_docs.php - - message: '#^Variable \$newlang in empty\(\) always exists and is always falsy\.$#' identifier: empty.variable @@ -35808,30 +35694,6 @@ parameters: count: 1 path: ../../scripts/emailings/mailing-send.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../scripts/emailings/mailing-send.php - - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/emailings/mailing-send.php - - - - message: '#^Variable \$hookmanager might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../scripts/emailings/mailing-send.php - - - - message: '#^Variable \$langs might not be defined\.$#' - identifier: variable.undefined - count: 4 - path: ../../scripts/emailings/mailing-send.php - - message: '#^Variable \$mesg might not be defined\.$#' identifier: variable.undefined diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index e5a37b8b709..8790cb6c9bc 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -54,14 +54,6 @@ $search_subaccount = GETPOST('search_subaccount', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); $search_type = GETPOST('search_type', 'intcomma'); -// Security check -if ($user->socid > 0) { - accessforbidden(); -} -if (!$user->hasRight('accounting', 'chartofaccount')) { - accessforbidden(); -} - // Load variable for pagination $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -92,6 +84,14 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { unset($arrayfields['reconcilable']); } +// Security check +if ($user->socid > 0) { + accessforbidden(); +} +if (!$user->hasRight('accounting', 'chartofaccount')) { // after this test, $user->hasRight('accounting', 'chartofaccount') is always valid + accessforbidden(); +} + /* * Actions @@ -124,6 +124,13 @@ if (empty($reshook)) { $search_type = ""; $search_array_options = array(); } + + if ($action == 'enable' /* && $user->hasRight('accounting', 'chartofaccount') */) { // test useless + setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'errors'); + } + if ($action == 'disable' /* && $user->hasRight('accounting', 'chartofaccount') */) { + setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'errors'); + } } @@ -142,7 +149,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-adm // Customer -$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature"; +$sql = "SELECT sa.rowid, sa.nom as label, sa.code_compta as subaccount, '1' as type, sa.entity, sa.client as nature, sa.fournisseur as nature2"; $sql .= " FROM ".MAIN_DB_PREFIX."societe sa"; $sql .= " WHERE sa.entity IN (".getEntity('societe').")"; $sql .= " AND sa.code_compta <> ''"; @@ -163,7 +170,6 @@ if (strlen(trim($search_subaccount))) { } } - //var_dump($search_subaccount); exit; if ($search_subaccount_tmp) { if ($weremovedsomezero) { $search_subaccount_tmp_clean = $search_subaccount_tmp; @@ -190,7 +196,8 @@ if (!empty($search_type) && $search_type >= 0) { // Supplier $sql .= " UNION "; -$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity, '0' as nature FROM ".MAIN_DB_PREFIX."societe sa"; +$sql .= " SELECT sa.rowid, sa.nom as label, sa.code_compta_fournisseur as subaccount, '2' as type, sa.entity, sa.client as nature, sa.fournisseur as nature2"; +$sql .= " FROM ".MAIN_DB_PREFIX."societe sa"; $sql .= " WHERE sa.entity IN (".getEntity('societe').")"; $sql .= " AND sa.code_compta_fournisseur <> ''"; //print $sql; @@ -237,7 +244,8 @@ if (!empty($search_type) && $search_type >= 0) { // User - Employee $sql .= " UNION "; -$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity, '0' as nature FROM ".MAIN_DB_PREFIX."user u"; +$sql .= " SELECT u.rowid, u.lastname as label, u.accountancy_code as subaccount, '3' as type, u.entity, '0' as nature, '0' as nature2"; +$sql .= " FROM ".MAIN_DB_PREFIX."user u"; $sql .= " WHERE u.entity IN (".getEntity('user').")"; $sql .= " AND u.accountancy_code <> ''"; //print $sql; @@ -368,7 +376,7 @@ if ($resql) { print ''; } if (!empty($arrayfields['type']['checked'])) { - print ''.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).''; + print ''.$form->selectarray('search_type', array('1'=>$langs->trans('Customer').' / '.$langs->trans("Prospect"), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).''; } if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { if (!empty($arrayfields['reconcilable']['checked'])) { @@ -409,12 +417,25 @@ if ($resql) { } print "\n"; + $companystatic = new Societe($db); + $totalarray = array(); $totalarray['nbfield'] = 0; $i = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); + if ($obj->type == 1) { + $companystatic->id = $obj->id; + $companystatic->client = $obj->nature; + $companystatic->fournisseur = 0; + } + if ($obj->type == 2) { + $companystatic->id = $obj->id; + $companystatic->client = 0; + $companystatic->fournisseur = $obj->nature2; + } + print ''; // Action column @@ -466,7 +487,12 @@ if ($resql) { // Customer if ($obj->type == 1) { - $s .= ''.$langs->trans("Customer").''; + $s .= ''; + $s .= $langs->trans("Customer"); + $s .= ''; + if ($obj->nature == 2) { + $s .= ' ('.$langs->trans("Prospect").')'; + } } elseif ($obj->type == 2) { // Supplier $s .= ''.$langs->trans("Supplier").''; @@ -475,9 +501,6 @@ if ($resql) { $s .= ''.$langs->trans("Employee").''; } print $s; - if ($obj->nature == 2) { - print ' ('.$langs->trans("Prospect").')'; - } print ''; if (!$i) { $totalarray['nbfield']++; @@ -489,11 +512,11 @@ if ($resql) { if (!empty($arrayfields['reconcilable']['checked'])) { print ''; if (empty($obj->reconcilable)) { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index e2353b82af6..7ad5ee54ee7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3300,7 +3300,7 @@ class Adherent extends CommonObject $return .= '
'; $return .= ''; if (property_exists($this, 'photo') || !empty($this->photo)) { - $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', 'user'); } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 3f0ebd040f2..8e5362fdeec 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -95,6 +95,7 @@ print load_fiche_titre($title, '', $memberstatic->picto); //dol_mkdir($dir); $data = array(); $tab = null; +$label = ''; if ($mode) { // Define sql @@ -263,6 +264,7 @@ if ($mode && !count($data)) { // Show graphics if (count($arrayjs) && $mode == 'memberbycountry') { + global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; if (is_readable($color_file)) { include $color_file; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 75d92306f16..433f08bcd80 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -418,6 +418,6 @@ class DolibarrApi */ protected static function _forge_criteria_callback($matches) { - return dolForgeCriteriaCallback($matches); + return dolForgeSQLCriteriaCallback($matches); } } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3a5fe7166ab..f9cd158244f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1311,7 +1311,7 @@ class FactureRec extends CommonInvoice if (empty($this->date_when)) { return false; } - return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency); + return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency, 1); } /** diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index e6d8b689ac2..4d69db45350 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -136,7 +136,7 @@ class FactureStats extends Stats } if ($categid) { - $this->where .= ' AND EXISTS (SELECT rowid FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = f.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; + $this->where .= ' AND EXISTS (SELECT cats.fk_categorie FROM '.MAIN_DB_PREFIX.'categorie_societe as cats WHERE cats.fk_soc = f.fk_soc AND cats.fk_categorie = '.((int) $categid).')'; } } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 29d6488f4ab..25eb5c6f532 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -990,7 +990,7 @@ if ($object->id > 0) { // Iban print ''; - print $obj->iban; + print dolDecrypt($obj->iban); if ($obj->iban && $obj->bic) { print " / "; } @@ -1119,7 +1119,7 @@ if ($object->id > 0) { // Iban print ''; - print $obj->iban; + print dolDecrypt($obj->iban); if ($obj->iban && $obj->bic) { print " / "; } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 55222f6c4cd..7fd7ea75d88 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1068,7 +1068,7 @@ class BonPrelevement extends CommonObject // phpcs:enable global $conf, $langs, $user; - dol_syslog(__METHOD__ . " Bank=" . $banque . " Office=" . $agence . " mode=" . $mode . " format=" . $format, LOG_DEBUG); + dol_syslog(__METHOD__ . " Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." did=".$did." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG); require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php"; @@ -1150,7 +1150,7 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG); $sql = "SELECT f.rowid, pd.rowid as pfdrowid"; - $sql .= ", f.".$this->db->sanitize($socOrUser); + $sql .= ", f.".$this->db->sanitize($socOrUser); // fk_soc or fk_user $sql .= ", pd.code_banque, pd.code_guichet, pd.number, pd.cle_rib"; $sql .= ", pd.amount"; if ($sourcetype != 'salary') { @@ -1200,7 +1200,12 @@ class BonPrelevement extends CommonObject while ($i < $num) { $row = $this->db->fetch_row($resql); // TODO Replace with fetch_object() '@phan-var-force array,string> $row'; - $factures[$i] = $row; // All fields + + // All fields: 0=rowid, 1=pfdrowid, 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key, 7=amount, 8=name, 9=ref, 10=bic, 11=iban, 12=frstrecur + $factures[$i] = $row; + + // Decode BAN + $factures[$i][11] = dolDecrypt($factures[$i][11]); if ($row[7] == 0) { $error++; @@ -1232,20 +1237,10 @@ class BonPrelevement extends CommonObject // Check BAN $i = 0; - dol_syslog(__METHOD__ . " Check BAN", LOG_DEBUG); + dol_syslog(__METHOD__ . " Check BAN for each invoices or salary", LOG_DEBUG); if (count($factures) > 0) { foreach ($factures as $key => $fac) { - /* - if ($type != 'bank-transfer') { - $tmpinvoice = new Facture($this->db); - } else { - $tmpinvoice = new FactureFournisseur($this->db); - } - $resfetch = $tmpinvoice->fetch($fac[0]); - if ($resfetch >= 0) { // Field 0 of $fac is rowid of invoice - */ - // Check if $fac[8] s.nom is null if ($fac[8] != null) { if ($type != 'bank-transfer') { @@ -1259,6 +1254,7 @@ class BonPrelevement extends CommonObject $verif = checkSwiftForAccount(null, $fac[10]); if ($verif || (empty($fac[10]) && getDolGlobalInt("WITHDRAWAL_WITHOUT_BIC"))) { + dol_syslog(__METHOD__." now call checkIbanForAccount(null, ".$fac[11].")"); $verif = checkIbanForAccount(null, $fac[11]); } @@ -1312,7 +1308,7 @@ class BonPrelevement extends CommonObject $ok = 0; // Withdraw invoices in factures_prev array - $out = count($factures_prev) . " invoices will be included."; + $out = count($factures_prev) . " invoices or salaries will be included."; //print $out."\n"; dol_syslog($out); @@ -1901,8 +1897,9 @@ class BonPrelevement extends CommonObject $cachearraytotestduplicate[$obj->idfac] = $obj->rowid; $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); + $iban = dolDecrypt($obj->iban); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type); $this->total += $obj->somme; $i++; @@ -2044,12 +2041,13 @@ class BonPrelevement extends CommonObject $cachearraytotestduplicate[$obj->idfac] = $obj->rowid; $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); + $iban = dolDecrypt($obj->iban); $refobj = $obj->reffac; if (empty($refobj) && !empty($forsalary)) { // If ref of salary not defined, we force a value $refobj = "SAL" . $obj->idfac; } - $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier); + $fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier); $this->total += $obj->somme; $i++; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9af01fe74ce..5fc553e9994 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1531,7 +1531,7 @@ class Contact extends CommonObject * @param string $morecss Add more css on link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '') + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = 'valignmiddle') { global $conf, $langs, $hookmanager; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0d971f01723..ae6fd816681 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -166,26 +166,22 @@ if ($type == "p") { $contextpage = 'contactprospectlist'; } $title .= ' ('.$langs->trans("ThirdPartyProspects").')'; - $urlfiche = "card.php"; } if ($type == "c") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactcustomerlist'; } $title .= ' ('.$langs->trans("ThirdPartyCustomers").')'; - $urlfiche = "card.php"; } elseif ($type == "f") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactsupplierlist'; } $title .= ' ('.$langs->trans("ThirdPartySuppliers").')'; - $urlfiche = "card.php"; } elseif ($type == "o") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactotherlist'; } $title .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; - $urlfiche = ""; } // Initialize a technical object @@ -1453,7 +1449,6 @@ while ($i < $imaxinloop) { } } else { // Show here line of result - $j = 0; print 'name ?? ''; // Using TLV format - $s = pack('C1', 1).pack('C1', strlen($mysoc->name)).$mysoc->name; + $s = pack('C1', 1).pack('C1', strlen($mysocname)).$mysocname; $s .= pack('C1', 2).pack('C1', strlen($mysoc->tva_intra)).$mysoc->tva_intra; $s .= pack('C1', 3).pack('C1', strlen($datestring)).$datestring; $s .= pack('C1', 4).pack('C1', strlen($pricewithtaxstring)).$pricewithtaxstring; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 71cc203b2d8..8fe7db58b72 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6856,28 +6856,52 @@ abstract class CommonObject } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'point') { // for point type if (!empty($new_array_options[$key])) { - $sql .= ",ST_PointFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "POINT(15 20)" + $sql .= ",ST_PointFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for point ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'multipts') { // for point type if (!empty($new_array_options[$key])) { - $sql .= ",ST_MultiPointFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "MULTIPOINT(0 0, 20 20, 60 60)" + $sql .= ",ST_MultiPointFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for multipoint ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'linestrg') { // for linestring type if (!empty($new_array_options[$key])) { - $sql .= ",ST_LineFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "LINESTRING(0 0, 10 10, 20 25, 50 60)" + $sql .= ",ST_LineFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for line ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } } if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] == 'polygon') { // for polygon type if (!empty($new_array_options[$key])) { - $sql .= ",ST_PolyFromText('".$this->db->escape($new_array_options[$key])."')"; + if (!preg_match('/error/i', $new_array_options[$key])) { + // Text must be a WKT string, so "POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))" + $sql .= ",ST_PolyFromText('".$this->db->escape($new_array_options[$key])."')"; + } else { + dol_syslog("Bad syntax string for polygon ".$new_array_options[$key]." to generate SQL request", LOG_WARNING); + $sql .= ",null"; + } } else { $sql .= ",null"; } diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index b71925e0b9a..9d80dbdd518 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -152,9 +152,9 @@ trait CommonPeople /** * Return full address for banner * - * @param string $htmlkey HTML id to make banner content unique - * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) - * @return string Full address string + * @param string $htmlkey HTML id to make banner content unique + * @param CommonObject $object Object (thirdparty, thirdparty of contact for contact, null for a member) + * @return string Full address string */ public function getBannerAddress($htmlkey, $object) { @@ -165,20 +165,24 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this instanceOf Societe && $this->element === 'societe') { - /** @var Societe $this */ + if ($this->element === 'societe' && $this instanceof Societe) { $thirdpartyid = $this->id; } - if ($this instanceOf Contact && $this->element === 'contact') { - /** @var Contact $this */ + if ($this->element === 'contact' && $this instanceof Contact) { $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this instanceOf User && $this->element === 'user') { - /** @var User $this */ + if ($this->element == 'member' && $this instanceof Adherent) { + $contactid = $this->id; + $thirdpartyid = empty($this->socid) ? 0 : $this->socid; + } + if ($this->element === 'user' && $this instanceof User) { $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } + if ($this->element == 'recruitmentcandidature' && $this instanceof RecruitmentCandidature) { + $thirdpartyid = 0; + } $out = ''; @@ -210,7 +214,7 @@ trait CommonPeople $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'); } - if (is_array($arrayoflangcode) && count($arrayoflangcode)) { + if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) { if (!is_object($extralanguages)) { include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; $extralanguages = new ExtraLanguages($this->db); @@ -258,7 +262,7 @@ trait CommonPeople // Phones $outphonedone = 0; if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone - $out .= ($outphonedone ? ' ' : ''); + // $out .= ($outphonedone ? ' ' : ''); $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; $outphonedone++; @@ -387,7 +391,7 @@ trait CommonPeople $this->address = dol_strtoupper($this->address); $this->town = dol_strtoupper($this->town); } - if (isset($this->email)) { + if (!empty($this->email)) { $this->email = dol_strtolower($this->email); } if (isset($this->personal_email)) { diff --git a/htdocs/core/class/dolgeophp.class.php b/htdocs/core/class/dolgeophp.class.php index 78f6bfed620..d5211bcc436 100644 --- a/htdocs/core/class/dolgeophp.class.php +++ b/htdocs/core/class/dolgeophp.class.php @@ -115,10 +115,15 @@ class DolGeoPHP { $value_key = ''; - $geom = geoPHP::load($geojson, 'json'); - if ($geom) { - '@phan-var-force Geometry $geom'; - $value_key = $geom->out('wkt'); + try { + $geom = geoPHP::load($geojson, 'json'); + if ($geom) { + '@phan-var-force Geometry $geom'; + $value_key = $geom->out('wkt'); + } + } catch (Exception $e) { + // Do nothing + $value_key = 'Error: Bad value for property'; } return $value_key; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e61568e6209..218c5822d66 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2767,9 +2767,9 @@ class Form } if (empty($hidelabel)) { - $out .= $langs->trans("RefOrLabel") . ' : '; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; } elseif ($hidelabel > 1) { - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; if ($hidelabel == 2) { $out .= img_picto($langs->trans("Search"), 'search'); } @@ -5263,14 +5263,15 @@ class Form while ($i < $num) { $obj = $this->db->fetch_object($result); + $iban = dolDecrypt($obj->iban_prefix); if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { - $out .= ''; $i++; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 57f86f121cf..65b4cea3a88 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -511,7 +511,7 @@ class FormAdmin */ public function selectTypeOfFields($htmlname, $type, $typewecanchangeinto = array()) { - global $type2label; // TODO Remove this + global $type2label; // TODO Remove this global $out = ''; diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 2c2390a9005..0ca6f57f458 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -515,7 +515,9 @@ class vCard $this->setOrg($company->name); } - $this->setURL($company->url, ""); + if (!empty($company->url)) { + $this->setURL($company->url, ""); + } if ($company->phone && empty($object->office_phone)) { // If we already set the type TYPE=WORK,VOICE with office_phone $this->setPhoneNumber($company->phone, "TYPE=WORK,VOICE"); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 20ebd6464df..8378d992bd3 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -639,14 +639,14 @@ function ajax_event($htmlname, $events) * @param string $suffix Suffix to use on the name of the switch picto when option is on. Example: '', '_red' * @param string $mode Add parameter &mode= to the href link (Used for href link) * @param string $morecss More CSS - * @param int $userconst 1=OnOff for user constant of user $userconst + * @param User|int $userconst If set, use the ajax On/Off for user or user ID $userconst * @param string $showwarning String to show a warning when enabled the option * @return string * @see ajax_object_onoff() to update the status of an object */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block', $userconst = 0, $showwarning = '') { - global $conf, $langs, $user; + global $conf, $langs, $user, $db; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); if (!isset($input)) { @@ -660,6 +660,15 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof $out = ''.img_picto($langs->trans("Enabled"), 'on').''; } } else { + $userconstid = 0; + if (is_object($userconst)) { + $userconstid = $userconst->id; + } elseif (is_numeric($userconst) && $userconst > 0) { + $userconstid = $userconst; + $userconst = new User($db); + $userconst->fetch($userconstid); + } + $out = "\n".' '."\n"; - if ($userconst) { - $value = getDolUserString($code); + if (!empty($userconst) && $userconst instanceof User) { + $value = getDolUserString($code, '', $userconst); } else { $value = getDolGlobalString($code); } @@ -726,7 +734,7 @@ console.log("ee"); * On/off button to change a property status of an object * This uses the ajax service objectonoff.php (May be called when MAIN_DIRECT_STATUS_UPDATE is set for some pages) * - * @param Object $object Object to set + * @param CommonObject $object Object to set * @param string $code Name of property in object : 'status' or 'status_buy' for product by example * @param string $field Name of database field : 'tosell' or 'tobuy' for product by example * @param string $text_on Text if on ('Text' or 'Text:Picto on:Css picto on') @@ -746,7 +754,6 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = if (empty($htmlname)) { $htmlname = $code; } - //var_dump($object->module); var_dump($object->element); $out = ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d2609495d49..c2800d3ef84 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4039,7 +4039,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $link = str_replace('{socialid}', $value, getDolGlobalString($networkconstname)); if (preg_match('/^https?:\/\//i', $link)) { $htmllink .= ''.dol_escape_htmltag($value).''; - } else { + } elseif ($link) { $htmllink .= ''.dol_escape_htmltag($value).''; } } elseif (!empty($dictsocialnetworks[$type]['url'])) { @@ -13777,7 +13777,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$errorstr = '', $noand = } } - $ret = ($noand ? "" : " AND ").($nopar ? "" : '(').preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).($nopar ? "" : ')'); + $ret = ($noand ? "" : " AND ").($nopar ? "" : '(').preg_replace_callback('/'.$regexstring.'/i', 'dolForgeSQLCriteriaCallback', $filter).($nopar ? "" : ')'); if (is_object($db)) { $ret = str_replace('__NOW__', $db->idate(dol_now()), $ret); @@ -13938,14 +13938,14 @@ function dolForgeDummyCriteriaCallback($matches) } /** - * Function to forge a SQL criteria from a Dolibarr filter syntax string. + * Function to forge a SQL criteria from a USF (Universal Filter Syntax) string. * This method is called by forgeSQLFromUniversalSearchCriteria() * * @param string[] $matches Array of found string by regex search. * Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL" * @return string Forged criteria. Example: "t.field LIKE 'abc%'" */ -function dolForgeCriteriaCallback($matches) +function dolForgeSQLCriteriaCallback($matches) { global $db; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 700824e7ae3..8d17be75f40 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -257,7 +257,7 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att print ''; print ''; print ''; - print $extrafields->showInputField($tmpkeyextra, $value, '', '', '', 0, $object->id, $object->table_element); + print $extrafields->showInputField($tmpkeyextra, $value, '', '', '', 0, $object, $object->table_element); print ''; diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index b4164ac04c0..3cf6e4f82eb 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -377,7 +377,7 @@ if ($massaction == 'edit_extrafields') { foreach ($extrafields_list as $extraKey => $extraLabel) { $outputShowOutputFields .= ''; } $outputShowOutputFields .= ' total_ttc; ?>); - if (alreadypaydplusreceived > total_ttc; ?>) + //console.log("total_ttc = "+total_ttc; ?>); + if (alreadypaydplusreceived > total_ttc; ?>) { - var change=parseFloat(alreadypayed + parseFloat(received) - total_ttc; ?>); + var change=parseFloat(alreadypayed + parseFloat(received) - total_ttc; ?>); $('.change2').html(pricejs(change, 'MT')); $('.change2').val(change); $('.change1').removeClass('colorred'); @@ -439,7 +439,7 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) { fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(function(client_secret) { - terminal.setSimulatorConfiguration({testCardNumber: 'global->STRIPE_TERMINAL_SIMULATED; ?>'}); + terminal.setSimulatorConfiguration({testCardNumber: ''}); document.getElementById("card-present-alert").innerHTML = '
trans('PaymentSendToStripeTerminal'); ?>
'; terminal.collectPaymentMethod(client_secret).then(function(result) { diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 881c8bd16e5..8427e5b7b6c 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -78,8 +78,11 @@ if (!$user->hasRight('takepos', 'run')) { top_htmlhead('', '', 1); -if ($place > 0) { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; +if ((string) $place != '') { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; + $sql .= " AND entity IN (".getEntity('invoice').")"; + $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index 047fb89610c..b6eab6d8343 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -69,7 +69,10 @@ $invoice = new Facture($db); if ($invoiceid > 0) { $invoice->fetch($invoiceid); } else { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE ref = '(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " AND entity IN (".getEntity('invoice').")"; + $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/takepos/split.php b/htdocs/takepos/split.php index 7f6796db0b0..8fadea69c95 100644 --- a/htdocs/takepos/split.php +++ b/htdocs/takepos/split.php @@ -62,7 +62,7 @@ if (!$user->hasRight('takepos', 'run')) { * Actions */ -if ($action=="split" && $user->hasRight('takepos', 'run')) { +if ($action == "split" && $user->hasRight('takepos', 'run')) { $line = GETPOSTINT('line'); $split = GETPOSTINT('split'); if ($split==1) { // Split line @@ -85,16 +85,17 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)' where rowid=".$placeid; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)'"; + $sql .= " WHERE rowid = ".((int) $placeid); $db->query($sql); } } - $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line; + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET fk_facture = ".((int) $placeid)." WHERE rowid = ".((int) $line); $db->query($sql); } elseif ($split==0) { // Unsplit line $invoice = new Facture($db); - if ($place=="SPLIT") { - $place="0"; + if ($place == "SPLIT") { + $place = "0"; } // Avoid move line to the same place (from SPLIT to SPLIT place) $ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); if ($ret > 0) { @@ -114,7 +115,9 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " WHERE rowid = ".((int) $placeid); $db->query($sql); } } @@ -123,6 +126,7 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { } $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)'); $invoice->update_price(); + $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); $invoice->update_price(); } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 374537924e1..cae8a3a0ca1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5363,7 +5363,7 @@ img.boxhandle, img.boxclose { .add-filter-btn { margin: 0 !important; } -.search-component-assistance .operand, .operator, .value { +.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value { display: contents; } .search-component-assistance .btn-div{ @@ -5410,7 +5410,8 @@ div.info { color: #558; } div.fiche div.info { - box-shadow: 4px 4px 12px #ddd; + box-shadow: 4px 4px 12px #e4e4e4; + margin: 1em 0em 1.2em 0em; } /* Warning message */ @@ -8700,7 +8701,11 @@ table.jPicker { .side-nav { z-index: 200; background: var(--colorbackvmenu1); - padding-top: 70px; + /* padding-top: 70px; */ + position: relative; + top: 70px; + width: 245px; /* must be same than div.login_block */ + box-shadow: none; } #id-left { z-index: 201; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1327a739682..232061f535b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5352,7 +5352,7 @@ img.boxhandle, img.boxclose { .add-filter-btn { margin: 0 !important; } -.search-component-assistance .operand, .operator, .value { +.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value { display: contents; } .search-component-assistance .btn-div{ @@ -5395,9 +5395,11 @@ div.info, div.warning, div.error { div.info { border-: solid 5px #87cfd2; background: #eff8fc; + color: #558; } div.fiche div.info { - box-shadow: 4px 4px 12px #ddd; + box-shadow: 4px 4px 12px #e4e4e4; + margin: 1em 0em 1.2em 0em; } /* Warning message */ diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index b97e8bb0c4c..c1ee44f6840 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -223,7 +223,7 @@ class UserBankAccount extends Account $this->number = $obj->number; $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; - $this->iban = $obj->iban; + $this->iban = dolDecrypt($obj->iban); $this->courant = self::TYPE_CURRENT; $this->type = self::TYPE_CURRENT; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 95644a080fc..d6262bcbe3e 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -131,7 +131,7 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; - $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'

'; + $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'
'; } else { // Button on, click to disable $enabledisablehtml .= ''; @@ -139,13 +139,14 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= ''; } print $enabledisablehtml; -print ''; +print ''; -print '

'; print '
'; if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + print '

'; + print ''; print ''; print ''; @@ -216,60 +217,59 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Photo")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_PHOTO", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_PHOTO", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // Job position print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PostOrFunction")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_JOBPOSITION", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_JOBPOSITION", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // Email print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Email")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_EMAIL", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_EMAIL", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // Office phone print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhonePro")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_OFFICE_PHONE", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_OFFICE_PHONE", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // Office fax print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Fax")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_OFFICE_FAX", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_OFFICE_FAX", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // User mobile print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhoneMobile")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_USER_MOBILE", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_USER_MOBILE", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // Social networks print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_SOCIALNETWORKS", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_SOCIALNETWORKS", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // Show list of socialnetworks for user if ($showUserSocialNetworks) { $socialnetworks = $object->socialnetworks; - if (!empty($socialnetworks)) { foreach ($socialnetworks as $key => $networkVal) { print ''; print '     '.$langs->trans("Hide").' '.dol_escape_htmltag($key).''; - print ajax_constantonoff('USER_SOCIALNETWORK_'.strtoupper($key), array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff('USER_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print ''; print ""; } @@ -280,14 +280,14 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { print ''; print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("Birthdate")); print ''; - print ajax_constantonoff("USER_PUBLIC_SHOW_BIRTH", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_SHOW_BIRTH", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; // Address print ''; print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("Address")); print ''; - print ajax_constantonoff("USER_PUBLIC_SHOW_ADDRESS", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_SHOW_ADDRESS", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; print ''; @@ -299,18 +299,46 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_COMPANY", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_COMPANY", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; if (!getDolUserString('USER_PUBLIC_HIDE_COMPANY', '', $object)) { + // Email + print ''; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Email")); + print ''; + print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_EMAIL", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); + print "\n"; + + // URL + print ''; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("URL")); + print ''; + print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_URL", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); + print "\n"; + + // Office phone + print ''; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Phone")); + print ''; + print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_OFFICE_PHONE", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); + print "\n"; + + // Office fax + print ''; + print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Fax")); + print ''; + print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_OFFICE_FAX", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); + print "\n"; + // Social networks print ''; print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation")); print ''; - print ajax_constantonoff("USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff("USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print "\n"; - // show list of social networks for company + // Show list of social networks for company if ($showSocieteSocialNetworks) { $listofnetworks = $mysoc->socialnetworks; @@ -318,7 +346,7 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { foreach ($listofnetworks as $key => $networkVal) { print ''; print '     '.$langs->trans("Hide").' '.dol_escape_htmltag($key).''; - print ajax_constantonoff('SOCIETE_PUBLIC_SOCIALNETWORKS_'.strtoupper($key), array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object->id); + print ajax_constantonoff('SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object); print ''; print ""; } diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index 454814f43be..a802c522881 100755 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -1,8 +1,9 @@ #!/usr/bin/env php - * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,6 +45,14 @@ require_once DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"; require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php"; require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + // Global variables $version = DOL_VERSION; $error = 0; diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index c9b027c3691..c1740807a28 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -57,6 +57,13 @@ $targettype = $argv[2]; require $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ $langs->loadLangs(array('main', 'contracts')); diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 6e4696cf258..4fee569ee2f 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -55,6 +55,13 @@ $mode = $argv[1]; require $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ $langs->loadLangs(array('main', 'contracts')); diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index d225ad27af8..b11f9351063 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -310,7 +310,7 @@ if (is_array($object->lines) && (count($object->lines) > 0)) { exit(1); } - echo "Job re-scheduled\n"; + echo " - Job re-scheduled\n"; $parameters = array('cronjob' => $cronjob, 'line' => $line); $reshook = $hookmanager->executeHooks('afterRunCronJob', $parameters, $object); diff --git a/scripts/doc/regenerate_docs.php b/scripts/doc/regenerate_docs.php index 6dfe093a481..975d1490840 100755 --- a/scripts/doc/regenerate_docs.php +++ b/scripts/doc/regenerate_docs.php @@ -1,7 +1,8 @@ #!/usr/bin/env php - * Copyright (C) 2015 Jean Heimburger +/* Copyright (C) 2007-2016 Laurent Destailleur + * Copyright (C) 2015 Jean Heimburger + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,6 +47,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/images.lib.php"; +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ + // After this $db, $mysoc, $langs, $conf and $hookmanager are defined (Opened $db handler to database will be closed at end of file). // $user is created but empty. diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 85b097ed3d9..1433373fbd2 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -66,7 +66,13 @@ require_once $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php'; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php"; - +/** + * @var Conf $conf + * @var DoliDB $db + * @var HookManager $hookmanager + * @var Translate $langs + * @var User $user + */ // Global variables $version = DOL_VERSION; $error = 0; diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index afda23c57d7..9770cb09c46 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -208,11 +208,11 @@ class FunctionsLibTest extends CommonClassTest } /** - * testDolForgeCriteriaCallback + * testDolForgeSQLCriteriaCallback * * @return boolean */ - public function testDolForgeCriteriaCallback() + public function testDolForgeSQLCriteriaCallback() { global $conf, $langs, $db;