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

This commit is contained in:
Laurent Destailleur 2021-10-25 13:05:22 +02:00
commit 678e23b13a
32 changed files with 216 additions and 74 deletions

View File

@ -963,7 +963,7 @@ if ($rowid > 0) {
if ($adht->subscription) {
// Amount
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'.GETPOST('subscription').'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="subscription" size="6" value="'. price(GETPOSTISSET('subscription') ? GETPOST('subscription') : $adht->amount).'"> '.$langs->trans("Currency".$conf->currency) .'</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td>';

View File

@ -220,7 +220,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FR
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]);
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
@ -233,7 +233,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR
$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]);
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";

View File

@ -223,7 +223,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
// Add fields from hooks

View File

@ -64,7 +64,7 @@ if ($cancel && !$id) {
exit;
}
if ($action == 'add' && $cancel) {
if ($action == 'add' && !$cancel) {
$db->begin();
$datev = dol_mktime(12, 0, 0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear"));

View File

@ -9,6 +9,7 @@
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.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
@ -33,6 +34,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -366,7 +368,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
} else {
/*
* Factures clients
* Customer invoices
*/
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("CustomersInvoices").'</td></tr>';
@ -386,8 +388,8 @@ if ($modecompta == 'BOOKKEEPING') {
}
} elseif ($modecompta == 'RECETTES-DEPENSES') {
/*
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
* List of payments (old payments are not seen by this query because, on older versions, they were not linked via payment_invoice.
* old versions, they were not linked via payment_invoice. They are added later)
*/
$sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -434,7 +436,7 @@ if ($modecompta == 'BOOKKEEPING') {
dol_print_error($db);
}
// On ajoute les paiements clients anciennes version, non lie par paiement_facture
// We add the old customer payments, not linked by payment_invoice
if ($modecompta == 'RECETTES-DEPENSES') {
$sql = "SELECT 'Autres' as name, '0' as idp, sum(p.amount) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
@ -673,7 +675,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
* Charges sociales non deductibles
* Social / Fiscal contributions who are not deductible
*/
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
@ -760,7 +762,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
* Charges sociales deductibles
* Social / Fiscal contributions who are deductible
*/
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
@ -860,15 +862,27 @@ if ($modecompta == 'BOOKKEEPING') {
$column = 'p.datep';
}
$sql = "SELECT u.rowid, u.firstname, u.lastname, p.fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql = "SELECT u.rowid, u.firstname, u.lastname, s.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
}
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
// For backward compatibility with old module salary
$sql .= " UNION ";
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user";
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
if (!empty($date_start) && !empty($date_end)) {
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
}
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm";
$newsortfield = $sortfield;
if ($newsortfield == 's.nom, s.rowid') {
$newsortfield = 'u.firstname, u.lastname';
@ -900,7 +914,10 @@ if ($modecompta == 'BOOKKEEPING') {
print '<tr class="oddeven"><td>&nbsp;</td>';
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
$userstatic = new User($db);
$userstatic->fetch($obj->fk_user);
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?search_user=".urlencode($userstatic->getFullName($langs))."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
if ($modecompta == 'CREANCES-DETTES') {
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
@ -931,7 +948,7 @@ if ($modecompta == 'BOOKKEEPING') {
/*
* Expense
* Expense report
*/
if (!empty($conf->expensereport->enabled)) {
@ -1087,7 +1104,7 @@ if ($modecompta == 'BOOKKEEPING') {
}
/*
* Payement Loan
* Payment Loan
*/
if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
@ -1208,7 +1225,7 @@ if ($modecompta == 'BOOKKEEPING') {
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
print "</tr>\n";
// VAT to retreive
// VAT to retrieve
$amount = 0;
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";

View File

@ -205,12 +205,14 @@ if ($type == 'directory') {
'product',
'tax',
'project',
'project_task',
'fichinter',
'user',
'expensereport',
'holiday',
'recruitment-recruitmentcandidature',
'banque',
'chequereceipt',
'mrp-mo'
);
@ -243,6 +245,8 @@ if ($type == 'directory') {
$upload_dir = $conf->tax->dir_output;
} elseif ($module == 'project') {
$upload_dir = $conf->projet->dir_output;
} elseif ($module == 'project_task') {
$upload_dir = $conf->projet->dir_output;
} elseif ($module == 'fichinter') {
$upload_dir = $conf->ficheinter->dir_output;
} elseif ($module == 'user') {
@ -255,8 +259,10 @@ if ($type == 'directory') {
$upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
} elseif ($module == 'banque') {
$upload_dir = $conf->bank->dir_output;
} elseif ($module == 'chequereceipt') {
$upload_dir = $conf->bank->dir_output.'/checkdeposits';
} elseif ($module == 'mrp-mo') {
$upload_dir = $conf->mrp->dir_output.'/mo';
$upload_dir = $conf->mrp->dir_output;
} else {
$parameters = array('modulepart'=>$module);
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);

View File

@ -97,6 +97,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql .= " AND c.date_livraison IS NOT NULL";
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
if (!$user->rights->societe->client->voir && !$user->socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);

View File

@ -6029,7 +6029,6 @@ abstract class CommonObject
}
$sql .= ")";
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
@ -6283,6 +6282,11 @@ abstract class CommonObject
$this->array_options["options_".$key] = $this->db->idate($this->array_options["options_".$key]);
}
break;
case 'boolean':
if (empty($this->array_options["options_".$key])) {
$this->array_options["options_".$key] = null;
}
break;
/*
case 'link':
$param_list = array_keys($attributeParam['options']);

View File

@ -2220,11 +2220,18 @@ class ExtraFields
continue; // Value was not provided, we should not set it.
}
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
$value_key = price2num($value_arr);
} else {
$value_key = $value_arr;
}
} elseif (in_array($key_type, array('boolean'))) {
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
$value_key = '';
} else {
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key = $value_arr;
}
} else {
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
continue; // Value was not provided, we should not set it.

View File

@ -1645,6 +1645,9 @@ class FormFile
} elseif ($modulepart == 'project') {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$object_instance = new Project($this->db);
} elseif ($modulepart == 'project_task') {
include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$object_instance = new Task($this->db);
} elseif ($modulepart == 'fichinter') {
include_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$object_instance = new Fichinter($this->db);
@ -1663,6 +1666,9 @@ class FormFile
} elseif ($modulepart == 'banque') {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object_instance = new Account($this->db);
} elseif ($modulepart == 'chequereceipt') {
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
$object_instance = new RemiseCheque($this->db);
} elseif ($modulepart == 'mrp-mo') {
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
$object_instance = new Mo($this->db);
@ -1717,14 +1723,19 @@ class FormFile
$id = (isset($reg[1]) ? $reg[1] : '');
} elseif ($modulepart == 'invoice_supplier') {
preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg);
$ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) {
$ref = (isset($reg[1]) ? $reg[1] : '');
if (is_numeric($ref)) {
$id = $ref;
$ref = '';
}
} elseif ($modulepart == 'user' || $modulepart == 'holiday') {
} elseif ($modulepart == 'user') {
// $ref may be also id with old supplier invoices
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$id = (isset($reg[1]) ? $reg[1] : '');
} elseif ($modulepart == 'project_task') {
// $ref of task is the sub-directory of the project
$reg = explode("/", $relativefile);
$ref = (isset($reg[1]) ? $reg[1] : '');
} elseif (in_array($modulepart, array(
'invoice',
'propal',
@ -1734,11 +1745,14 @@ class FormFile
'contract',
'product',
'project',
'project_task',
'fichinter',
'expensereport',
'recruitment-recruitmentcandidature',
'mrp-mo',
'banque'))) {
'banque',
'chequereceipt',
'holiday'))) {
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg);
$ref = (isset($reg[1]) ? $reg[1] : '');
} else {

View File

@ -1101,7 +1101,7 @@ function activateModule($value, $withdeps = 1)
if (!count($ret['errors'])) {
$ret['nbmodules']++;
$ret['nbperms'] += count($objMod->rights);
$ret['nbperms'] += (is_array($objMod->rights)?count($objMod->rights):0);
}
return $ret;

View File

@ -23,7 +23,7 @@
/**
* \defgroup propale Module commercial proposals
* \brief Module pour gerer la tenue de propositions commerciales
* \brief Module to manage commercial proposals
* \file htdocs/core/modules/modPropale.class.php
* \ingroup propale
* \brief Description and activation file for the module customer proposal
@ -36,7 +36,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
*/
class modPropale extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*

View File

@ -114,7 +114,7 @@ if ($action == 'add') {
$idl = "idl".$i;
$qtytouse = price2num(GETPOST($qty));
if ($qtytouse > 0) {
$object->addline(GETPOST($idl), price2num($qtytouse));
$object->addline(GETPOST($idl), price2num($qtytouse), $arrayoptions);
}
}
@ -603,23 +603,26 @@ if ($action == 'create') { // Create. Seems to no be used
print "</tr>";
// Display lines extrafields
if (!empty($extrafields)) {
//if (!empty($extrafields)) {
$colspan = 2;
$mode = ($object->statut == 0) ? 'edit' : 'view';
$object->lines[$i]->fetch_optionals();
if ($action == 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
if ($action == 'create_delivery') {
$srcLine = new ExpeditionLigne($db);
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->id = $expedition->lines[$i]->id;
$srcLine->fetch_optionals();
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
} else {
$srcLine = new DeliveryLine($db);
$extrafields->fetch_name_optionals_label($srcLine->table_element);
$srcLine->id = $expedition->lines[$i]->id;
$srcLine->fetch_optionals();
$object->lines[$i]->array_options = array_merge($object->lines[$i]->array_options, $srcLine->array_options);
}
print $object->lines[$i]->showOptionals($extrafields, $mode, array('style' => 'class="oddeven"', 'colspan' => $colspan), $i);
}
print $object->lines[$i]->showOptionals($extrafields, $mode, array('style' => 'class="oddeven"', 'colspan' => $colspan), '');
//}
}
$i++;

View File

@ -211,7 +211,7 @@ class Delivery extends CommonObject
$origin_id = $this->lines[$i]->commande_ligne_id; // For backward compatibility
}
if (!$this->create_line($origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->description)) {
if (!$this->create_line($origin_id, $this->lines[$i]->qty, $this->lines[$i]->fk_product, $this->lines[$i]->description, $this->lines[$i]->array_options)) {
$error++;
}
}
@ -264,7 +264,7 @@ class Delivery extends CommonObject
* @param string $description Description
* @return int <0 if KO, >0 if OK
*/
public function create_line($origin_id, $qty, $fk_product, $description)
public function create_line($origin_id, $qty, $fk_product, $description, $array_options = 0)
{
// phpcs:enable
$error = 0;
@ -283,6 +283,15 @@ class Delivery extends CommonObject
$error++;
}
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."deliverydet");
if (is_array($array_options) && count($array_options) > 0) {
$line = new DeliveryLine($this->db);
$line->id = $id;
$line->array_options = $array_options;
$result = $line->insertExtraFields();
}
if ($error == 0) {
return 1;
}
@ -531,7 +540,9 @@ class Delivery extends CommonObject
$line->description = $expedition->lines[$i]->description;
$line->qty = $expedition->lines[$i]->qty_shipped;
$line->fk_product = $expedition->lines[$i]->fk_product;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($expedition->lines[$i]->array_options) && count($expedition->lines[$i]->array_options) > 0) { // For avoid conflicts if trigger used
$line->array_options = $expedition->lines[$i]->array_options;
}
$this->lines[$i] = $line;
}
@ -593,14 +604,18 @@ class Delivery extends CommonObject
* @param int $qty Qty
* @return void
*/
public function addline($origin_id, $qty)
public function addline($origin_id, $qty, $array_options = 0)
{
$num = count($this->lines);
global $conf;
$num = count($this->lines);
$line = new DeliveryLine($this->db);
$line->origin_id = $origin_id;
$line->qty = $qty;
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) { // For avoid conflicts if trigger used
$line->array_options = $array_options;
}
$this->lines[$num] = $line;
}

View File

@ -195,9 +195,11 @@ if (!in_array($type, array('text/x-javascript')) && !dolIsAllowedForPreview($ori
}
// Security: Delete string ../ or ..\ into $original_file
$original_file = preg_replace('/\.\.+/', '..', $original_file); // Replace '... or more' with '..'
$original_file = str_replace('../', '/', $original_file);
$original_file = str_replace('..\\', '/', $original_file);
// Find the subdirectory name as the reference
$refname = basename(dirname($original_file)."/");

View File

@ -341,6 +341,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
}
if (!empty($conf->projet->enabled)) {
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
}
if (!empty($conf->ficheinter->enabled)) {
$langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions")));
@ -353,6 +354,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
}
if (!empty($conf->banque->enabled)) {
$langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
}
if (!empty($conf->mrp->enabled)) {
$langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders")));

View File

@ -415,6 +415,7 @@ class FactureFournisseur extends CommonInvoice
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_fourn (";
$sql .= "ref";
$sql .= ", ref_supplier";
$sql .= ", ref_ext";
$sql .= ", entity";
$sql .= ", type";
$sql .= ", libelle";
@ -438,6 +439,7 @@ class FactureFournisseur extends CommonInvoice
$sql .= " VALUES (";
$sql .= "'(PROV)'";
$sql .= ", '".$this->db->escape($this->ref_supplier)."'";
$sql .= ", '".$this->db->escape($this->ref_ext)."'";
$sql .= ", ".$conf->entity;
$sql .= ", '".$this->db->escape($this->type)."'";
$sql .= ", '".$this->db->escape(isset($this->label) ? $this->label : (isset($this->libelle) ? $this->libelle : ''))."'";
@ -647,6 +649,7 @@ class FactureFournisseur extends CommonInvoice
$sql .= " t.rowid,";
$sql .= " t.ref,";
$sql .= " t.ref_supplier,";
$sql .= " t.ref_ext,";
$sql .= " t.entity,";
$sql .= " t.type,";
$sql .= " t.fk_soc,";
@ -708,6 +711,7 @@ class FactureFournisseur extends CommonInvoice
$this->ref = $obj->ref ? $obj->ref : $obj->rowid; // We take rowid if ref is empty for backward compatibility
$this->ref_supplier = $obj->ref_supplier;
$this->ref_ext = $obj->ref_ext;
$this->entity = $obj->entity;
$this->type = empty($obj->type) ? self::TYPE_STANDARD : $obj->type;
$this->fk_soc = $obj->fk_soc;
@ -924,6 +928,9 @@ class FactureFournisseur extends CommonInvoice
if (isset($this->ref_supplier)) {
$this->ref_supplier = trim($this->ref_supplier);
}
if (isset($this->ref_ext)) {
$this->ref_ext = trim($this->ref_ext);
}
if (isset($this->entity)) {
$this->entity = trim($this->entity);
}
@ -1013,6 +1020,7 @@ class FactureFournisseur extends CommonInvoice
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn SET";
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
$sql .= " ref_supplier=".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "null").",";
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
$sql .= " entity=".(isset($this->entity) ? $this->entity : "null").",";
$sql .= " type=".(isset($this->type) ? $this->type : "null").",";
$sql .= " fk_soc=".(isset($this->fk_soc) ? $this->fk_soc : "null").",";

View File

@ -701,6 +701,7 @@ class Holiday extends CommonObject
public function validate($user = null, $notrigger = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error = 0;
// Define new ref
@ -740,6 +741,44 @@ class Holiday extends CommonObject
}
}
if (!$error) {
$this->oldref = $this->ref;
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref)) {
// Now we rename also files into index
$sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'holiday/" . $this->db->escape($this->newref) . "'";
$sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'holiday/" . $this->db->escape($this->ref) . "' and entity = " . ((int) $conf->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->error = $this->db->lasterror();
}
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
$dirsource = $conf->holiday->multidir_output[$this->entity] . '/' . $oldref;
$dirdest = $conf->holiday->multidir_output[$this->entity] . '/' . $newref;
if (!$error && file_exists($dirsource)) {
dol_syslog(get_class($this) . "::validate rename dir " . $dirsource . " into " . $dirdest);
if (@rename($dirsource, $dirdest)) {
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles = dol_dir_list($dirdest, 'files', 1, '^' . preg_quote($oldref, '/'));
foreach ($listoffiles as $fileentry) {
$dirsource = $fileentry['name'];
$dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource);
$dirsource = $fileentry['path'] . '/' . $dirsource;
$dirdest = $fileentry['path'] . '/' . $dirdest;
@rename($dirsource, $dirdest);
}
}
}
}
}
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {

View File

@ -627,3 +627,5 @@ CREATE TABLE llx_onlinesignature
ALTER TABLE llx_facture_fourn CHANGE COLUMN fk_mode_transport fk_transport_mode integer;
ALTER TABLE llx_c_socialnetworks DROP INDEX idx_c_socialnetworks_code;
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);

