Merge branch 'develop' into fix_updatelines_propal

This commit is contained in:
Laurent Destailleur 2024-11-26 03:58:10 +01:00 committed by GitHub
commit 2df83054cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 315 additions and 261 deletions

View File

@ -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\<array\{id\: mixed, descr\: mixed, pid\: mixed, pref\: mixed, ptype\: int, payment_id\: mixed, payment_ref\: mixed, payment_amount\: mixed, \.\.\.\}\|array\{id\: mixed, descr\: mixed, pid\: mixed, pref\: mixed, ptype\: mixed, payment_id\: mixed, payment_ref\: mixed, payment_amount\: mixed, \.\.\.\}\> 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\<array\{id\: mixed, descr\: mixed, pid\: mixed, pref\: mixed, ptype\: mixed, payment_id\: mixed, payment_ref\: mixed, payment_amount\: mixed, \.\.\.\}\> 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

View File

@ -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 '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
}
if (!empty($arrayfields['type']['checked'])) {
print '<td class="liste_titre center">'.$form->selectarray('search_type', array('1'=>$langs->trans('Customer'), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).'</td>';
print '<td class="liste_titre center">'.$form->selectarray('search_type', array('1'=>$langs->trans('Customer').' / '.$langs->trans("Prospect"), '2'=>$langs->trans('Supplier'), '3'=>$langs->trans('Employee')), $search_type, 1).'</td>';
}
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
if (!empty($arrayfields['reconcilable']['checked'])) {
@ -409,12 +417,25 @@ if ($resql) {
}
print "</tr>\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 '<tr class="oddeven">';
// Action column
@ -466,7 +487,12 @@ if ($resql) {
// Customer
if ($obj->type == 1) {
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">'.$langs->trans("Customer").'</a>';
$s .= '<a class="customer-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid.'">';
$s .= $langs->trans("Customer");
$s .= '</a>';
if ($obj->nature == 2) {
$s .= ' <span class="warning">('.$langs->trans("Prospect").')</span>';
}
} elseif ($obj->type == 2) {
// Supplier
$s .= '<a class="vendor-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->rowid.'">'.$langs->trans("Supplier").'</a>';
@ -475,9 +501,6 @@ if ($resql) {
$s .= '<a class="user-back" style="padding-left: 6px; padding-right: 6px" title="'.$langs->trans("Employee").'" href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->rowid.'">'.$langs->trans("Employee").'</a>';
}
print $s;
if ($obj->nature == 2) {
print ' <span class="warning bold">('.$langs->trans("Prospect").')</span>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
@ -489,11 +512,11 @@ if ($resql) {
if (!empty($arrayfields['reconcilable']['checked'])) {
print '<td class="center">';
if (empty($obj->reconcilable)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=1&token='.newToken().'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=1&page='.$page.'&token='.newToken().'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=1&token='.newToken().'">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=1&page='.$page.'&token='.newToken().'">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
}

View File

@ -418,6 +418,6 @@ class DolibarrApi
*/
protected static function _forge_criteria_callback($matches)
{
return dolForgeCriteriaCallback($matches);
return dolForgeSQLCriteriaCallback($matches);
}
}

View File

@ -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).')';
}
}

View File

@ -990,7 +990,7 @@ if ($object->id > 0) {
// Iban
print '<td class="center"><span class="iban">';
print $obj->iban;
print dolDecrypt($obj->iban);
if ($obj->iban && $obj->bic) {
print " / ";
}
@ -1119,7 +1119,7 @@ if ($object->id > 0) {
// Iban
print '<td class="center"><span class="iban">';
print $obj->iban;
print dolDecrypt($obj->iban);
if ($obj->iban && $obj->bic) {
print " / ";
}

View File

@ -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<int<0,12>,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++;

View File

@ -1823,9 +1823,9 @@ abstract class CommonInvoice extends CommonObject
$s .= ''; // ecda public key
$s .= ''; // ecda signature of public key stamp
*/
$mysocname = $mysoc->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;

View File

@ -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";
}

View File

@ -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;
}

View File

@ -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 .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $obj->iban_prefix . ' data-bic="' . $obj->bic . '" selected>';
$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '" selected>';
} else {
$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $obj->iban_prefix . ' data-bic="' . $obj->bic . '">';
$out .= '<option value="' . $obj->rowid . '" data-iban-prefix="' . $iban . ' data-bic="' . $obj->bic . '">';
}
$out .= trim($obj->label);
if ($showibanbic) {
$out .= ' (' . $obj->iban_prefix . '/' .$obj->bic. ')';
$out .= ' (' . $iban . '/' .$obj->bic. ')';
}
$out .= '</option>';
$i++;

View File

@ -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 = '';

View File

@ -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");

View File

@ -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 = '<a '.($morecss ? 'class="'.$morecss.'" ' : '').' href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&token='.newToken().'&entity='.$entity.($mode ? '&mode='.$mode : '').($forcereload ? '&dol_resetcache=1' : '').'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
}
} 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<!-- Ajax code to switch constant ".$code." -->".'
<script>
$(document).ready(function() {
@ -669,7 +678,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
var entity = \''.dol_escape_js($entity).'\';
var strict = \''.dol_escape_js((string) $strict).'\';
var userid = \''.dol_escape_js((string) $user->id).'\';
var userconst = '.((int) $userconst).';
var userconst = '.((int) $userconstid).';
var yesButton = \''.dol_escape_js($langs->transnoentities("Yes")).'\';
var noButton = \''.dol_escape_js($langs->transnoentities("No")).'\';
var token = \''.currentToken().'\';
@ -677,7 +686,6 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
// Set constant
$("#set_" + code).click(function() {
console.log("ee");
if (warning) {
alert(warning);
}
@ -708,8 +716,8 @@ console.log("ee");
});
</script>'."\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 = '';

View File

@ -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 .= '<a href="'.dol_sanitizeUrl($link, 0).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
} else {
} elseif ($link) {
$htmllink .= '<a href="'.dol_sanitizeUrl($link, 1).'" target="_blank" rel="noopener noreferrer">'.dol_escape_htmltag($value).'</a>';
}
} 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;

