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

develop

Conflicts:
	htdocs/opensurvey/wizard/create_survey.php
This commit is contained in:
Laurent Destailleur 2020-11-25 14:55:31 +01:00
commit 5030f0c587
24 changed files with 480 additions and 207 deletions

View File

@ -1,4 +1,4 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dolibarr Upstream-Name: Dolibarr
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net> Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: https://www.dolibarr.org/files/stable/standard/ Source: https://www.dolibarr.org/files/stable/standard/
@ -38,6 +38,7 @@ Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
2011, Herve Prot <herve.prot@symeos.com> 2011, Herve Prot <herve.prot@symeos.com>
2011, Remy Younes <ryounes@gmail.com> 2011, Remy Younes <ryounes@gmail.com>
2012-2013, Christophe Battarel <christophe.battarel@altairis.fr> 2012-2013, Christophe Battarel <christophe.battarel@altairis.fr>
License: GPL-3+ License: GPL-3+
This program is free software; you can redistribute it This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public and/or modify it under the terms of the GNU General Public
@ -56,7 +57,9 @@ License: GPL-3+
. .
On Debian systems, the full text of the GNU General Public On Debian systems, the full text of the GNU General Public
License version 3 can be found in the file License version 3 can be found in the file
`/usr/share/common-licenses/GPL-3'. '/usr/share/common-licenses/GPL-3'.
------------------------------------------------------------
Files: htdocs/includes/adodbtime/* Files: htdocs/includes/adodbtime/*
Copyright: 2003-2005, John Lim Copyright: 2003-2005, John Lim
@ -80,6 +83,9 @@ Comment:
Those files are not shipped in the binary package since we use Those files are not shipped in the binary package since we use
the library as packaged in "libphp-adodb". the library as packaged in "libphp-adodb".
------------------------------------------------------------
Files: htdocs/includes/ckeditor/* Files: htdocs/includes/ckeditor/*
Copyright: 2003-2012 CKSource - Frederico Knabben Copyright: 2003-2012 CKSource - Frederico Knabben
License: GPL-2+ License: GPL-2+
@ -109,6 +115,9 @@ Comment:
Those files are not shipped in the binary package since we use the Those files are not shipped in the binary package since we use the
library as packaged in "ckeditor". library as packaged in "ckeditor".
------------------------------------------------------------
Files: htdocs/includes/fonts/* Files: htdocs/includes/fonts/*
Copyright: 2003, Bitstream Inc Copyright: 2003, Bitstream Inc
unknown, Gavin Graham unknown, Gavin Graham
@ -159,6 +168,9 @@ Comments:
Those files are not shipped in the binary package as we Those files are not shipped in the binary package as we
configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core". configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core".
------------------------------------------------------------
Files: doc/images/* Files: doc/images/*
Copyright: Laurent Destailleur Copyright: Laurent Destailleur
License: CC-BY-SA-3.0 License: CC-BY-SA-3.0
@ -174,7 +186,10 @@ License: CC-BY-SA-3.0
distribute the resulting work only under the same, similar or a compatible distribute the resulting work only under the same, similar or a compatible
license. license.
. .
For more information, see http://creativecommons.org/licenses/by-sa/3.0/ For more information, see https://creativecommons.org/licenses/by-sa/3.0/
------------------------------------------------------------
Files: htdocs/includes/fpdfi/* Files: htdocs/includes/fpdfi/*
Copyright: 2004-2011 Setasign - Jan Slabon Copyright: 2004-2011 Setasign - Jan Slabon
@ -196,7 +211,10 @@ License: GPL-2+
. .
On Debian systems, the full text of the GNU General Public On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'. '/usr/share/common-licenses/GPL-2'.
------------------------------------------------------------
Files: htdocs/includes/geoip/* Files: htdocs/includes/geoip/*
Copyright: 2007 MaxMind LLC Copyright: 2007 MaxMind LLC
@ -216,10 +234,14 @@ License: LGPL-2.1+
. .
On Debian systems, the full text of the GNU Lesser General Public On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'. '/usr/share/common-licenses/LGPL-2.1'.
------------------------------------------------------------
Files: htdocs/includes/jquery/* Files: htdocs/includes/jquery/*
Copyright: JQuery team Copyright: JQuery team
https://www.jquery.com
License: GPL-2+ or MIT License: GPL-2+ or MIT
=== GPL-2+ LICENSE NOTICE === === GPL-2+ LICENSE NOTICE ===
. .
@ -240,7 +262,7 @@ License: GPL-2+ or MIT
. .
On Debian systems, the full text of the GNU General Public On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'. '/usr/share/common-licenses/GPL-2'.
. .
=== MIT LICENSE === === MIT LICENSE ===
. .
@ -267,6 +289,8 @@ Comment:
"libjs-jquery-ui". Most of the plugins are shipped though. "libjs-jquery-ui". Most of the plugins are shipped though.
------------------------------------------------------------
Files: htdocs/includes/jquery/plugins/flot/* Files: htdocs/includes/jquery/plugins/flot/*
Copyright: Flot team Copyright: Flot team
License: Public-Domain License: Public-Domain
@ -275,6 +299,9 @@ Comment:
Those files are not shipped in the binary package because we configure Those files are not shipped in the binary package because we configure
Dolibarr to use the files provided by "libjs-flot". Dolibarr to use the files provided by "libjs-flot".
------------------------------------------------------------
Files: htdocs/includes/jsgantt/* Files: htdocs/includes/jsgantt/*
Copyright: JSGantt team Copyright: JSGantt team
License: GPL-2+ License: GPL-2+
@ -295,7 +322,10 @@ License: GPL-2+
. .
On Debian systems, the full text of the GNU General Public On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'. '/usr/share/common-licenses/GPL-2'.
------------------------------------------------------------
Files: htdocs/includes/nusoap/* Files: htdocs/includes/nusoap/*
Copyright: 2002-2010 NuSphere Corporation Copyright: 2002-2010 NuSphere Corporation
@ -315,11 +345,14 @@ License: LGPL-2.1+
. .
On Debian systems, the full text of the GNU Lesser General Public On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'. '/usr/share/common-licenses/LGPL-2.1'.
Comment: Comment:
Those files are not shipped in the binary package since we Those files are not shipped in the binary package since we
configure Dolibarr to use the library provided in "libnusoap-php". configure Dolibarr to use the library provided in "libnusoap-php".
------------------------------------------------------------
Files: htdocs/includes/odtphp/* Files: htdocs/includes/odtphp/*
Copyright: 2008, Julien Pauli Copyright: 2008, Julien Pauli
2008, Cyril PIERRE de GEYER 2008, Cyril PIERRE de GEYER
@ -342,7 +375,10 @@ License: GPL-2+
. .
On Debian systems, the full text of the GNU General Public On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'. '/usr/share/common-licenses/GPL-2'.
------------------------------------------------------------
Files: htdocs/includes/phpexcel/* Files: htdocs/includes/phpexcel/*
Copyright: 2006-2011 PHPExcel (http://www.codeplex.com/PHPExcel) Copyright: 2006-2011 PHPExcel (http://www.codeplex.com/PHPExcel)
@ -362,7 +398,10 @@ License: LGPL-2.1+
. .
On Debian systems, the full text of the GNU Lesser General Public On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'. '/usr/share/common-licenses/LGPL-2.1'.
------------------------------------------------------------
Files: htdocs/includes/tcpdf/* Files: htdocs/includes/tcpdf/*
Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD

View File

@ -2,13 +2,18 @@ README (English)
-------------------------------- --------------------------------
This directory contains tools to generate translation files for a new This directory contains tools to generate translation files for a new
languages or to update translation files for existing languages. languages or to update translation files for existing languages.
See Dolibarr Wiki page: See Dolibarr Wiki page:
https://wiki.dolibarr.org/index.php/Translator_documentation https://wiki.dolibarr.org/index.php/Translator_documentation
For more information on how to use them. For more information on how to use them.
for Linux OS: Translation of Dolibarr Project at Transifex:
To install transifex client: https://www.transifex.com/dolibarr-association/dolibarr/dashboard/
Installation of Transifex Client:
---------------------------------
for Linux OS
to install or to update transifex client:
sudo pip install --upgrade transifex-client sudo pip install --upgrade transifex-client
To update transifex client:
sudo pip install --upgrade transifex-client

View File

@ -21,8 +21,8 @@
* \ingroup dev * \ingroup dev
* \brief This script uses google language ajax api as the translator engine * \brief This script uses google language ajax api as the translator engine
* The main translator function can be found at: * The main translator function can be found at:
* http://code.google.com/intl/fr/apis/language/translate/overview.html * defunct -http://code.google.com/intl/fr/apis/language/translate/overview.html-
* http://translate.google.com/translate_tools * defunct -http://translate.google.com/translate_tools-
* https://code.google.com/apis/console * https://code.google.com/apis/console
*/ */
@ -58,7 +58,7 @@ $dir=DOL_DOCUMENT_ROOT."/langs";
if (! isset($argv[3])) { if (! isset($argv[3])) {
print "Usage: ".$script_file." lang_code_src lang_code_dest|all APIKEY [langfile.lang]\n"; print "Usage: ".$script_file." lang_code_src lang_code_dest|all APIKEY [langfile.lang]\n";
print "Example: ".$script_file." en_US pt_PT 123456\n"; print "Example: ".$script_file." en_US pt_PT 123456\n";
print "Rem: lang_code to use can be found on http://www.google.com/language_tools\n"; print "Rem: lang_code to use can be found on https://translate.google.com\n";
exit; exit;
} }

View File

@ -6,13 +6,14 @@ README (french)
Téléchargement Téléchargement
-------------------------------- --------------------------------
* Dolibarr ERP/CRM can be downloaded at sourceforge: * Dolibarr ERP/CRM peut être téléchargé sur sourceforge:
http://sourceforge.net/projects/dolibarr/files https://sourceforge.net/projects/dolibarr/files
or from Dolibarr official web site:
ou sur le site officiel de Dolibarr:
https://www.dolibarr.org https://www.dolibarr.org
* Most external modules are only available on DoliStore: * La plupart des modules externes ne sont disponibles que sur le DoliStore officiel:
https://www.dolistore.org https://www.dolistore.com
-------------------------------- --------------------------------
@ -24,4 +25,4 @@ README-FR à la racine.
* Une documentation utilisateur francophone plus consistante est disponible en * Une documentation utilisateur francophone plus consistante est disponible en
ligne sur le wiki de Dolibarr à l'adresse: ligne sur le wiki de Dolibarr à l'adresse:
https://wiki.dolibarr.org https://wiki.dolibarr.org/index.php/Accueil

View File

@ -112,13 +112,31 @@ class BOM extends CommonObject
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')),
); );
/**
* @var int rowid
*/
public $rowid; public $rowid;
/**
* @var string ref
*/
public $ref; public $ref;
/**
* @var string label
*/
public $label; public $label;
/**
* @var int bomtype
*/
public $bomtype; public $bomtype;
/**
* @var string description
*/
public $description; public $description;
public $note_public;
public $note_private;
/** /**
* @var integer|string date_creation * @var integer|string date_creation
@ -127,10 +145,30 @@ class BOM extends CommonObject
public $tms; public $tms;
/**
* @var int Id User creator
*/
public $fk_user_creat; public $fk_user_creat;
/**
* @var int Id User modifying
*/
public $fk_user_modif; public $fk_user_modif;
/**
* @var string import key
*/
public $import_key; public $import_key;
/**
* @var int status
*/
public $status; public $status;
/**
* @var int product Id
*/
public $fk_product; public $fk_product;
public $qty; public $qty;
public $efficiency; public $efficiency;
@ -1097,15 +1135,43 @@ class BOMLine extends CommonObjectLine
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,), 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
); );
/**
* @var int rowid
*/
public $rowid; public $rowid;
/**
* @var int fk_bom
*/
public $fk_bom; public $fk_bom;
/**
* @var int Id of product
*/
public $fk_product; public $fk_product;
/**
* @var string description
*/
public $description; public $description;
public $qty; public $qty;
/**
* @var int qty frozen
*/
public $qty_frozen; public $qty_frozen;
public $disable_stock_change; public $disable_stock_change;
public $efficiency; public $efficiency;
/**
* @var int position of line
*/
public $position; public $position;
/**
* @var string import key
*/
public $import_key; public $import_key;
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES

View File

@ -71,10 +71,16 @@ class Bookmark extends CommonObject
*/ */
public $datec; public $datec;
/**
* @var string url
*/
public $url; public $url;
public $target; // 0=replace, 1=new window public $target; // 0=replace, 1=new window
/**
* @var string title
*/
public $title; public $title;
public $position; public $position;

View File

@ -170,6 +170,7 @@ if (empty($reshook))
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm'); $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm');
$result = $object->update($object->id, $user); $result = $object->update($object->id, $user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
else $result = $object->fetch($object->id);
} }
// update outstandng limit // update outstandng limit

View File

@ -307,12 +307,10 @@ if ($massaction == 'makepayment') {
header('Location: '.$loc); header('Location: '.$loc);
exit; exit;
} elseif ($massaction == 'withdrawrequest') } elseif ($massaction == 'withdrawrequest') {
{
$langs->load("withdrawals"); $langs->load("withdrawals");
if (!$user->rights->prelevement->bons->creer) if (!$user->rights->prelevement->bons->creer) {
{
$error++; $error++;
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
} else { } else {
@ -325,8 +323,7 @@ if ($massaction == 'makepayment') {
{ {
$objecttmp = new Facture($db); $objecttmp = new Facture($db);
$result = $objecttmp->fetch($toselectid); $result = $objecttmp->fetch($toselectid);
if ($result > 0) if ($result > 0) {
{
$totalpaye = $objecttmp->getSommePaiement(); $totalpaye = $objecttmp->getSommePaiement();
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed(); $totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed(); $totaldeposits = $objecttmp->getSumDepositsUsed();
@ -667,7 +664,7 @@ if ($resql)
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
//'makepayment'=>$langs->trans("InvoicePaymentsLimits"), TODO Blank page when using this //'makepayment'=>$langs->trans("InvoicePaymentsLimits"), TODO Blank page when using this
); );
if ($conf->prelevement->enabled) { if ($conf->prelevement->enabled && !empty($user->rights->prelevement->bons->creer)) {
$langs->load("withdrawals"); $langs->load("withdrawals");
$arrayofmassactions['withdrawrequest'] = $langs->trans("MakeWithdrawRequest"); $arrayofmassactions['withdrawrequest'] = $langs->trans("MakeWithdrawRequest");
} }

View File

@ -632,8 +632,10 @@ if ($object->id > 0)
print "\n<div class=\"tabsAction\">\n"; print "\n<div class=\"tabsAction\">\n";
$buttonlabel = $langs->trans("MakeWithdrawRequest"); $buttonlabel = $langs->trans("MakeWithdrawRequest");
$user_perms=$user->rights->prelevement->bons->creer;
if ($type == 'bank-transfer') { if ($type == 'bank-transfer') {
$buttonlabel = $langs->trans("MakeBankTransferOrder"); $buttonlabel = $langs->trans("MakeBankTransferOrder");
$user_perms=$user->rights->paymentbybanktransfer->create;
} }
// Add a transfer request // Add a transfer request
@ -641,7 +643,7 @@ if ($object->id > 0)
{ {
if ($resteapayer > 0) if ($resteapayer > 0)
{ {
if ($user->rights->prelevement->bons->creer) if ($user_perms)
{ {
$remaintopaylesspendingdebit = $resteapayer - $pending; $remaintopaylesspendingdebit = $resteapayer - $pending;

View File

@ -164,10 +164,12 @@ class BonPrelevement extends CommonObject
$result = 0; $result = 0;
} else { } else {
$result = -1; $result = -1;
$this->errors[] = get_class($this)."::AddFacture " . $this->db->lasterror;
dol_syslog(get_class($this)."::AddFacture Error $result"); dol_syslog(get_class($this)."::AddFacture Error $result");
} }
} else { } else {
$result = -2; $result = -2;
$this->errors[]=get_class($this)."::AddFacture linedid Empty";
dol_syslog(get_class($this)."::AddFacture Error $result"); dol_syslog(get_class($this)."::AddFacture Error $result");
} }
} else { } else {
@ -245,6 +247,7 @@ class BonPrelevement extends CommonObject
$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
$result = 0; $result = 0;
} else { } else {
$this->errors[]=get_class($this)."::addline Error -2 " .$this->db->lasterror;
dol_syslog(get_class($this)."::addline Error -2"); dol_syslog(get_class($this)."::addline Error -2");
$result = -2; $result = -2;
} }
@ -1121,7 +1124,8 @@ class BonPrelevement extends CommonObject
if (!$resql) if (!$resql)
{ {
$error++; $error++;
dol_syslog(__METHOD__."::Update Error=".$this->db->error(), LOG_ERR); $this->errors[]=$this->db->lasterror();
dol_syslog(__METHOD__."::Update Error=".$this->db->lasterror(), LOG_ERR);
} }
} }
} }
@ -1316,7 +1320,7 @@ class BonPrelevement extends CommonObject
$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
if ($this->type == 'bank-transfer') { if ($this->type == 'bank-transfer') {
$url = DOL_URL_ROOT.'/compta/paymentbybanktransfer/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
} }
if ($option != 'nolink') if ($option != 'nolink')

View File

@ -8046,12 +8046,8 @@ abstract class CommonObject
// Delete llx_ecm_files // Delete llx_ecm_files
if (!$error) { if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id; $res = $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive
$resql = $this->db->query($sql); if (! $res) {
if (!$resql)
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$error++; $error++;
} }
} }
@ -8449,55 +8445,80 @@ abstract class CommonObject
/** /**
* Delete related files of object in database * Delete related files of object in database
* *
* @return bool * @param integer $mode 0=Use path to find record, 1=Use src_object_xxx fields
* @return bool True if OK, False if KO
*/ */
public function deleteEcmFiles() public function deleteEcmFiles($mode = 0)
{ {
global $conf; global $conf;
$this->db->begin(); $this->db->begin();
switch ($this->element) { // Delete in database with mode 0
case 'propal': if ($mode == 0) {
$element = 'propale'; switch ($this->element) {
break; case 'propal':
case 'product': $element = 'propale';
$element = 'produit'; break;
break; case 'product':
case 'order_supplier': $element = 'produit';
$element = 'fournisseur/commande'; break;
break; case 'order_supplier':
case 'invoice_supplier': $element = 'fournisseur/commande';
$element = 'fournisseur/facture/'.get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier'); break;
break; case 'invoice_supplier':
case 'shipping': $element = 'fournisseur/facture/'.get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier');
$element = 'expedition/sending'; break;
break; case 'shipping':
default: $element = 'expedition/sending';
$element = $this->element; break;
default:
$element = $this->element;
}
// Delete ecm_files extrafields
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files_extrafields WHERE fk_object IN (";
$sql .= " SELECT rowid FROM ".MAIN_DB_PREFIX."ecm_files WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity; // No need of getEntity here
$sql .= ")";
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return false;
}
// Delete ecm_files
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files";
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity; // No need of getEntity here
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return false;
}
} }
// Delete ecm_files extrafields // Delete in database with mode 1
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files_extrafields WHERE fk_object IN ("; if ($mode == 1) {
$sql .= " SELECT rowid FROM ".MAIN_DB_PREFIX."ecm_files WHERE filename LIKE '".$this->db->escape($this->ref)."%'"; $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files_extrafields";
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity; // No need of getEntity here $sql .= " WHERE fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id;
$sql .= ")"; $resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return false;
}
if (!$this->db->query($sql)) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files";
$this->error = $this->db->lasterror(); $sql .= " WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id;
$this->db->rollback(); $resql = $this->db->query($sql);
return false; if (!$resql) {
} $this->error = $this->db->lasterror();
$this->db->rollback();
// Delete ecm_files return false;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files"; }
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
$sql .= " AND filepath = '".$this->db->escape($element)."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity; // No need of getEntity here
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return false;
} }
$this->db->commit(); $this->db->commit();

View File

@ -1647,7 +1647,7 @@ class SMTPs
* - [2] Private * - [2] Private
* - [3] Company Confidential * - [3] Company Confidential
* *
* @return void * @return string|boolean
*/ */
public function getSensitivity() public function getSensitivity()
{ {

View File

@ -60,15 +60,29 @@ class EcmFiles extends CommonObject
*/ */
public $label; public $label;
public $share; // hash for file sharing, empty by default (example: getRandomPassword(true)) /**
* @var string hash for file sharing, empty by default (example: getRandomPassword(true))
*/
public $share;
/** /**
* @var int Entity * @var int Entity
*/ */
public $entity; public $entity;
public $filename; // Note: Into ecm database record, the entry $filename never ends with .noexe /**
* @var string filename, Note: Into ecm database record, the entry $filename never ends with .noexe
*/
public $filename;
/**
* @var string filepath
*/
public $filepath; public $filepath;
/**
* @var string fullpath origin
*/
public $fullpath_orig; public $fullpath_orig;
/** /**
@ -76,12 +90,31 @@ class EcmFiles extends CommonObject
*/ */
public $description; public $description;
/**
* @var string keywords
*/
public $keywords; public $keywords;
public $cover; public $cover;
public $position; public $position;
public $gen_or_uploaded; // can be 'generated', 'uploaded', 'unknown'
/**
* @var string can be 'generated', 'uploaded', 'unknown'
*/
public $gen_or_uploaded;
/**
* @var string extraparams
*/
public $extraparams; public $extraparams;
/**
* @var int|string date create
*/
public $date_c = ''; public $date_c = '';
/**
* @var int|string date modify
*/
public $date_m = ''; public $date_m = '';
/** /**
@ -94,6 +127,9 @@ class EcmFiles extends CommonObject
*/ */
public $fk_user_m; public $fk_user_m;
/**
* @var string acl
*/
public $acl; public $acl;
public $src_object_type; public $src_object_type;
public $src_object_id; public $src_object_id;
@ -135,7 +171,7 @@ class EcmFiles extends CommonObject
$this->share = trim($this->share); $this->share = trim($this->share);
} }
if (isset($this->entity)) { if (isset($this->entity)) {
$this->entity = trim($this->entity); $this->entity = (int) $this->entity;
} }
if (isset($this->filename)) { if (isset($this->filename)) {
$this->filename = preg_replace('/\.noexe$/', '', trim($this->filename)); $this->filename = preg_replace('/\.noexe$/', '', trim($this->filename));
@ -163,10 +199,10 @@ class EcmFiles extends CommonObject
$this->extraparams = trim($this->extraparams); $this->extraparams = trim($this->extraparams);
} }
if (isset($this->fk_user_c)) { if (isset($this->fk_user_c)) {
$this->fk_user_c = trim($this->fk_user_c); $this->fk_user_c = (int) $this->fk_user_c;
} }
if (isset($this->fk_user_m)) { if (isset($this->fk_user_m)) {
$this->fk_user_m = trim($this->fk_user_m); $this->fk_user_m = (int) $this->fk_user_m;
} }
if (isset($this->acl)) { if (isset($this->acl)) {
$this->acl = trim($this->acl); $this->acl = trim($this->acl);
@ -174,13 +210,16 @@ class EcmFiles extends CommonObject
if (isset($this->src_object_type)) { if (isset($this->src_object_type)) {
$this->src_object_type = trim($this->src_object_type); $this->src_object_type = trim($this->src_object_type);
} }
if (empty($this->date_c)) $this->date_c = dol_now(); if (empty($this->date_c)) {
if (empty($this->date_m)) $this->date_m = dol_now(); $this->date_c = dol_now();
}
if (empty($this->date_m)) {
$this->date_m = dol_now();
}
// If ref not defined // If ref not defined
$ref = ''; $ref = '';
if (!empty($this->ref)) if (!empty($this->ref)) {
{
$ref = $this->ref; $ref = $this->ref;
} else { } else {
include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
@ -188,8 +227,8 @@ class EcmFiles extends CommonObject
} }
$maxposition = 0; $maxposition = 0;
if (empty($this->position)) // Get max used if (empty($this->position)) {
{ // Get max used
$sql = "SELECT MAX(position) as maxposition FROM ".MAIN_DB_PREFIX.$this->table_element; $sql = "SELECT MAX(position) as maxposition FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE filepath ='".$this->db->escape($this->filepath)."'"; $sql .= " WHERE filepath ='".$this->db->escape($this->filepath)."'";

View File

@ -272,6 +272,96 @@ if (empty($reshook))
$permissiontodelete = $user->rights->fournisseur->facture->supprimer; $permissiontodelete = $user->rights->fournisseur->facture->supprimer;
$uploaddir = $conf->fournisseur->facture->dir_output; $uploaddir = $conf->fournisseur->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction == 'banktransfertrequest')
{
$langs->load("withdrawals");
if (!$user->rights->paymentbybanktransfer->create)
{
$error++;
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
} else {
//Checking error
$error = 0;
$arrayofselected = is_array($toselect) ? $toselect : array();
$listofbills = array();
foreach ($arrayofselected as $toselectid)
{
$objecttmp = new FactureFournisseur($db);
$result = $objecttmp->fetch($toselectid);
if ($result > 0)
{
$totalpaye = $objecttmp->getSommePaiement();
$totalcreditnotes = $objecttmp->getSumCreditNotesUsed();
$totaldeposits = $objecttmp->getSumDepositsUsed();
$objecttmp->resteapayer = price2num($objecttmp->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
if ($objecttmp->paye || $objecttmp->resteapayer == 0) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("AlreadyPaid"), $objecttmp->errors, 'errors');
} elseif ($objecttmp->resteapayer < 0) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("AmountMustBePositive"), $objecttmp->errors, 'errors');
}
if (!($objecttmp->statut > FactureFournisseur::STATUS_DRAFT)) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("Draft"), $objecttmp->errors, 'errors');
}
$rsql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
$rsql .= " , pfd.date_traite as date_traite";
$rsql .= " , pfd.amount";
$rsql .= " , u.rowid as user_id, u.lastname, u.firstname, u.login";
$rsql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$rsql .= " , ".MAIN_DB_PREFIX."user as u";
$rsql .= " WHERE fk_facture_fourn = ".$objecttmp->id;
$rsql .= " AND pfd.fk_user_demande = u.rowid";
$rsql .= " AND pfd.traite = 0";
$rsql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($rsql);
if ($result_sql)
{
$numprlv = $db->num_rows($result_sql);
}
if ($numprlv > 0) {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings');
} elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code != 'PRE') {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors');
} else {
$listofbills[] = $objecttmp; // $listofbills will only contains invoices with good payment method and no request already done
}
}
}
//Massive withdraw request for request with no errors
if (!empty($listofbills))
{
$nbwithdrawrequestok = 0;
foreach ($listofbills as $aBill)
{
$db->begin();
$result = $aBill->demande_prelevement($user, $aBill->resteapayer, 'bank-transfer', 'supplier_invoice');
if ($result > 0)
{
$db->commit();
$nbwithdrawrequestok++;
} else {
$db->rollback();
setEventMessages($aBill->error, $aBill->errors, 'errors');
}
}
if ($nbwithdrawrequestok > 0)
{
setEventMessages($langs->trans("WithdrawRequestsDone", $nbwithdrawrequestok), null, 'mesgs');
}
}
}
}
} }
@ -517,6 +607,10 @@ if ($resql)
//'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
); );
//if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
if (!empty($conf->paymentbybanktransfer->enabled) && !empty($user->rights->paymentbybanktransfer->create)) {
$langs->load('withdrawals');
$arrayofmassactions['banktransfertrequest'] = $langs->trans("MakeBankTransferOrder");
}
if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); if ($user->rights->fournisseur->facture->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array(); if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array();
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);

View File

@ -84,6 +84,8 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'19','Perso
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'21','Indivision'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'21','Indivision');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'22','Société créée de fait'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'22','Société créée de fait');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'23','Société en participation'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'23','Société en participation');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'24','Société coopérative d''interet collectif (SCIC)');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'25','Société coopérative de production à responsabilité limitée (SCOP)');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'27','Paroisse hors zone concordataire'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'27','Paroisse hors zone concordataire');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'29','Groupement de droit privé non doté de la personnalité morale'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'29','Groupement de droit privé non doté de la personnalité morale');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'31','Personne morale de droit étranger, immatriculée au RCS'); insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'31','Personne morale de droit étranger, immatriculée au RCS');

View File

@ -35,6 +35,8 @@ ALTER TABLE llx_payment_various MODIFY COLUMN ref varchar(30) NULL;
ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order'; ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order';
ALTER TABLE llx_prelevement_facture CHANGE COLUMN fk_facture_foun fk_facture_fourn integer NULL;
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture);
ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn);

View File

@ -20,7 +20,7 @@ create table llx_prelevement_facture
( (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_facture integer NULL, fk_facture integer NULL,
fk_facture_foun integer NULL, fk_facture_fourn integer NULL,
fk_prelevement_lignes integer NOT NULL fk_prelevement_lignes integer NOT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -43,10 +43,10 @@ $arrayoftypecolumn = GETPOST('typecolonne', 'array');
if (isset($_SESSION["nbrecases"])) { if (isset($_SESSION["nbrecases"])) {
for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) { for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) {
if (isset($arrayofchoices[$i])) { if (isset($arrayofchoices[$i])) {
$_SESSION["choix$i"] = $arrayofchoices[$i]; $_SESSION["choix".$i] = $arrayofchoices[$i];
} }
if (isset($arrayoftypecolumn[$i])) { if (isset($arrayoftypecolumn[$i])) {
$_SESSION["typecolonne$i"] = $arrayoftypecolumn[$i]; $_SESSION["typecolonne".$i] = $arrayoftypecolumn[$i];
} }
} }
} else { //nombre de cases par défaut } else { //nombre de cases par défaut
@ -97,9 +97,6 @@ if (GETPOSTISSET("confirmecreation"))
} }
} }
var_dump($_SESSION); exit;
/* /*
* View * View
*/ */

View File

@ -1282,31 +1282,59 @@ if ($resql)
// Multiprices // Multiprices
if ($conf->global->PRODUIT_MULTIPRICES) { if (! empty($conf->global->PRODUIT_MULTIPRICES)) {
if (! isset($productpricescache)) {
$productpricescache=array();
}
if (! isset($productpricescache[$obj->rowid])) {
$productpricescache[$obj->rowid] = array();
}
if ($obj->tosell)
{
// Make 1 request for all price levels (without filter on price_level) and saved result into an cache array
// then reuse the cache array if we need prices for other price levels
$sqlp = "SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price, p.price_base_type";
$sqlp .= " FROM ".MAIN_DB_PREFIX."product_price as p";
$sqlp .= " WHERE fk_product = ".$obj->rowid;
$sqlp .= " ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
$resultp = $db->query($sqlp);
if ($resultp)
{
$nump = $db->num_rows($resultp);
$j = 0;
while ($j < $nump)
{
$objp = $db->fetch_object($resultp);
if (empty($productpricescache[$obj->rowid][$objp->price_level]))
{
$productpricescache[$obj->rowid][$objp->price_level]['price'] = $objp->price;
$productpricescache[$obj->rowid][$objp->price_level]['price_ttc'] = $objp->price_ttc;
$productpricescache[$obj->rowid][$objp->price_level]['price_base_type'] = $objp->price_base_type;
}
$j++;
}
$db->free($resultp);
} else {
dol_print_error($db);
}
}
foreach ($arraypricelevel as $key => $value) foreach ($arraypricelevel as $key => $value)
{ {
if (!empty($arrayfields['p.sellprice'.$key]['checked'])) if (!empty($arrayfields['p.sellprice'.$key]['checked']))
{ {
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
if ($obj->tosell) if (! empty($productpricescache[$obj->rowid]))
{ {
// TODO Make 1 request for all price levels (without filter on price_level) and saved result into an cache array if ($productpricescache[$obj->rowid][$key]['price_base_type'] == 'TTC') {
// then reuse the cache array if we need prices for other price levels print price($productpricescache[$obj->rowid][$key]['price_ttc']).' '.$langs->trans("TTC");
$resultp = "SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price"; } else {
$resultp .= " FROM ".MAIN_DB_PREFIX."product_price as p"; print price($productpricescache[$obj->rowid][$key]['price']).' '.$langs->trans("HT");
$resultp .= " WHERE fk_product = ".$obj->rowid; }
$resultp .= " AND p.price_level = ".$key;
$resultp .= " ORDER BY p.date_price DESC, p.rowid DESC, p.price_level ASC";
$resultp = $db->query($resultp);
if ($resultp)
{
$objp = $db->fetch_object($resultp);
if ($obj->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
else print price($objp->price).' '.$langs->trans("HT");
$db->free($resultp);
} else {
dol_print_error($db);
}
} }
print '</td>'; print '</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;

View File

@ -127,7 +127,6 @@ class Contacts extends DolibarrApi
$result = $this->contact->initAsSpecimen(); $result = $this->contact->initAsSpecimen();
} else { } else {
$result = $this->contact->fetch('', '', '', $email); $result = $this->contact->fetch('', '', '', $email);
$this->contact->fetchRoles();
} }
if (!$result) if (!$result)

View File

@ -131,8 +131,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '')
{ {
global $db;
$obj_ret = array(); $obj_ret = array();
// case of external user, we force socids // case of external user, we force socids
@ -294,7 +292,7 @@ class Thirdparties extends DolibarrApi
*/ */
public function merge($id, $idtodelete) public function merge($id, $idtodelete)
{ {
global $db, $hookmanager; global $hookmanager;
$error = 0; $error = 0;
@ -398,8 +396,7 @@ class Thirdparties extends DolibarrApi
} }
// Move links // Move links
if (!$error) if (!$error) {
{
// This list is also into the societe/card.php file // This list is also into the societe/card.php file
// TODO Mutualise the list into object societe.class.php // TODO Mutualise the list into object societe.class.php
$objects = array( $objects = array(
@ -433,57 +430,49 @@ class Thirdparties extends DolibarrApi
{ {
require_once DOL_DOCUMENT_ROOT.$object_file; require_once DOL_DOCUMENT_ROOT.$object_file;
if (!$errors && !$object_name::replaceThirdparty($this->db, $soc_origin->id, $object->id)) if (!$error && !$object_name::replaceThirdparty($this->db, $soc_origin->id, $object->id)) {
{ $error++;
$errors++;
//setEventMessages($this->db->lasterror(), null, 'errors'); //setEventMessages($this->db->lasterror(), null, 'errors');
} }
} }
} }
// External modules should update their ones too // External modules should update their ones too
if (!$errors) if (!$error) {
{
$reshook = $hookmanager->executeHooks('replaceThirdparty', array( $reshook = $hookmanager->executeHooks('replaceThirdparty', array(
'soc_origin' => $soc_origin->id, 'soc_origin' => $soc_origin->id,
'soc_dest' => $object->id 'soc_dest' => $object->id
), $soc_dest, $action); ), $soc_dest, $action);
if ($reshook < 0) if ($reshook < 0) {
{
//setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); //setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$errors++; $error++;
} }
} }
if (!$error) if (!$error) {
{
$object->context = array('merge'=>1, 'mergefromid'=>$soc_origin->id); $object->context = array('merge'=>1, 'mergefromid'=>$soc_origin->id);
// Call trigger // Call trigger
$result = $object->call_trigger('COMPANY_MODIFY', $user); $result = $object->call_trigger('COMPANY_MODIFY', $user);
if ($result < 0) if ($result < 0) {
{
//setEventMessages($object->error, $object->errors, 'errors'); //setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
} }
// End call triggers // End call triggers
} }
if (!$error) if (!$error) {
{
//We finally remove the old thirdparty //We finally remove the old thirdparty
if ($soc_origin->delete($soc_origin->id, $user) < 1) if ($soc_origin->delete($soc_origin->id, $user) < 1) {
{ $error++;
$errors++;
} }
} }
// End of merge // End of merge
if ($error) if ($error) {
{
$this->db->rollback(); $this->db->rollback();
throw new RestException(500, 'Error failed to merged thirdparty '.$this->companytoremove->id.' into '.$id.'. Enable and read log file for more information.'); throw new RestException(500, 'Error failed to merged thirdparty '.$this->companytoremove->id.' into '.$id.'. Enable and read log file for more information.');
@ -829,8 +818,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function getOutStandingProposals($id, $mode = 'customer') public function getOutStandingProposals($id, $mode = 'customer')
{ {
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->rights->societe->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -873,8 +860,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function getOutStandingOrder($id, $mode = 'customer') public function getOutStandingOrder($id, $mode = 'customer')
{ {
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->rights->societe->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -916,8 +901,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function getOutStandingInvoices($id, $mode = 'customer') public function getOutStandingInvoices($id, $mode = 'customer')
{ {
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->rights->societe->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -959,8 +942,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function getSalesRepresentatives($id, $mode = 0) public function getSalesRepresentatives($id, $mode = 0)
{ {
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->rights->societe->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -1139,8 +1120,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function getCompanyBankAccount($id) public function getCompanyBankAccount($id)
{ {
global $db, $conf;
if (!DolibarrApiAccess::$user->rights->facture->lire) { if (!DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -1330,58 +1309,54 @@ class Thirdparties extends DolibarrApi
*/ */
public function generateBankAccountDocument($id, $companybankid = null, $model = 'sepamandate') public function generateBankAccountDocument($id, $companybankid = null, $model = 'sepamandate')
{ {
global $conf; global $conf, $langs;
$this->langs->loadLangs(array("main", "dict", "commercial", "products", "companies", "banks", "bills", "withdrawals")); $langs->loadLangs(array("main", "dict", "commercial", "products", "companies", "banks", "bills", "withdrawals"));
$this->company->fetch($id); if ($this->company->fetch($id) <= 0) {
throw new RestException(404, 'Thirdparty not found');
}
$action = 'builddoc'; if (!DolibarrApiAccess::$user->rights->societe->creer) {
if (!DolibarrApiAccess::$user->rights->societe->creer)
throw new RestException(401); throw new RestException(401);
}
$this->company->setDocModel(DolibarrApiAccess::$user, $model); $this->company->setDocModel(DolibarrApiAccess::$user, $model);
$this->company->fk_bank = $this->company->fk_account; $this->company->fk_bank = $this->company->fk_account;
$outputlangs = $this->langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($this->conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); //if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($this->conf->global->MAIN_MULTILANGS && empty($newlang) && isset($this->company->thirdparty->default_lang)) $newlang = $this->company->thirdparty->default_lang; // for proposal, order, invoice, ... if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) {
if ($this->conf->global->MAIN_MULTILANGS && empty($newlang) && isset($this->company->default_lang)) $newlang = $this->company->default_lang; // for thirdparty if (isset($this->company->thirdparty->default_lang)) {
$newlang = $this->company->thirdparty->default_lang; // for proposal, order, invoice, ...
} elseif (isset($this->company->default_lang)) {
$newlang = $this->company->default_lang; // for thirdparty
}
}
if (!empty($newlang)) { if (!empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
// To be sure vars is defined
$hidedetails = $hidedesc = $hideref = 0;
$moreparams = null;
if (empty($hidedetails)) $hidedetails = 0;
if (empty($hidedesc)) $hidedesc = 0;
if (empty($hideref)) $hideref = 0;
if (empty($moreparams)) $moreparams = null;
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib";
if ($id) $sql .= " WHERE fk_soc = ".$id." "; if ($id) $sql .= " WHERE fk_soc = ".$id." ";
if ($companybankid) $sql .= " AND id = ".$companybankid.""; if ($companybankid) $sql .= " AND rowid = ".$companybankid."";
$i = 0; $i = 0;
$accounts = array(); $accounts = array();
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{ if ($this->db->num_rows($result) == 0) {
if ($result && $this->db->num_rows($result) == 0) {
throw new RestException(404, 'Bank account not found'); throw new RestException(404, 'Bank account not found');
} }
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
while ($i < $num) while ($i < $num) {
{
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$account = new CompanyBankAccount($this->db); $account = new CompanyBankAccount($this->db);
@ -1391,20 +1366,17 @@ class Thirdparties extends DolibarrApi
$i++; $i++;
} }
} else { } else {
throw new RestException(404, 'Bank account not found'); throw new RestException(500, 'Sql error '.$this->db->lasterror());
} }
$moreparams = array( $moreparams = array(
'use_companybankid'=>$accounts[0]->id, 'use_companybankid' => $accounts[0]->id,
'force_dir_output'=>$this->conf->societe->multidir_output[$this->company->entity].'/'.dol_sanitizeFileName($this->company->id) 'force_dir_output' => $conf->societe->multidir_output[$this->company->entity].'/'.dol_sanitizeFileName($this->company->id)
); );
$result = 0; $result = $this->company->generateDocument($model, $outputlangs, 0, 0, 0, $moreparams);
$result = $this->company->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); if ($result > 0) {
if ($result > 0)
{
return array("success" => $result); return array("success" => $result);
} else { } else {
throw new RestException(500); throw new RestException(500);
@ -1425,8 +1397,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function getSocieteAccounts($id, $site = null) public function getSocieteAccounts($id, $site = null)
{ {
global $db, $conf;
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->rights->societe->lire) {
throw new RestException(401); throw new RestException(401);
} }
@ -1502,8 +1472,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function createSocieteAccount($id, $request_data = null) public function createSocieteAccount($id, $request_data = null)
{ {
global $db;
if (!DolibarrApiAccess::$user->rights->societe->creer) { if (!DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -1561,8 +1529,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function putSocieteAccount($id, $site, $request_data = null) public function putSocieteAccount($id, $site, $request_data = null)
{ {
global $db;
if (!DolibarrApiAccess::$user->rights->societe->creer) { if (!DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -1644,8 +1610,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function patchSocieteAccount($id, $site, $request_data = null) public function patchSocieteAccount($id, $site, $request_data = null)
{ {
global $db;
if (!DolibarrApiAccess::$user->rights->societe->creer) { if (!DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -1697,8 +1661,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function deleteSocieteAccount($id, $site) public function deleteSocieteAccount($id, $site)
{ {
global $db;
if (!DolibarrApiAccess::$user->rights->societe->creer) { if (!DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401); throw new RestException(401);
} }
@ -1733,8 +1695,6 @@ class Thirdparties extends DolibarrApi
*/ */
public function deleteSocieteAccounts($id) public function deleteSocieteAccounts($id)
{ {
global $db;
if (!DolibarrApiAccess::$user->rights->societe->creer) { if (!DolibarrApiAccess::$user->rights->societe->creer) {
throw new RestException(401); throw new RestException(401);
} }

View File

@ -678,7 +678,10 @@ if ($action == "order" and $placeid != 0)
$printer = new dolReceiptPrinter($db); $printer = new dolReceiptPrinter($db);
} }
$headerorder = '<html><br><b>'.$langs->trans('Place').' '.$place.'<br><table width="65%"><thead><tr><th class="left">'.$langs->trans("Label").'</th><th class="right">'.$langs->trans("Qty").'</th></tr></thead><tbody>'; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place);
$resql = $db->query($sql);
$row = $db->fetch_object($resql);
$headerorder = '<html><br><b>'.$langs->trans('Place').' '.$row->label.'<br><table width="65%"><thead><tr><th class="left">'.$langs->trans("Label").'</th><th class="right">'.$langs->trans("Qty").'</th></tr></thead><tbody>';
$footerorder = '</tbody></table>'.dol_print_date(dol_now(), 'dayhour').'<br></html>'; $footerorder = '</tbody></table>'.dol_print_date(dol_now(), 'dayhour').'<br></html>';
$order_receipt_printer1 = ""; $order_receipt_printer1 = "";
$order_receipt_printer2 = ""; $order_receipt_printer2 = "";
@ -695,11 +698,15 @@ if ($action == "order" and $placeid != 0)
$existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id'); $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id');
$result = array_intersect($catsprinter1, $existing); $result = array_intersect($catsprinter1, $existing);
$count = count($result); $count = count($result);
if (!$line->fk_product) $count++; // Print Free-text item (Unassigned printer) to Printer 1
if ($count > 0) { if ($count > 0) {
$linestoprint++; $linestoprint++;
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='1' where rowid=".$line->id; //Set to print on printer 1 $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='1' where rowid=".$line->id; //Set to print on printer 1
$db->query($sql); $db->query($sql);
$order_receipt_printer1 .= '<tr>'.$line->product_label.'<td class="right">'.$line->qty; $order_receipt_printer1 .= '<tr><td class="left">';
if ($line->fk_product) $order_receipt_printer1 .= $line->product_label;
else $order_receipt_printer1 .= $line->description;
$order_receipt_printer1 .= '</td><td class="right">'.$line->qty;
if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer1 .= "<br>(".$line->array_options['options_order_notes'].")"; if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer1 .= "<br>(".$line->array_options['options_order_notes'].")";
$order_receipt_printer1 .= '</td></tr>'; $order_receipt_printer1 .= '</td></tr>';
} }

View File

@ -99,6 +99,10 @@ class Website extends CommonObject
* @var integer * @var integer
*/ */
public $fk_default_home; public $fk_default_home;
/**
* @var int User Create Id
*/
public $fk_user_creat; public $fk_user_creat;
/** /**
@ -878,13 +882,13 @@ class Website extends CommonObject
global $user; global $user;
$this->id = 0; $this->id = 0;
$this->specimen =1;
$this->entity = 1; $this->entity = 1;
$this->ref = 'myspecimenwebsite'; $this->ref = 'myspecimenwebsite';
$this->description = 'A specimen website'; $this->description = 'A specimen website';
$this->lang = 'en'; $this->lang = 'en';
$this->otherlang = 'fr,es'; $this->otherlang = 'fr,es';
$this->status = ''; $this->status = 1;
$this->fk_default_home = null; $this->fk_default_home = null;
$this->virtualhost = 'http://myvirtualhost'; $this->virtualhost = 'http://myvirtualhost';
$this->fk_user_creat = $user->id; $this->fk_user_creat = $user->id;
@ -1349,8 +1353,7 @@ class Website extends CommonObject
$i++; $i++;
} }
if ($error) if ($error) {
{
return -1; return -1;
} else { } else {
return $num; return $num;

View File

@ -281,7 +281,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
preg_match_all('/sql.+\s*\'"\s*\.\s*\$(.........)/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/sql.+\s*\'"\s*\.\s*\$(.........)/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) foreach ($matches as $key => $val)
{ {
if (! in_array($val[1], array('this->db-', 'this->esc', 'db->escap', 'db->idate', 'excludeGr', 'includeGr'))) { if (! in_array($val[1], array('this->db-', 'this->esc', 'db->escap', 'dbsession->escap', 'db->idate', 'excludeGr', 'includeGr'))) {
$ok=false; $ok=false;
break; break;
} }