View File

@ -16,4 +16,4 @@
-- ========================================================================
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code (code);
ALTER TABLE llx_c_socialnetworks ADD UNIQUE INDEX idx_c_socialnetworks_code_entity (code, entity);

View File

@ -570,19 +570,27 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end");
// Force here a value we need after because master.inc.php is not loaded into step2.
// This code must be similar with the one into main.inc.php
$conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
$out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno" value="checked" checked="true"> ';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
$out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno"'.((!empty($conf->global->MAIN_FIRST_PING_OK_ID) && $conf->global->MAIN_FIRST_PING_OK_ID == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
$out .= '<label for="dolibarrpingno">'.$langs->trans("MakeAnonymousPing").'</label>';
$out .= '<!-- Add js script to manage the uncheck of option to not send the ping -->';
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function(){';
$out .= ' document.cookie = "DOLINSTALLNOPING_'.md5($dolibarr_main_instance_unique_id).'=0; path=/"'."\n";
$out .= ' document.cookie = "DOLINSTALLNOPING_'.$hash_unique_id.'=0; path=/"'."\n";
$out .= ' jQuery("#dolibarrpingno").click(function() {';
$out .= ' if (! $(this).is(\':checked\')) {';
$out .= ' console.log("We uncheck anonymous ping");';
$out .= ' document.cookie = "DOLINSTALLNOPING_'.md5($dolibarr_main_instance_unique_id).'=1; path=/"'."\n";
$out .= ' }';
$out .= ' document.cookie = "DOLINSTALLNOPING_'.$hash_unique_id.'=1; path=/"'."\n";
$out .= ' } else {'."\n";
$out .= ' console.log("We check anonymous ping");';
$out .= ' document.cookie = "DOLINSTALLNOPING_'.$hash_unique_id.'=0; path=/"'."\n";
$out .= ' }'."\n";
$out .= ' });';
$out .= '});';
$out .= '</script>';

View File

@ -3206,6 +3206,7 @@ if (!function_exists("llxFooter")) {
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) {
//print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
if (empty($conf->global->MAIN_FIRST_PING_OK_DATE)
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
|| $forceping) {
@ -3214,7 +3215,7 @@ if (!function_exists("llxFooter")) {
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. It is an alpha version -->\n";
} elseif (empty($_COOKIE['DOLINSTALLNOPING_'.$hash_unique_id]) || $forceping) { // Cookie is set when we uncheck the checkbox in the installation wizard.
// MAIN_LAST_PING_KO_DATE
// Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent
// Disable ping if MAIN_LAST_PING_KO_DATE is set and is recent (this month)
if (!empty($conf->global->MAIN_LAST_PING_KO_DATE) && substr($conf->global->MAIN_LAST_PING_KO_DATE, 0, 6) == dol_print_date(dol_now(), '%Y%m') && !$forceping) {
print "\n<!-- NO JS CODE TO ENABLE the anonymous Ping. An error already occured this month, we will try later. -->\n";
} else {

View File

@ -1295,20 +1295,32 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
}
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'), 'label'=>GETPOST('proplabel', 'alpha'), 'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'), 'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'), 'notnull'=>GETPOST('propnotnull', 'int'), 'index'=>GETPOST('propindex', 'int'), 'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'), 'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'aZ09'), 'cssview'=>GETPOST('propcssview', 'aZ09'), 'csslist'=>GETPOST('propcsslist', 'aZ09')
);
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),
'notnull'=>GETPOST('propnotnull', 'int'),
'index'=>GETPOST('propindex', 'int'),
'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'aZ09'),
'cssview'=>GETPOST('propcssview', 'aZ09'),
'csslist'=>GETPOST('propcsslist', 'aZ09'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
);
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
}
@ -2800,7 +2812,7 @@ if ($module == 'initmodule') {
print '<input class="center" name="propvisible" size="2" value="'.dol_escape_htmltag($propvisible).'">';
print '</td>';
print '<td>';
print '<input class="center" name="propnoeditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">';
print '<input class="center" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">';
print '</td>';
print '<td>';
print '<input class="center" name="propsearchall" size="2" value="'.dol_escape_htmltag($propsearchall).'">';

View File

@ -265,7 +265,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
// Add fields from hooks

View File

@ -643,13 +643,12 @@ class MultiCurrency extends CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$urlendpoint = 'http://apilayer.net/api/live?access_key='.$key;
//$urlendpoint.='&format=1';
$urlendpoint .= (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '' : '&source='.$conf->global->MULTICURRENCY_APP_SOURCE);
$urlendpoint = 'http://api.currencylayer.com/live?access_key='.$key;
$urlendpoint .= '&source=' . (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? 'USD' : $conf->global->MULTICURRENCY_APP_SOURCE);
dol_syslog("Call url endpoint ".$urlendpoint);
$resget = getURLContent($urlendpoint, 'GET', '', 1, array(), array('http', 'https'), 1);
$resget = getURLContent($urlendpoint);
if ($resget['content']) {
$response = $resget['content'];

View File

@ -462,7 +462,7 @@ class Products extends DolibarrApi
$childsArbo = $this->product->getChildsArbo($id, 1);
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec'];
$keys = ['rowid', 'qty', 'fk_product_type', 'label', 'incdec', 'ref'];
$childs = [];
foreach ($childsArbo as $values) {
$childs[] = array_combine($keys, $values);
@ -1945,7 +1945,7 @@ class Products extends DolibarrApi
unset($object->supplierprices); // Mut use another API to get them
if(!DolibarrApiAccess::$user->rights->stock->lire){
if (empty(DolibarrApiAccess::$user->rights->stock->lire)) {
unset($object->stock_reel);
unset($object->stock_theorique);
}

View File

@ -443,6 +443,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') {
*/
$now = dol_now();
$error = 0;
$form = new Form($db);
$formproduct = new FormProduct($db);

View File

@ -237,13 +237,11 @@ $title = $langs->trans('ListOfCandidatures');
// Build and execute select
// --------------------------------------------------------------------
$sql = 'SELECT ';
foreach ($object->fields as $key => $val) {
$sql .= 't.'.$key.', ';
}
$sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
// Add fields from hooks

View File

@ -243,10 +243,11 @@ $title = $langs->trans('ListOfPositionsToBeFilled');
// --------------------------------------------------------------------
$sql = 'SELECT ';
$sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
}
}
// Add fields from hooks

View File

@ -2509,7 +2509,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td>';
print '<td>';
print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
print '</td>';
$tmpcheck = $object->check_codeclient();
if ($tmpcheck != 0 && $tmpcheck != -5) {
print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';

View File

@ -384,6 +384,9 @@ class User extends CommonObject
$this->rights->user = new stdClass();
$this->rights->user->user = new stdClass();
$this->rights->user->self = new stdClass();
$this->rights->user->user_advance = new stdClass();
$this->rights->user->self_advance = new stdClass();
$this->rights->user->group_advance = new stdClass();
}
/**

View File

@ -222,6 +222,7 @@ if (preg_match('/\.noexe$/i', $original_file)) {
}
// Security: Delete string ../ or ..\ into $original_file
$original_file = preg_replace('/\.\.+/', '..', $original_file); // Replace '... or more' with '..'
$original_file = str_replace('../', '/', $original_file);
$original_file = str_replace('..\\', '/', $original_file);