View File

@ -257,7 +257,7 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att
print '<input type="hidden" name="attribute" value="'.$tmpkeyextra.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="'.$fieldid.'" value="'.$object->id.'">';
print $extrafields->showInputField($tmpkeyextra, $value, '', '', '', 0, $object->id, $object->table_element);
print $extrafields->showInputField($tmpkeyextra, $value, '', '', '', 0, $object, $object->table_element);
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Modify')).'">';

View File

@ -377,7 +377,7 @@ if ($massaction == 'edit_extrafields') {
foreach ($extrafields_list as $extraKey => $extraLabel) {
$outputShowOutputFields .= '<div class="mass-action-extrafield" data-extrafield="'.$extraKey.'" style="display:none;" >';
$outputShowOutputFields .= '<br><span>'. $langs->trans('NewValue').'</span>';
$outputShowOutputFields .= $extrafields->showInputField($extraKey, '', '', $keysuffix, '', 0, $objecttmp->id, $objecttmp->table_element);
$outputShowOutputFields .= $extrafields->showInputField($extraKey, '', '', $keysuffix, '', 0, $objecttmp, $objecttmp->table_element);
$outputShowOutputFields .= '</div>';
}
$outputShowOutputFields .= '<script>

View File

@ -483,7 +483,12 @@ class Shipments extends DolibarrApi
$this->shipment->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->shipment->array_options[$index] = $this->_checkValForAPI($field, $val, $this->shipment);
}
continue;
}
$this->shipment->$field = $this->_checkValForAPI($field, $value, $this->shipment);
}

View File

@ -1252,6 +1252,14 @@ class Expedition extends CommonObject
$this->errors[] = "Error ".$this->db->lasterror();
}
// Actions on extra fields
if (!$error) {
$result = $this->insertExtraFields();
if ($result < 0) {
$error++;
}
}
if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('SHIPPING_MODIFY', $user);

View File

@ -81,7 +81,9 @@ ALTER TABLE llx_product DROP FOREIGN KEY fk_product_default_warehouse;
DROP TABLE llx_contratdet_log;
ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(60);
ALTER TABLE llx_societe_rib MODIFY COLUMN iban_prefix varchar(80);
ALTER TABLE llx_bank_account MODIFY COLUMN iban_prefix varchar(80);
ALTER TABLE llx_user_rib MODIFY COLUMN iban_prefix varchar(80);
ALTER TABLE llx_bom_bom ADD COLUMN last_main_doc varchar(255) AFTER model_pdf;

