Merge branch '11.0' into 11.0_fixmultidiroutput

This commit is contained in:
Florian HENRY 2020-09-27 18:02:22 +02:00
commit b6b2553501
39 changed files with 258 additions and 100 deletions

View File

@ -708,8 +708,8 @@ class AccountancyExport
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_doc = dol_print_date($line->doc_date, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_valid = dol_print_date($line->date_validated, '%Y%m%d'); $date_validation = dol_print_date($line->date_validated, '%Y%m%d');
// FEC:JournalCode // FEC:JournalCode
print $line->code_journal.$separator; print $line->code_journal.$separator;
@ -721,25 +721,25 @@ class AccountancyExport
print $line->piece_num.$separator; print $line->piece_num.$separator;
// FEC:EcritureDate // FEC:EcritureDate
print $date_creation.$separator; print $date_document . $separator;
// FEC:CompteNum // FEC:CompteNum
print $line->numero_compte.$separator; print $line->numero_compte.$separator;
// FEC:CompteLib // FEC:CompteLib
print $line->label_compte.$separator; print dol_string_unaccent($line->label_compte) . $separator;
// FEC:CompAuxNum // FEC:CompAuxNum
print $line->subledger_account.$separator; print $line->subledger_account.$separator;
// FEC:CompAuxLib // FEC:CompAuxLib
print $line->subledger_label.$separator; print dol_string_unaccent($line->subledger_label) . $separator;
// FEC:PieceRef // FEC:PieceRef
print $line->doc_ref.$separator; print $line->doc_ref.$separator;
// FEC:PieceDate // FEC:PieceDate
print $date_doc.$separator; print dol_string_unaccent($date_creation) . $separator;
// FEC:EcritureLib // FEC:EcritureLib
print $line->label_operation.$separator; print $line->label_operation.$separator;
@ -757,7 +757,7 @@ class AccountancyExport
print $line->date_lettering.$separator; print $line->date_lettering.$separator;
// FEC:ValidDate // FEC:ValidDate
print $date_valid.$separator; print $date_validation . $separator;
// FEC:Montantdevise // FEC:Montantdevise
print $line->multicurrency_amount.$separator; print $line->multicurrency_amount.$separator;

View File

@ -183,9 +183,9 @@ foreach ($data as $val)
$oldyear--; $oldyear--;
print '<tr class="oddeven" height="24">'; print '<tr class="oddeven" height="24">';
print '<td class="center">'; print '<td class="center">';
print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">'; //print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">';
print $oldyear; print $oldyear;
print '</a>'; //print '</a>';
print '</td>'; print '</td>';
print '<td class="right">0</td>'; print '<td class="right">0</td>';
print '<td class="right">0</td>'; print '<td class="right">0</td>';

View File

@ -41,12 +41,31 @@ $action = GETPOST('action', 'alpha');
/* /*
* Action * Action
*/ */
$reg = array();
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
$code=$reg[1]; $code=$reg[1];
// If constant is for a unique choice, delete other choices
if (in_array($code, array('STOCK_CALCULATE_ON_BILL', 'STOCK_CALCULATE_ON_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_SHIPMENT', 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE', $conf->entity);
}
if (in_array($code, array('STOCK_CALCULATE_ON_SUPPLIER_BILL', 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_RECEPTION', 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', $conf->entity);
}
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
else else
@ -114,7 +133,7 @@ print '<td class="right">';
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
@ -134,7 +153,7 @@ print '<td class="right">';
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
@ -156,7 +175,7 @@ print '<td class="right">';
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
@ -176,7 +195,7 @@ print '<td class="right">';
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
@ -189,18 +208,12 @@ else
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
/*if (! $found)
{
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
print "</tr>\n";
}*/
print '</table>'; print '</table>';
print '<br>'; print '<br>';
// Title rule for stock increase // Title rule for stock increase
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -216,7 +229,7 @@ print '<td class="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
@ -237,7 +250,7 @@ print '<td class="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
@ -257,7 +270,7 @@ if (!empty($conf->reception->enabled))
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
@ -272,7 +285,7 @@ if (!empty($conf->reception->enabled))
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
@ -288,7 +301,7 @@ else
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);

View File

@ -32,7 +32,7 @@ class DolibarrApi
/** /**
* @var DoliDb $db Database object * @var DoliDb $db Database object
*/ */
protected static $db; protected $db;
/** /**
* @var Restler $r Restler object * @var Restler $r Restler object

View File

@ -781,8 +781,8 @@ class Categorie extends CommonObject
$objs = array(); $objs = array();
$tmpclass = $this->MAP_OBJ_CLASS[$type]; $classnameforobj = $this->MAP_OBJ_CLASS[$type];
$obj = new $tmpclass($this->db); $obj = new $classnameforobj($this->db);
$sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type]; $sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type];
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c";
@ -810,8 +810,11 @@ class Categorie extends CommonObject
} }
else else
{ {
$obj = new $this->MAP_OBJ_CLASS[$type]($this->db); $classnameforobj = $this->MAP_OBJ_CLASS[$type];
$obj->fetch($rec['fk_'.$this->MAP_CAT_FK[$type]]);
$obj = new $classnameforobj($this->db);
$obj->fetch($rec['fk_' . $this->MAP_CAT_FK[$type]]);
$objs[] = $obj; $objs[] = $obj;
} }
} }

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2017 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -2992,9 +2992,9 @@ class Propal extends CommonObject
if (!$error) if (!$error)
{ {
$main = MAIN_DB_PREFIX . 'propaldet'; $main = MAIN_DB_PREFIX . 'propaldet';
$ef = $main . "_extrafields"; $ef = $main . "_extrafields";
$sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = " . $this->id . ")"; $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = " . $this->id . ")";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id;
if ($this->db->query($sqlef) && $this->db->query($sql)) if ($this->db->query($sqlef) && $this->db->query($sql))
{ {
@ -3011,6 +3011,9 @@ class Propal extends CommonObject
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We remove directory // We remove directory
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref)) if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref))

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -3461,6 +3461,9 @@ class Commande extends CommonOrder
if (! $error) if (! $error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// Remove directory with files // Remove directory with files
$comref = dol_sanitizeFileName($this->ref); $comref = dol_sanitizeFileName($this->ref);
if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref)) if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref))

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
@ -2185,6 +2185,9 @@ class Facture extends CommonInvoice
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->facture->dir_output && !empty($this->ref)) if ($conf->facture->dir_output && !empty($this->ref))

View File

@ -180,6 +180,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$limit=5; $limit=5;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE entity IN (" . getEntity('prelevement') . ")";
$sql.= " ORDER BY datec DESC"; $sql.= " ORDER BY datec DESC";
$sql.= $db->plimit($limit); $sql.= $db->plimit($limit);

View File

@ -1254,6 +1254,11 @@ else
} }
} }
// Select mail models is same action as presend
if (GETPOST('modelselected', 'alpha')) {
$action = 'presend';
}
if (!empty($id) && $action != 'edit' && $action != 'create') if (!empty($id) && $action != 'edit' && $action != 'create')
{ {
$objsoc = new Societe($db); $objsoc = new Societe($db);

View File

@ -94,7 +94,7 @@ class box_contacts extends ModeleBoxes
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sp.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid; if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid;
$sql .= " ORDER BY sp.tms DESC"; $sql .= " ORDER BY sp.tms DESC";
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);

View File

@ -486,6 +486,9 @@ class CMailFile
{ {
//$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]));
$attachment = Swift_Attachment::fromPath($filename_list[$i], $mimetype_list[$i]); $attachment = Swift_Attachment::fromPath($filename_list[$i], $mimetype_list[$i]);
if (!empty($mimefilename_list[$i])) {
$attachment->setFilename($mimefilename_list[$i]);
}
$this->message->attach($attachment); $this->message->attach($attachment);
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
@ -8250,4 +8250,49 @@ abstract class CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
/**
* Delete related files of object in database
*
* @return bool
*/
public function deleteEcmFiles()
{
global $conf;
$this->db->begin();
switch ($this->element){
case 'propal':
$element = 'propale';
break;
case 'product':
$element = 'produit';
break;
case 'order_supplier':
$element ='fournisseur/commande';
break;
case 'invoice_supplier':
$element = 'fournisseur/facture/' . get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier');
break;
case 'shipping':
$element = 'expedition/sending';
break;
default:
$element = $this->element;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files";
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
$sql.= " AND filepath = '".$element."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity;
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return false;
}
$this->db->commit();
return true;
}
} }

View File

@ -354,7 +354,7 @@ class FormFile
// Add entity in $param if not already exists // Add entity in $param if not already exists
if (!preg_match('/entity\=[0-9]+/', $param)) { if (!preg_match('/entity\=[0-9]+/', $param)) {
$param .= 'entity='.(!empty($object->entity) ? $object->entity : $conf->entity); $param .= ($param ? '&' : '').'entity='.(!empty($object->entity) ? $object->entity : $conf->entity);
} }
$printer = 0; $printer = 0;

View File

@ -1248,7 +1248,7 @@ class FormMail extends Form
elseif ($type_template == 'fichinter_send') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template == 'fichinter_send') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter"); }
elseif ($type_template == 'thirdparty') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif ($type_template == 'thirdparty') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); }
elseif ($type_template == 'user') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser"); } elseif ($type_template == 'user') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser"); }
elseif (!empty($type_template)) { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); } elseif (!empty($type_template)) { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric"); }
$ret->label = 'default'; $ret->label = 'default';
$ret->lang = $outputlangs->defaultlang; $ret->lang = $outputlangs->defaultlang;

View File

@ -163,18 +163,19 @@ class Translate
* *
* Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache * Value for hash are: 1:Loaded from disk, 2:Not found, 3:Loaded from cache
* *
* @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files: * @param string $domain File name to load (.lang file). Must be "file" or "file@module" for module language files:
* If $domain is "file@module" instead of "file" then we look for module lang file * If $domain is "file@module" instead of "file" then we look for module lang file
* in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang * in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang
* then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang * then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang
* @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US) * @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US)
* @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed)
* @param int $forcelangdir To force a different lang directory * @param int $forcelangdir To force a different lang directory
* @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf.
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK * @param int $forceloadifalreadynotfound Force attempt to reload lang file if it was previously not found
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
* @see loadLangs() * @see loadLangs()
*/ */
public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0)
{ {
global $conf,$db; global $conf,$db;
@ -205,7 +206,8 @@ class Translate
} }
// Check cache // Check cache
if (! empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain if (! empty($this->_tab_loaded[$newdomain])
&& ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound)) ) // File already loaded and found and not forced for this domain
{ {
//dol_syslog("Translate::Load already loaded for newdomain=".$newdomain); //dol_syslog("Translate::Load already loaded for newdomain=".$newdomain);
return 0; return 0;

View File

@ -479,16 +479,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @param int $entity Entity to set * @param int $entity Entity to set
* @param int $revertonoff Revert on/off * @param int $revertonoff Revert on/off
* @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant * @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
* @param int $forcenoajax 1=Force to use a ahref link instead of ajax code.
* @return string * @return string
*/ */
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0) function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcenoajax = 0)
{ {
global $conf, $langs; global $conf, $langs;
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax) || $forcenoajax)
{ {
if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@ -7928,19 +7928,16 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param
if (empty($conf->use_javascript_ajax)) return ''; if (empty($conf->use_javascript_ajax)) return '';
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'svg+xml'); $isAllowedForPreview = dolIsAllowedForPreview($relativepath);
//$mime_preview[]='vnd.oasis.opendocument.presentation';
//$mime_preview[]='archive';
$num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview);
if ($alldata == 1) if ($alldata == 1)
{ {
if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime'=>dol_mimetype($relativepath),); if ($isAllowedForPreview) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime'=>dol_mimetype($relativepath));
else return array(); else return array();
} }
// old behavior // old behavior, return a string
if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; if ($isAllowedForPreview) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')';
else return ''; else return '';
} }
@ -7964,6 +7961,31 @@ function ajax_autoselect($htmlname, $addlink = '')
return $out; return $out;
} }
/**
* Return if a file is qualified for preview
*
* @param string $file Filename we looking for information
* @return int 1 If allowed, 0 otherwise
* @see dol_mimetype(), image_format_supported() from images.lib.php
*/
function dolIsAllowedForPreview($file)
{
global $conf;
// Check .noexe extension in filename
if (preg_match('/\.noexe$/i', $file)) return 0;
// Check mime types
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'webp');
if (!empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) $mime_preview[] = 'svg+xml';
//$mime_preview[]='vnd.oasis.opendocument.presentation';
//$mime_preview[]='archive';
$num_mime = array_search(dol_mimetype($file, '', 1), $mime_preview);
if ($num_mime !== false) return 1;
// By default, not allowed for preview
return 0;
}
/** /**
* Return mime type of a file * Return mime type of a file
@ -7972,7 +7994,7 @@ function ajax_autoselect($htmlname, $addlink = '')
* @param string $default Default mime type if extension not found in known list * @param string $default Default mime type if extension not found in known list
* @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa
* @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive) * @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive)
* @see image_format_supported() from images.lib.php * @see dolIsAllowedForPreview(), image_format_supported() from images.lib.php
*/ */
function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
{ {
@ -8507,7 +8529,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
$attr['class'] .= ' classfortooltip'; $attr['class'] .= ' classfortooltip';
} }
if (empty($id)) { if (!empty($id)) {
$attr['id'] = $id; $attr['id'] = $id;
} }

