Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/ecm/file_card.php
This commit is contained in:
Laurent Destailleur 2020-12-27 21:00:07 +01:00
commit 4a8e72c997
14 changed files with 37 additions and 15 deletions

View File

@ -50,6 +50,13 @@ Replace call to serialize_val with no bugged value
* In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct * In all files, replace constructor names into __construct. Replace also parent::constructor_name with parent::__construct
* Line 4222 of file nusoap.php
$rev = array();
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
TCPDF: TCPDF:

View File

@ -314,7 +314,6 @@ if ($action != 'export_csv')
if (empty($accountingaccountstatic->account_number)) { if (empty($accountingaccountstatic->account_number)) {
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>'; $link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>';
} }
print '<tr class="oddeven">';
if (!empty($show_subgroup)) if (!empty($show_subgroup))
{ {
@ -343,6 +342,7 @@ if ($action != 'export_csv')
} }
} }
print '<tr class="oddeven">';
print '<td>'.$accounting_account.'</td>'; print '<td>'.$accounting_account.'</td>';
print '<td class="nowraponall right">'.price($opening_balance).'</td>'; print '<td class="nowraponall right">'.price($opening_balance).'</td>';
print '<td class="nowraponall right">'.price($line->debit).'</td>'; print '<td class="nowraponall right">'.price($line->debit).'</td>';

View File

@ -263,6 +263,7 @@ class modCommande extends DolibarrModules
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande'; $this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_commande';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('commande').')'; $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('commande').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id); if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
// Imports // Imports
//-------- //--------
$r = 0; $r = 0;

View File

@ -306,7 +306,7 @@ class modExpedition extends DolibarrModules
} }
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid'; $this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('expedition').')'; $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('expedition').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
} }

View File

@ -291,7 +291,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')'; $this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')';
if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
$r++; $r++;
@ -371,7 +371,7 @@ class modFacture extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON ba.rowid = b.fk_account';
$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid'; $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid';
$this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')'; $this->export_sql_end[$r] .= ' AND f.entity IN ('.getEntity('invoice').')';
if (isset($user) && empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
$r++; $r++;
} }

View File

@ -254,7 +254,7 @@ class modPropale extends DolibarrModules
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; $this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')'; $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
// Imports // Imports
//-------- //--------

View File

@ -231,7 +231,7 @@ class modReception extends DolibarrModules
} }
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_reception AND ed.fk_commandefourndet = cd.rowid'; $this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_reception AND ed.fk_commandefourndet = cd.rowid';
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('reception').')'; $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('reception').')';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
} }

View File

@ -71,7 +71,7 @@ if (!$section) {
dol_print_error('', 'Error, section parameter missing'); dol_print_error('', 'Error, section parameter missing');
exit; exit;
} }
$urlfile = GETPOST("urlfile"); $urlfile = (string) dol_sanitizePathName(GETPOST("urlfile"));
if (!$urlfile) { if (!$urlfile) {
dol_print_error('', "ErrorParamNotDefined"); dol_print_error('', "ErrorParamNotDefined");
exit; exit;

View File

@ -4219,8 +4219,10 @@ class nusoap_server extends nusoap_base {
$payload .= $this->getDebugAsXMLComment(); $payload .= $this->getDebugAsXMLComment();
} }
$this->outgoing_headers[] = "Server: $this->title Server v$this->version"; $this->outgoing_headers[] = "Server: $this->title Server v$this->version";
preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); // @CHANGE Fix for php8
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")"; $rev = array();
preg_match('/\$Revision: ([^ ]+)/', $this->revision, $rev);
$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".(isset($rev[1]) ? $rev[1] : '').")";
// Let the Web server decide about this // Let the Web server decide about this
//$this->outgoing_headers[] = "Connection: Close\r\n"; //$this->outgoing_headers[] = "Connection: Close\r\n";
$payload = $this->getHTTPBody($payload); $payload = $this->getHTTPBody($payload);

View File

@ -4332,6 +4332,14 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo
$mod->remove('noboxes'); $mod->remove('noboxes');
$mod->init($reloadmode); $mod->init($reloadmode);
} }
} elseif ($moduletoreload == 'MAIN_MODULE_EXTERNALSITE') {
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate ExternalSite module");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modExternalSite.class.php';
if ($res) {
$mod = new modExternalSite($db);
$mod->remove('noboxes');
$mod->init($reloadmode);
}
} elseif ($moduletoreload == 'MAIN_MODULE_SOCIETE') { } elseif ($moduletoreload == 'MAIN_MODULE_SOCIETE') {
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module"); dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php'; $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php';

View File

@ -2651,14 +2651,14 @@ class Product extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
$sql .= ", ".MAIN_DB_PREFIX."commande as c"; $sql .= ", ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
} }
$sql .= " WHERE c.rowid = cd.fk_commande"; $sql .= " WHERE c.rowid = cd.fk_commande";
$sql .= " AND c.fk_soc = s.rowid"; $sql .= " AND c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'commande').")"; $sql .= " AND c.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'commande').")";
$sql .= " AND cd.fk_product = ".$this->id; $sql .= " AND cd.fk_product = ".$this->id;
if (!$user->rights->societe->client->voir && !$socid && !$forVirtualStock) { if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
} }
if ($socid > 0) { if ($socid > 0) {

View File

@ -261,6 +261,9 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$rightskey = 'produit';
if ($type == Product::TYPE_SERVICE) $rightskey = 'service';
if (empty($reshook)) if (empty($reshook))
{ {
// Selection of new fields // Selection of new fields
@ -299,8 +302,8 @@ if (empty($reshook))
if ((string) $search_type == '1') { $objectlabel = 'Services'; } if ((string) $search_type == '1') { $objectlabel = 'Services'; }
if ((string) $search_type == '0') { $objectlabel = 'Products'; } if ((string) $search_type == '0') { $objectlabel = 'Products'; }
$permissiontoread = $user->rights->produit->lire; $permissiontoread = $user->rights->{$rightskey}->lire;
$permissiontodelete = $user->rights->produit->supprimer; $permissiontodelete = $user->rights->{$rightskey}->supprimer;
$uploaddir = $conf->product->dir_output; $uploaddir = $conf->product->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
@ -530,6 +533,7 @@ if ($resql)
//'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
); );
$rightskey = 'produit'; $rightskey = 'produit';
if ($type == Product::TYPE_SERVICE) $rightskey = 'service'; if ($type == Product::TYPE_SERVICE) $rightskey = 'service';
if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete"); if ($user->rights->{$rightskey}->supprimer) $arrayofmassactions['predelete'] = "<span class='fa fa-trash paddingrightonly'></span>".$langs->trans("Delete");

View File

@ -454,7 +454,7 @@ $arrayofmassactions = array(
); );
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->projet->creer) $arrayofmassactions['close'] = $langs->trans("Close"); if ($user->rights->projet->creer) $arrayofmassactions['close'] = $langs->trans("Close");
if ($user->rights->societe->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); if ($user->rights->projet->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);

View File

@ -204,7 +204,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase
print $soapclient->response; print $soapclient->response;
print "\n"; print "\n";
} }
print var_export($result, true);
print __METHOD__." count(result)=".(is_array($result) ? count($result) : '')."\n"; print __METHOD__." count(result)=".(is_array($result) ? count($result) : '')."\n";
$this->assertEquals('OK', $result['result']['result_code']); $this->assertEquals('OK', $result['result']['result_code']);