View File

@ -39,7 +39,7 @@ create table llx_bank_account
cle_rib varchar(5),
bic varchar(11), -- 11 according to ISO 9362
bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank
iban_prefix varchar(34), -- full iban. 34 according to ISO 13616
iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information
country_iban varchar(2), -- deprecated
cle_iban varchar(2),
domiciliation varchar(255),

View File

@ -39,7 +39,7 @@ create table llx_societe_rib
bic varchar(20), -- 11 according to ISO 9362 (we keep 20 for backward compatibility)
bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank
iban_prefix varchar(60), -- full iban. 34 according to ISO 13616 ut we set 60 to allow to store it with encryption information
iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information
domiciliation varchar(255),
proprio varchar(60),

View File

@ -31,7 +31,7 @@ create table llx_user_rib
cle_rib varchar(5), -- key of bank account
bic varchar(11), -- 11 according to ISO 9362
bic_intermediate varchar(11), -- 11 according to ISO 9362. Same as bic but for intermediate bank
iban_prefix varchar(34), -- full iban. 34 according to ISO 13616
iban_prefix varchar(80), -- full iban. 34 according to ISO 13616 but we set 80 to allow to store it with encryption information
domiciliation varchar(255),
proprio varchar(60),
owner_address varchar(255),

View File

