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

This commit is contained in:
Laurent Destailleur 2022-09-23 18:53:18 +02:00
commit a87aa30e75
19 changed files with 61 additions and 27 deletions

View File

@ -623,7 +623,7 @@ if ($user->hasRight('adherent', 'creer')) {
if ($user->rights->adherent->supprimer) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->societe->creer) {
if (isModEnabled('category') && $user->rights->adherent->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if ($user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) {

View File

@ -395,7 +395,7 @@ $arrayofmassactions = array(
if ($user->rights->agenda->allactions->delete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->agenda->myactions->create) {
if (isModEnabled('category') && $user->rights->agenda->myactions->create) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) {

View File

@ -79,7 +79,7 @@ if ($tmp) {
*/
if (isModEnabled("propal")) {
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc";
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.email, s.entity, s.code_compta";
$sql .= ", s.rowid as socid, s.nom as name, s.client, s.canvas, s.code_client, s.code_fournisseur, s.email, s.entity, s.code_compta";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (empty($user->rights->societe->client->voir) && !$socid) {

View File

@ -304,7 +304,7 @@ $arrayofmassactions = array(
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->banque->modifier) {
if (isModEnabled('category') && $user->rights->banque->modifier) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {

View File

@ -136,15 +136,25 @@ class Facture extends CommonInvoice
/**
* @var int Date expected for delivery
* @deprecated
* @see delivery_date
*/
public $date_livraison; // deprecated; Use delivery_date instead.
public $date_livraison;
/**
* @var int Date expected for delivery
*/
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
/**
* @var string customer ref
* @deprecated
* @see ref_customer
*/
public $ref_client;
/**
* @var string customer ref
*/
public $ref_client; // deprecated; use ref_customer instead
public $ref_customer;
//Check constants for types

View File

@ -693,7 +693,7 @@ $arrayofmassactions = array(
if ($user->hasRight('societe', 'supprimer')) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->societe->creer) {
if (isModEnabled('category') && $user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {

View File

@ -258,14 +258,16 @@ class modAccounting extends DolibarrModules
$this->export_label[$r] = 'Chartofaccounts';
$this->export_icon[$r] = $this->picto;
$this->export_permission[$r] = array(array("accounting", "chartofaccount"));
$this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status');
$this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status');
$this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa.accountparent'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting");
$this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status');
$this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status');
$this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa2.account_number'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting");
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa';
$this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_system as ac';
$this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') ';
$this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_account as aa2';
$this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').')';
$this->export_sql_end[$r] .= ' AND aa2.rowid = aa.account_parent AND aa2.active = 1 AND ac.pcg_version = aa2.fk_pcg_version AND aa2.entity IN ('.getEntity('accounting').')';
// Imports

View File

@ -100,7 +100,7 @@ class modCron extends DolibarrModules
$this->cronjobs = array(
0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'tempfilesold+logfiles', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>'in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendDumpDatabase', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendBackup', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
3=>array('entity'=>0, 'label'=>'CleanUnfinishedCronjobShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'cleanUnfinishedCronjob', 'parameters'=>'', 'comment'=>'CleanUnfinishedCronjob', 'frequency'=>5, 'unitfrequency'=>60, 'priority'=>10, 'status'=>0, 'test'=>'getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 2'),
// 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)
);

View File

@ -40,7 +40,7 @@ if ($massaction == 'predelete') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
}
if ($massaction == 'preaffecttag') {
if ($massaction == 'preaffecttag' && isModEnabled('category')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$categ = new Categorie($db);
$categ_types = array();

View File

@ -182,8 +182,6 @@ if (empty($reshook)) {
$object->date = $donation_date;
$object->public = $public_donation;
$object->fk_project = (int) GETPOST("fk_project", 'int');
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
// Fill array 'array_options' with data from add form

View File

@ -2069,6 +2069,7 @@ class ExpenseReport extends CommonObject
if ($this->status == self::STATUS_DRAFT || $this->status == self::STATUS_REFUSED) {
$this->db->begin();
$error = 0;
$type = 0; // TODO What if type is service ?
// We don't know seller and buyer for expense reports
@ -2152,10 +2153,13 @@ class ExpenseReport extends CommonObject
$this->applyOffset();
$this->checkRules();
$error = 0;
$result = $this->line->update($user);
if ($result > 0 && !$notrigger) {
$result = $this->line->update($user);
if ($result < 0) {
$error++;
}
if (!$error && !$notrigger) {
// Call triggers
$result = $this->call_trigger('EXPENSE_REPORT_DET_MODIFY', $user);
if ($result < 0) {
@ -2164,7 +2168,7 @@ class ExpenseReport extends CommonObject
// End call triggers
}
if ($result > 0 && $error == 0) {
if (!$error) {
$this->db->commit();
return 1;
} else {

View File

@ -427,7 +427,7 @@ if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->knowledgemanagement->knowledgerecord->write) {
if (isModEnabled('category') && $user->rights->knowledgemanagement->knowledgerecord->write) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}

View File

@ -251,6 +251,13 @@ foreach ($search as $key => $val) {
$sql .= natural_search('moparent.ref', $search[$key], 0);
continue;
}
if ($key == 'status') {
$sql .= natural_search('t.status', $search[$key], 0);
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {

View File

@ -57,7 +57,7 @@ if (empty($reshook)) {
print '<a class="objectlinked_importbtn" href="' . $objectlink->getNomUrl(0, '', 0, 1) . '&amp;action=selectlines" data-element="' . $objectlink->element . '" data-id="' . $objectlink->id . '" > <i class="fa fa-indent"></i> </a';
}
echo '</td>';
echo '<td class="linkedcol-name nowraponall" >' . $objectlink->getNomUrl(1) . '</td>';
echo '<td class="linkedcol-name nowraponall">'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="linkedcol-ref" align="center">';
// $result = $product_static->fetch($objectlink->fk_product);
@ -66,8 +66,19 @@ if (empty($reshook)) {
echo '<td class="linkedcol-amount right">-</td>';
echo '<td class="linkedcol-statut right">' . $objectlink->getLibStatut(3) . '</td>';
echo '<td class="linkedcol-action right">';
// For now, shipments must stay linked to order, so link is not deletable
echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $key . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>';
// we want to make the link via element_element for delete action
$sql = " Select rowid from " . MAIN_DB_PREFIX . "element_element";
$sql .= " WHERE fk_source = ". (int) $object->id . " and fk_target = '" . dol_escape_htmltag($key) ."'";
$resql = $db->query($sql);
$k = 0;
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj->rowid && $obj->rowid > 0 ) $k = $obj->rowid;
}
echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>';
echo '</td>';
echo "</tr>\n";
}

View File

@ -744,6 +744,8 @@ if ($resql) {
if ($user->rights->{$rightskey}->creer) {
$arrayofmassactions['switchonsalestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnSaleStatus");
$arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus");
}
if (isModEnabled('category') && $user->rights->{$rightskey}->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_extrafields'))) {

View File

@ -383,7 +383,7 @@ $arrayofmassactions = array(
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
$arrayofmassactions = array();
}
if ($user->rights->stock->creer) {
if (isModEnabled('category') && $user->rights->stock->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'label', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);

View File

@ -785,7 +785,7 @@ if ($user->rights->projet->creer) {
if ($user->rights->projet->supprimer) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if ($user->rights->projet->creer) {
if (isModEnabled('category') && $user->rights->projet->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if (in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {

View File

@ -883,7 +883,7 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if ($user->rights->societe->creer) {
if (isModEnabled('category') && $user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if ($user->rights->societe->creer) {

View File

@ -588,7 +588,7 @@ if ($permissiontoadd) {
if ($permissiontoadd) {
$arrayofmassactions['reactivate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Reactivate");
}
if ($permissiontoadd) {
if (isModEnabled('category') && $permissiontoadd) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
//if ($permissiontodelete) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");