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

Conflicts:
	htdocs/categories/viewcat.php
This commit is contained in:
Laurent Destailleur 2021-02-06 01:17:05 +01:00
commit fd3354142b
14 changed files with 89 additions and 37 deletions

View File

@ -643,7 +643,7 @@ class Setup extends DolibarrApi
public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking";
$sql = "SELECT t.rowid, t.code, t.libelle as label, t.description, t.tracking";
$sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t";
$sql .= " WHERE t.active = ".$active;
// Add sql filters

View File

@ -287,16 +287,19 @@ print dol_get_fiche_end();
*/
print "<div class='tabsAction'>\n";
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $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 (empty($reshook)) {
if ($user->rights->categorie->creer)
{
$socid = ($object->socid ? "&socid=".$object->socid : "");
print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->categorie->creer)
{
$socid = ($object->socid ? "&socid=".$object->socid : "");
print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
}
if ($user->rights->categorie->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").'</a>';
if ($user->rights->categorie->supprimer)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").'</a>';
}
}
print "</div>";

View File

@ -148,7 +148,7 @@ llxHeader('', $langs->trans('ListPayment'));
if (GETPOST("orphelins", "alpha")) {
// Payments not linked to an invoice. Should not happend. For debug only.
$sql = "SELECT p.ref, p.datep, p.amount, p.statut, p.num_paiement";
$sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement";
$sql .= ", c.code as paiement_code";
// Add fields from hooks
@ -166,7 +166,7 @@ if (GETPOST("orphelins", "alpha")) {
$sql .= $hookmanager->resPrint;
} else {
// DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql = "SELECT DISTINCT p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement";
$sql .= ", c.code as paiement_code";
$sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
@ -390,7 +390,7 @@ while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
$object->id = $objp->rowid;
$object->ref = $objp->ref;
$object->ref = ($objp->ref ? $objp->ref : $objp->rowid);
$companystatic->id = $objp->socid;
$companystatic->name = $objp->name;
@ -497,6 +497,14 @@ while ($i < min($num, $limit)) {
// Show total line
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
// If no record found
if ($num == 0)
{
$colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
print "</table>";
print "</div>";
print "</form>";

View File

@ -98,7 +98,13 @@ if (empty($reshook))
// Seems to no be used and replaced with $action == 'infocredit'
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes')
{
$res = $object->set_credite();
if ($object->statut == 2) {
$res = -1;
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
} else {
$res = $object->set_credite();
}
if ($res >= 0)
{
header("Location: card.php?id=".$id);
@ -145,10 +151,16 @@ if (empty($reshook))
{
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$error = $object->set_infocredit($user, $dt);
if ($object->statut == 2) {
$error = 1;
setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors');
} else {
$error = $object->set_infocredit($user, $dt);
}
if ($error)
{
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

View File

@ -43,7 +43,11 @@ function import_prepare_head($param, $maxstep = 0)
$i = 1;
while ($i <= $maxstep)
{
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
if ($i < 6) {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param;
} else {
$head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5
}
$head[$h][1] = $langs->trans("Step")." ".$i;
$head[$h][2] = 'step'.$i;
$h++;

View File

@ -618,6 +618,7 @@ class ImportCsv extends ModeleImports
if (!empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{
// If test is "Must exist in a field@table or field@table:..."
$reg = array();
if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
{
$field = $reg[1];
@ -844,7 +845,7 @@ class ImportCsv extends ModeleImports
$sqlend .= ', '.$user->id;
}
$sql = $sqlstart.$sqlend.')';
dol_syslog("import_csv.modules", LOG_DEBUG);
//dol_syslog("import_csv.modules", LOG_DEBUG);
// Run insert request
if ($sql)

View File

@ -636,6 +636,7 @@ class ImportXlsx extends ModeleImports
// Test regexp
if (!empty($objimport->array_import_regex[0][$val]) && ($newval != '')) {
// If test is "Must exist in a field@table or field@table:..."
$reg = array();
if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) {
$field = $reg[1];
$table = $reg[2];
@ -845,7 +846,7 @@ class ImportXlsx extends ModeleImports
$sqlend .= ', ' . $user->id;
}
$sql = $sqlstart . $sqlend . ')';
dol_syslog("import_xlsx.modules", LOG_DEBUG);
//dol_syslog("import_xlsx.modules", LOG_DEBUG);
// Run insert request
if ($sql) {

View File

@ -1255,6 +1255,14 @@ if ($step == 4 && $datatoimport)
// STEP 5: Summary of choices and launch simulation
if ($step == 5 && $datatoimport)
{
$max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_importexport)
{
dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically.");
@ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300
}
$model = $format;
$liste = $objmodelimport->liste_modeles($db);
@ -1518,14 +1526,6 @@ if ($step == 5 && $datatoimport)
}
print '</div>';
} else {
$max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_importexport)
{
dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically.");
@ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300
}
// Launch import
$arrayoferrors = array();
$arrayofwarnings = array();
@ -1603,8 +1603,10 @@ if ($step == 5 && $datatoimport)
// Show OK
if (!count($arrayoferrors) && !count($arrayofwarnings)) {
print '<div class="center">'.img_picto($langs->trans("OK"), 'tick').' <b>'.$langs->trans("NoError").'</b></div><br><br>';
print $langs->trans("NbInsert", $obj->nbinsert).'<br>';
print $langs->trans("NbUpdate", $obj->nbupdate).'<br><br>';
print '<div class="ok">';
print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'<br>';
print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'<br><br>';
print '</div>';
} else print $langs->trans("NbOfLinesOK", $nbok).'<br><br>';
// Show Errors
@ -1692,9 +1694,17 @@ if ($step == 5 && $datatoimport)
// STEP 6: Real import
if ($step == 6 && $datatoimport)
{
$max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_importexport)
{
dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically.");
@ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300
}
$model = $format;
$liste = $objmodelimport->liste_modeles($db);
$importid = $_REQUEST["importid"];
$importid = GETPOST("importid", 'alphanohtml');
// Create classe to use for import
@ -1970,12 +1980,14 @@ if ($step == 6 && $datatoimport)
// Show result
print '<br>';
print '<div class="center">';
print '<div class="ok">';
print $langs->trans("NbOfLinesImported", $nbok).'</b><br>';
print $langs->trans("NbInsert", $obj->nbinsert).'<br>';
print $langs->trans("NbUpdate", $obj->nbupdate).'<br><br>';
print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'<br>';
print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'<br><br>';
print '</div>';
print '<div class="center">';
print $langs->trans("FileWasImported", $importid).'<br>';
print $langs->trans("YouCanUseImportIdToFindRecord", $importid).'<br>';
print '<span class="opacitymedium">'.$langs->trans("YouCanUseImportIdToFindRecord", $importid).'</span><br>';
print '</div>';
}

View File

@ -444,8 +444,8 @@ ExtrafieldParamHelpPassword=Leaving this field blank means this value will be st
ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>code3,value3<br>...<br><br>In order to have the list depending on another complementary attribute list:<br>1,value1|options_<i>parent_list_code</i>:parent_key<br>2,value2|options_<i>parent_list_code</i>:parent_key <br><br>In order to have the list depending on another list:<br>1,value1|<i>parent_list_code</i>:parent_key<br>2,value2|<i>parent_list_code</i>:parent_key
ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')<br><br> for example: <br>1,value1<br>2,value2<br>3,value3<br>...
ExtrafieldParamHelpsellist=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filter<br>Example: c_typent:libelle:id::filter<br><br>- id_field is necessarly a primary int key<br>- filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter which is the current id of current object<br>To use a SELECT into the filter use the keyword $SEL$ to bypass anti-injection protection.<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelpchkbxlst=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filter<br>Example: c_typent:libelle:id::filter<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelpsellist=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filtersql<br>Example: c_typent:libelle:id::filtersql<br><br>- id_field is necessarly a primary int key<br>- filtersql is a SQL condition. It can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter which is the current id of current object<br>To use a SELECT into the filter use the keyword $SEL$ to bypass anti-injection protection.<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelpchkbxlst=List of values comes from a table<br>Syntax: table_name:label_field:id_field::filtersql<br>Example: c_typent:libelle:id::filtersql<br><br>filter can be a simple test (eg active=1) to display only active value<br>You can also use $ID$ in filter witch is the current id of current object<br>To do a SELECT in filter use $SEL$<br>if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)<br><br>In order to have the list depending on another complementary attribute list:<br>c_typent:libelle:id:options_<i>parent_list_code</i>|parent_column:filter <br><br>In order to have the list depending on another list:<br>c_typent:libelle:id:<i>parent_list_code</i>|parent_column:filter
ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath<br>Syntax: ObjectName:Classpath
ExtrafieldParamHelpSeparator=Keep empty for a simple separator<br>Set this to 1 for a collapsing separator (open by default for new session, then status is kept for each user session)<br>Set this to 2 for a collapsing separator (collapsed by default for new session, then status is kept fore each user session)
LibraryToBuildPDF=Library used for PDF generation

View File

@ -45,6 +45,7 @@ WithdrawRequestsDone=%s direct debit payment requests recorded
BankTransferRequestsDone=%s credit transfer requests recorded
ThirdPartyBankCode=Third-party bank code
NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode <strong>%s</strong>.
WithdrawalCantBeCreditedTwice=This withdrawal receipt is already marked as credited; this can't be done twice, as this would potentially create duplicate payments and bank entries.
ClassCredited=Classify credited
ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account?
TransData=Transmission date

View File

@ -45,6 +45,7 @@ WithdrawRequestsDone=%s demandes de prélèvements enregistrées
BankTransferRequestsDone=%s demande de prélèvement enregistrée
ThirdPartyBankCode=Code banque du tiers
NoInvoiceCouldBeWithdrawed=Aucune facture traitée avec succès. Vérifiez que les factures sont sur les sociétés avec un BAN par défaut valide et que le BAN a un RUM avec le mode <strong> %s </strong>.
WithdrawalCantBeCreditedTwice=Ce bon de prélèvement est déjà classé crédité; cette opération ne peut pas être réalisée deux fois, car cela pourrait engendrer des doublons dans les paiements et les écritures bancaires.
ClassCredited=Classer crédité
ClassCreditedConfirm=Êtes-vous sûr de vouloir classer ce bon de prélèvement comme crédité sur votre compte bancaire ?
TransData=Date de transmission

View File

@ -203,7 +203,7 @@ class MyModuleApi extends DolibarrApi
foreach ($request_data as $field => $value) {
$this->myobject->$field = $value;
}
if (!$this->myobject->create(DolibarrApiAccess::$user)) {
if ($this->myobject->create(DolibarrApiAccess::$user)<0) {
throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors));
}
return $this->myobject->id;

View File

@ -1358,6 +1358,14 @@ while ($i < min($num, $limit))
$i++;
}
// If no record found
if ($num == 0)
{
$colspan = 1;
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
$db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);

View File

@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales
$action = GETPOST('action', 'aZ09');