@ -225,13 +225,13 @@ if (is_array($object->lines) && (count($object->lines) > 0)) {
// We re-program the next execution and stores the last execution time for this job
$result = $cronjob->reprogram_jobs($userlogin, $now);
if ($result < 0) {
echo "Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n";
echo " - Error cronjobid: ".$line->id." cronjob->reprogram_job: ".$cronjob->error."\n";
echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n";
dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR);
exit;
exit(1);
}
echo "Job re-scheduled\n";
echo " - Job re-scheduled\n";
} else {
echo " - not qualified (datenextrunok=".($datenextrunok ?: 0).", datestartok=".($datestartok ?: 0).", dateendok=".($dateendok ?: 0).")\n";

View File

@ -99,7 +99,6 @@ if ($cancel) {
* View
*/
$form = new Form($db);
$v = new vCard();
$company = $mysoc;
@ -157,9 +156,20 @@ if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) {
}
if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
$object->socialnetworks = [];
} else {
// Show list of social networks for company
$listofnetworks = $object->socialnetworks;
if (!empty($listofnetworks)) {
foreach ($listofnetworks as $key => $networkVal) {
if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) {
unset($object->socialnetworks[$key]);
}
}
}
}
// By default, personal address not visible
// By default, personal birthdate and address is not visible
if (!getDolUserInt('USER_PUBLIC_SHOW_BIRTH', 0, $object)) {
$object->birth = null;
}
@ -174,10 +184,32 @@ if (!getDolUserInt('USER_PUBLIC_SHOW_ADDRESS', 0, $object)) {
if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
$company = null;
}
if (getDolUserInt('SOCIETE_PUBLIC_HIDE_EMAIL', 0, $object)) {
$mysoc->email = '';
}
if (getDolUserInt('SOCIETE_PUBLIC_HIDE_OFFICE_PHONE', 0, $object)) {
$mysoc->phone = '';
}
if (getDolUserInt('SOCIETE_PUBLIC_HIDE_OFFICE_FAX', 0, $object)) {
$mysoc->fax = '';
}
if (getDolUserInt('SOCIETE_PUBLIC_HIDE_URL', 0, $object)) {
$mysoc->url = '';
}
if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object) && is_object($company)) {
$company->socialnetworks = [];
}
} else {
// Show list of social networks for company
$listofnetworks = $mysoc->socialnetworks;
if (!empty($listofnetworks)) {
foreach ($listofnetworks as $key => $networkVal) {
if (getDolUserInt('SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) {
unset($mysoc->socialnetworks[$key]);
}
}
}
}
// Output vcard
if ($mode == 'vcard') {
@ -220,7 +252,7 @@ $arrayofjs = array();
$arrayofcss = array();
$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1);
llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'onlinepaymentbody'.(GETPOST('mode') == 'preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1);
print '
<style>
@ -351,10 +383,10 @@ if (getDolUserInt('USER_PUBLIC_SHOW_ADDRESS', 0, $object) && $object->address) {
// Social networks
if (!empty($object->socialnetworks) && is_array($object->socialnetworks)) {
if (!getDolGlobalInt('USER_PUBLIC_HIDE_SOCIALNETWORKS')) {
if (!getDolUserString('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) {
$listOfSocialNetworks = $object->socialnetworks;
foreach ($listOfSocialNetworks as $key => $value) {
if (getDolGlobalString('USER_SOCIALNETWORK_'.strtoupper($key))) {
if (!getDolUserString('USER_HIDE_SOCIALNETWORK_'.strtoupper($key), 0, $object)) {
$usersection .= '<div class="flexitemsmall">'.dol_print_socialnetworks($key, 0, $object->id, strtolower($key), $socialnetworksdict).'</div>';
}
}
@ -424,9 +456,9 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) {
// Social networks
if (!empty($mysoc->socialnetworks) && is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) {
if (!getDolGlobalInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0)) {
if (!getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object)) {
foreach ($mysoc->socialnetworks as $key => $value) {
if (getDolGlobalString('SOCIETE_PUBLIC_SOCIALNETWORKS_'.strtoupper($key))) {
if (!getDolUserInt('SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) {
$companysection .= '<div class="flexitemsmall wordbreak">'.dol_print_socialnetworks($value, 0, $mysoc->id, $key, $socialnetworksdict).'</div>';
}
}

View File

@ -1410,6 +1410,7 @@ class Thirdparties extends DolibarrApi
$num = $this->db->num_rows($result);
while ($i < $num) {
$obj = $this->db->fetch_object($result);
$account = new CompanyBankAccount($this->db);
if ($account->fetch($obj->rowid)) {
$accounts[] = $account;

View File

@ -407,6 +407,8 @@ class CompanyPaymentMode extends CommonObject
$result = $this->fetchCommon($id, $ref, $morewhere);
$this->iban_prefix = dolDecrypt($this->iban_prefix);
// For backward compatibility
$this->iban = $this->iban_prefix;
$this->date_modification = $this->tms;

View File

@ -3175,7 +3175,7 @@ class Societe extends CommonObject
*/
public function getTypeUrl($withpicto = 0, $option = '', $notooltip = 0, $tag = 'a')
{
global $conf, $langs;
global $langs;
$s = '';
if (empty($option) || preg_match('/prospect/', $option)) {
@ -5294,7 +5294,7 @@ class Societe extends CommonObject
$dbs->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.((int) $obj->rowid));
}
// llx_societe_extrafields table must not be here because we don't care about the old thirdparty extrafields that are managed directly into mergeCompany.
// The table llx_societe_extrafields must NOT be in this list because we don't care about the old thirdparty extrafields that are managed directly into mergeCompany.
// Do not include llx_societe because it will be replaced later.
$tables = array(
'societe_account',
@ -5305,6 +5305,8 @@ class Societe extends CommonObject
'societe_rib'
);
// TODO When we merge societe_account, we may get 2 lines for the stripe account. Must fix this.
return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
}

View File

@ -359,7 +359,7 @@ class SocieteAccount extends CommonObject
$sql .= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status);
$sql .= " AND sa.key_account IS NOT NULL AND sa.key_account <> ''";
$sql .= " AND (sa.site_account = '' OR sa.site_account IS NULL OR sa.site_account = '".$this->db->escape($site_account)."')";
$sql .= " ORDER BY sa.site_account DESC"; // To get the entry with a site_account defined in priority
$sql .= " ORDER BY sa.site_account DESC, sa.rowid DESC"; // To get the entry with a site_account defined in priority
dol_syslog(get_class($this)."::getCustomerAccount Try to find the first system customer id for ".$site." of thirdparty id=".$id." (example: cus_.... for stripe)", LOG_DEBUG);
$result = $this->db->query($sql);
@ -396,6 +396,7 @@ class SocieteAccount extends CommonObject
$sql .= " AND sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.site = '".$this->db->escape($site)."' AND sa.status = ".((int) $status);
$sql .= " AND sa.fk_soc > 0";
$sql .= " ORDER BY sa.site_account DESC, sa.rowid DESC"; // To get the entry with a site_account defined in priority
dol_syslog(get_class($this)."::getCustomerAccount Try to find the first thirdparty id for ".$site." for external id=".$id, LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -666,16 +666,18 @@ if (empty($reshook)) {
$db->begin();
if (empty($newcu)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($tmpsite_account)."') AND fk_soc = ".$object->id." AND status = ".((int) $tmpservicestatus)." AND entity = ".$conf->entity;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account";
$sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($tmpsite_account)."') AND fk_soc = ".((int) $object->id)." AND status = ".((int) $tmpservicestatus)." AND entity = ".$conf->entity;
} else {
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX."societe_account";
$sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($tmpsite_account)."') AND fk_soc = ".((int) $object->id)." AND status = ".((int) $tmpservicestatus)." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified !
$sql .= " WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($tmpsite_account)."') AND fk_soc = ".((int) $object->id)." AND status = ".((int) $tmpservicestatus)." AND entity = ".$conf->entity; // Keep the = here for entity. Only 1 record must be modified !
}
$resql = $db->query($sql);
$num = $db->num_rows($resql); // Note: $num is always 0 on an update and delete, it is defined for select only.
if (!empty($newcu)) {
if (empty($num)) {
if (!empty($newcu)) { // If we did a select
if (empty($num)) { // and found nothing
$societeaccount = new SocieteAccount($db);
$societeaccount->fk_soc = $object->id;
$societeaccount->login = '';
@ -733,7 +735,7 @@ if (empty($reshook)) {
$db->begin();
if (empty($newsup)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".$object->id." AND service = '".$db->escape($tmpservice)."' AND entity = ".$conf->entity;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".((int) $object->id)." AND service = '".$db->escape($tmpservice)."' AND entity = ".((int) $conf->entity);
// TODO Add site and site_account on oauth_token table
//$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE site = 'stripe' AND (site_account IS NULL or site_account = '".$db->escape($site_account)."') AND fk_soc = ".((int) $object->id)." AND service = '".$db->escape($service)."' AND entity = ".$conf->entity;
} else {

View File

@ -198,6 +198,7 @@ class Stripe extends CommonObject
$sql .= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
$sql .= " AND (sa.site_account IS NULL OR sa.site_account = '' OR sa.site_account = '".$this->db->escape($stripearrayofkeysbyenv[$status]['publishable_key'])."')";
$sql .= " AND sa.key_account IS NOT NULL AND sa.key_account <> ''";
$sql .= " ORDER BY sa.site_account DESC, sa.rowid DESC"; // To get the entry with a site_account defined in priority
dol_syslog(get_class($this)."::customerStripe search stripe customer id for thirdparty id=".$object->id, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -1097,6 +1098,7 @@ class Stripe extends CommonObject
$sepa = $s->paymentMethods->create($dataforcard);
if (!$sepa) {
$this->error = 'Creation of payment method sepa_debit on Stripe has failed';
dol_syslog($this->error, LOG_ERR);
} else {
// link customer and src
//$cs = $this->getSetupIntent($description, $soc, $cu, '', $status);
@ -1109,6 +1111,7 @@ class Stripe extends CommonObject
if (!$cs) {
$this->error = 'Link SEPA <-> Customer failed';
dol_syslog($this->error, LOG_ERR);
} else {
dol_syslog("Update the payment mode of the customer");
@ -1188,6 +1191,7 @@ class Stripe extends CommonObject
$sql .= " WHERE sa.key_account = '".$this->db->escape($customer)."'";
//$sql.= " AND sa.entity IN (".getEntity('societe').")";
$sql .= " AND sa.site = 'stripe' AND sa.status = ".((int) $status);
$sql .= " ORDER BY sa.site_account DESC, sa.rowid DESC"; // To get the entry with a site_account defined in priority
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);

View File

@ -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;

View File

@ -5395,9 +5395,11 @@ div.info, div.warning, div.error {
div.info {
border-<?php print $left; ?>: 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 */

View File

@ -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;

View File

@ -131,7 +131,7 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>';
$enabledisablehtml .= '<br><br><span class="opacitymedium">'.$langs->trans("UserPublicPageDesc").'</span><br><br>';
$enabledisablehtml .= '<br><br><div class="opacitymedium justify">'.$langs->trans("UserPublicPageDesc").'</div>';
} else {
// Button on, click to disable
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setUSER_ENABLE_PUBLIC&token='.newToken().'&value=0'.$param.'">';
@ -139,13 +139,14 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
$enabledisablehtml .= '</a>';
}
print $enabledisablehtml;
print '<input type="hidden" id="USER_ENABLE_PUBLIC" name="USER_ENABLE_PUBLIC" value="'.(getDolGlobalString('USER_ENABLE_PUBLIC') ? 1 : 0).'">';
print '<input type="hidden" id="USER_ENABLE_PUBLIC" name="USER_ENABLE_PUBLIC" value="'.(getDolUserInt('USER_ENABLE_PUBLIC') ? 1 : 0).'">';
print '<br><br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
print '<br><br>';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -216,60 +217,59 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Photo"));
print '</td><td>';
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 "</td></tr>\n";
// Job position
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PostOrFunction"));
print '</td><td>';
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 "</td></tr>\n";
// Email
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Email"));
print '</td><td>';
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 "</td></tr>\n";
// Office phone
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhonePro"));
print '</td><td>';
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 "</td></tr>\n";
// Office fax
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Fax"));
print '</td><td>';
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 "</td></tr>\n";
// User mobile
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhoneMobile"));
print '</td><td>';
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 "</td></tr>\n";
// Social networks
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation"));
print '</td><td>';
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 "</td></tr>\n";
// Show list of socialnetworks for user
if ($showUserSocialNetworks) {
$socialnetworks = $object->socialnetworks;
if (!empty($socialnetworks)) {
foreach ($socialnetworks as $key => $networkVal) {
print '<tr class="oddeven">';
print '<td> &nbsp; &nbsp; '.$langs->trans("Hide").' '.dol_escape_htmltag($key).'</td><td>';
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 '</td>';
print "</tr>";
}
@ -280,14 +280,14 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("Birthdate"));
print '</td><td>';
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 "</td></tr>\n";
// Address
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("Address"));
print '</td><td>';
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 "</td></tr>\n";
print '<tr class="liste_titre">';
@ -299,18 +299,46 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) {
print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection"));
print '</td><td>';
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 "</td></tr>\n";
if (!getDolUserString('USER_PUBLIC_HIDE_COMPANY', '', $object)) {
// Email
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Email"));
print '</td><td>';
print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_EMAIL", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object);
print "</td></tr>\n";
// URL
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("URL"));
print '</td><td>';
print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_URL", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object);
print "</td></tr>\n";
// Office phone
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Phone"));
print '</td><td>';
print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_OFFICE_PHONE", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object);
print "</td></tr>\n";
// Office fax
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Fax"));
print '</td><td>';
print ajax_constantonoff("SOCIETE_PUBLIC_HIDE_OFFICE_FAX", array(), null, 0, 0, 1, 2, 0, 0, '', '', 'reposition', $object);
print "</td></tr>\n";
// Social networks
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation"));
print '</td><td>';
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 "</td></tr>\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 '<tr class="oddeven">';
print '<td> &nbsp; &nbsp; '.$langs->trans("Hide").' '.dol_escape_htmltag($key).'</td><td>';
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 '</td>';
print "</tr>";
}

View File

@ -1,8 +1,9 @@
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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;

View File

@ -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'));

View File

@ -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'));

View File

@ -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);

View File

@ -1,7 +1,8 @@
#!/usr/bin/env php
<?php
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
/* Copyright (C) 2007-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean Heimburger <http://tiaris.eu>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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.

View File

@ -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;

View File

@ -208,11 +208,11 @@ class FunctionsLibTest extends CommonClassTest
}
/**
* testDolForgeCriteriaCallback
* testDolForgeSQLCriteriaCallback
*
* @return boolean
*/
public function testDolForgeCriteriaCallback()
public function testDolForgeSQLCriteriaCallback()
{
global $conf, $langs, $db;