View File

@ -2107,7 +2107,7 @@ function pdf_getTotalQty($object, $type, $outputlangs)
*/ */
function pdf_getLinkedObjects($object, $outputlangs) function pdf_getLinkedObjects($object, $outputlangs)
{ {
global $hookmanager; global $db, $hookmanager;
$linkedobjects = array(); $linkedobjects = array();
@ -2174,8 +2174,13 @@ function pdf_getLinkedObjects($object, $outputlangs)
// We concat this record info into fields xxx_value. title is overwrote. // We concat this record info into fields xxx_value. title is overwrote.
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
{ {
$elementobject->fetchObjectLinked(); $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (!empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']); if (! empty($elementobject->linkedObjectsIds['commande'])){
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$order = new Commande($db);
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
if ($ret < 1) { $order=null; }
}
} }
if (!is_object($order)) if (!is_object($order))
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -575,6 +576,18 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
} }
if ($feature == 'agenda')// Also check myactions rights
{
if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) {
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
$action = new ActionComm($db);
$action->fetch($objectid);
if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, $action->userassigned))) {
return false;
}
}
}
} }
elseif (in_array($feature, $checkproject)) elseif (in_array($feature, $checkproject))
{ {

View File

@ -1706,7 +1706,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
// Project affected to user // Project affected to user
$newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks');
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);

View File

@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport
while ($i < $nblines) { while ($i < $nblines) {
$pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
if (empty($showpricebeforepagebreak)) { if (empty($showpricebeforepagebreak) && ($i !== ($nblines - 1))) {
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
} else { } else {
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.

View File

@ -1057,7 +1057,8 @@ class Cronjob extends CommonObject
if (!$error) if (!$error)
{ {
$result = $langs->load($this->module_name); $result = $langs->load($this->module_name);
$result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing $result = $langs->load($this->module_name.'@'.$this->module_name, 0, 0, '', 0, 1);
if ($result < 0) // If technical error if ($result < 0) // If technical error
{ {
dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR);

View File

@ -159,11 +159,13 @@ if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha') ?tr
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false; if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
// Define mime type // Define mime type
$type = 'application/octet-stream'; $type = 'application/octet-stream'; // By default
if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha'); if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha');
else $type = dol_mimetype($original_file); else $type=dol_mimetype($original_file);
// Security: Force to octet-stream if file is a dangerous file // Security: Force to octet-stream if file is a dangerous file. For example when it is a .noexe file
if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream'; if (!in_array($type, array('text/x-javascript')) && !dolIsAllowedForPreview($original_file)) {
$type = 'application/octet-stream';
}
// Security: Delete string ../ into $original_file // Security: Delete string ../ into $original_file
$original_file = str_replace("../", "/", $original_file); $original_file = str_replace("../", "/", $original_file);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
@ -1325,6 +1325,9 @@ class Expedition extends CommonObject
{ {
$this->db->commit(); $this->db->commit();
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We delete PDFs // We delete PDFs
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if (!empty($conf->expedition->dir_output)) if (!empty($conf->expedition->dir_output))

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
@ -1000,6 +1000,9 @@ class Fichinter extends CommonObject
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// Remove directory with files // Remove directory with files
$fichinterref = dol_sanitizeFileName($this->ref); $fichinterref = dol_sanitizeFileName($this->ref);
if ($conf->ficheinter->dir_output) if ($conf->ficheinter->dir_output)

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -2062,6 +2062,9 @@ class CommandeFournisseur extends CommonOrder
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We remove directory // We remove directory
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->fournisseur->commande->dir_output) if ($conf->fournisseur->commande->dir_output)

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2019 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
@ -1217,6 +1217,9 @@ class FactureFournisseur extends CommonInvoice
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We remove directory // We remove directory
if ($conf->fournisseur->facture->dir_output) if ($conf->fournisseur->facture->dir_output)
{ {

View File

@ -242,7 +242,7 @@ class DoliStorage implements TokenStorageInterface
$sql.= " WHERE service='".$this->db->escape($service)."'"; $sql.= " WHERE service='".$this->db->escape($service)."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
$result = $this->db->fetch_array($resql); $result = $this->db->fetch_array($resql);
$states[$service] = $result[state]; $states[$service] = $result['state'];
$this->states[$service] = $states[$service]; $this->states[$service] = $states[$service];
return is_array($states) return is_array($states)

View File

@ -98,7 +98,8 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline DROP COLUMN `rank`; -- VMYSQL4.1 ALTER TABLE llx_bom_bomline DROP COLUMN `rank`;
-- VPGSQL8.2 ALTER TABLE llx_bom_bomline DROP COLUMN rank;
create table llx_categorie_warehouse create table llx_categorie_warehouse
( (

View File

@ -315,6 +315,7 @@ ALTER TABLE llx_c_chargesociales ADD COLUMN accountancy_code varchar(15) DEFAULT
-- Tables for accountancy expert -- Tables for accountancy expert
DROP TABLE llx_accountingaccount; DROP TABLE llx_accountingaccount;
DROP TABLE llx_accounting_account;
DROP TABLE llx_accountingsystem; DROP TABLE llx_accountingsystem;
DROP TABLE llx_accounting_system; DROP TABLE llx_accounting_system;

View File

@ -102,6 +102,10 @@ ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_shipping_method;
ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_expedition_methode; ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_expedition_methode;
ALTER TABLE llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer; ALTER TABLE llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer;
-- This table and constraint should not exists as it appears in more recent version, but we may have it if we load an old dump
-- on a newly created database and we want to be sure upgrade of rowid into autoincrement done later will works.
ALTER TABLE llx_reception DROP FOREIGN KEY fk_reception_fk_shipping_method;
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAULT '' AFTER description; ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAULT '' AFTER description;
--ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE; --ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE;

View File

@ -353,8 +353,8 @@ PriceUTTC=U.P. (inc. tax)
Amount=Amount Amount=Amount
AmountInvoice=Invoice amount AmountInvoice=Invoice amount
AmountInvoiced=Amount invoiced AmountInvoiced=Amount invoiced
AmountInvoicedHT=Amount invoiced (incl. tax) AmountInvoicedHT=Amount invoiced (excl. tax)
AmountInvoicedTTC=Amount invoiced (excl. tax) AmountInvoicedTTC=Amount invoiced (inc. tax)
AmountPayment=Payment amount AmountPayment=Payment amount
AmountHTShort=Amount (excl.) AmountHTShort=Amount (excl.)
AmountTTCShort=Amount (inc. tax) AmountTTCShort=Amount (inc. tax)

View File

@ -97,6 +97,7 @@ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNA
PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n
PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available. DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available.
ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfil=Choose the demo profile that best suits your needs...
ChooseYourDemoProfilMore=...or build your own profile<br>(manual module selection) ChooseYourDemoProfilMore=...or build your own profile<br>(manual module selection)

View File

@ -353,8 +353,8 @@ PriceUTTC=P.U TTC
Amount=Montant Amount=Montant
AmountInvoice=Montant facture AmountInvoice=Montant facture
AmountInvoiced=Montant facturé AmountInvoiced=Montant facturé
AmountInvoicedHT=Montant facturé (TTC) AmountInvoicedHT=Montant facturé (HT)
AmountInvoicedTTC=Montant facturé (HT) AmountInvoicedTTC=Montant facturé (TTC)
AmountPayment=Montant paiement AmountPayment=Montant paiement
AmountHTShort=Montant HT AmountHTShort=Montant HT
AmountTTCShort=Montant TTC AmountTTCShort=Montant TTC

View File

@ -366,7 +366,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->id; $id = $obj->id;
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1'); header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1');
exit; exit;
} }

View File

@ -552,7 +552,7 @@ if (empty($reshook))
// Links with users // Links with users
$salesreps = GETPOST('commercial', 'array'); $salesreps = GETPOST('commercial', 'array');
$result = $object->setSalesRep($salesreps); $result = $object->setSalesRep($salesreps, true);
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;

View File

@ -2412,7 +2412,15 @@ class Societe extends CommonObject
global $action; global $action;
$hookmanager->initHooks(array('thirdpartydao')); $hookmanager->initHooks(array('thirdpartydao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result); $parameters = array(
'id'=>$this->id,
'getnomurl'=>$result,
'withpicto '=> $withpicto,
'option'=> $option,
'maxlen'=> $maxlen,
'notooltip'=> $notooltip,
'save_lastsearch_value'=> $save_lastsearch_value
);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint; if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint; else $result .= $hookmanager->resPrint;
@ -4270,9 +4278,10 @@ class Societe extends CommonObject
* Sets sales representatives of the thirdparty * Sets sales representatives of the thirdparty
* *
* @param int[]|int $salesrep User ID or array of user IDs * @param int[]|int $salesrep User ID or array of user IDs
* @param bool $onlyAdd Only add (no delete before)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function setSalesRep($salesrep) public function setSalesRep($salesrep, $onlyAdd = false)
{ {
global $user; global $user;
@ -4281,16 +4290,18 @@ class Societe extends CommonObject
$salesrep = array($salesrep); $salesrep = array($salesrep);
} }
// Get current users
$existing = $this->getSalesRepresentatives($user, 1);
// Diff $to_del = array(); // Nothing to delete
if (is_array($existing)) { $to_add = $salesrep;
$to_del = array_diff($existing, $salesrep); if ($onlyAdd === false) {
$to_add = array_diff($salesrep, $existing); // Get current users
} else { $existing = $this->getSalesRepresentatives($user, 1);
$to_del = array(); // Nothing to delete
$to_add = $salesrep; // Diff
if (is_array($existing)) {
$to_del = array_diff($existing, $salesrep);
$to_add = array_diff($salesrep, $existing);
}
} }
$error = 0; $error = 0;

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -1818,7 +1818,7 @@ class SupplierProposal extends CommonObject
if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code); if(!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code);
$productsupplier->id = $product->fk_product; $productsupplier->id = $product->fk_product;
$productsupplier->update_buyprice($product->qty, $product->subprice, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_subprice, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', ''); $productsupplier->update_buyprice($product->qty, $product->total_ht, $user, 'HT', $this->thirdparty, '', $ref_fourn, $product->tva_tx, 0, 0, 0, $product->info_bits, '', '', array(), '', $product->multicurrency_total_ht, 'HT', $multicurrency_tx, $product->multicurrency_code, '', '', '');
} }
return 1; return 1;
@ -2076,6 +2076,9 @@ class SupplierProposal extends CommonObject
if (! $error) if (! $error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We remove directory // We remove directory
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->supplier_proposal->dir_output && !empty($this->ref)) if ($conf->supplier_proposal->dir_output && !empty($this->ref))