diff --git a/build/debian/copyright b/build/debian/copyright index 7b199adf693..d5fdf416a65 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -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-Contact: Laurent Destailleur Source: https://www.dolibarr.org/files/stable/standard/ @@ -38,6 +38,7 @@ Copyright: 2002-2009, Rodolphe Quiedeville 2011, Herve Prot 2011, Remy Younes 2012-2013, Christophe Battarel + License: GPL-3+ This program is free software; you can redistribute it 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 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/* Copyright: 2003-2005, John Lim @@ -80,6 +83,9 @@ Comment: Those files are not shipped in the binary package since we use the library as packaged in "libphp-adodb". + +------------------------------------------------------------ + Files: htdocs/includes/ckeditor/* Copyright: 2003-2012 CKSource - Frederico Knabben License: GPL-2+ @@ -109,6 +115,9 @@ Comment: Those files are not shipped in the binary package since we use the library as packaged in "ckeditor". + +------------------------------------------------------------ + Files: htdocs/includes/fonts/* Copyright: 2003, Bitstream Inc unknown, Gavin Graham @@ -158,7 +167,10 @@ License: other Comments: Those files are not shipped in the binary package as we configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core". - + + +------------------------------------------------------------ + Files: doc/images/* Copyright: Laurent Destailleur 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 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/* Copyright: 2004-2011 Setasign - Jan Slabon @@ -196,7 +211,10 @@ License: GPL-2+ . On Debian systems, the full text of the GNU General Public 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/* Copyright: 2007 MaxMind LLC @@ -216,10 +234,14 @@ License: LGPL-2.1+ . On Debian systems, the full text of the GNU Lesser General Public 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/* Copyright: JQuery team +https://www.jquery.com License: GPL-2+ or MIT === GPL-2+ LICENSE NOTICE === . @@ -240,7 +262,7 @@ License: GPL-2+ or MIT . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file - `/usr/share/common-licenses/GPL-2'. + '/usr/share/common-licenses/GPL-2'. . === MIT LICENSE === . @@ -267,6 +289,8 @@ Comment: "libjs-jquery-ui". Most of the plugins are shipped though. +------------------------------------------------------------ + Files: htdocs/includes/jquery/plugins/flot/* Copyright: Flot team License: Public-Domain @@ -275,6 +299,9 @@ Comment: Those files are not shipped in the binary package because we configure Dolibarr to use the files provided by "libjs-flot". + +------------------------------------------------------------ + Files: htdocs/includes/jsgantt/* Copyright: JSGantt team License: GPL-2+ @@ -295,7 +322,10 @@ License: GPL-2+ . On Debian systems, the full text of the GNU General Public 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/* 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 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: Those files are not shipped in the binary package since we configure Dolibarr to use the library provided in "libnusoap-php". + +------------------------------------------------------------ + Files: htdocs/includes/odtphp/* Copyright: 2008, Julien Pauli 2008, Cyril PIERRE de GEYER @@ -342,7 +375,10 @@ License: GPL-2+ . On Debian systems, the full text of the GNU General Public 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/* 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 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/* Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD diff --git a/dev/translation/README b/dev/translation/README index 9727f91e2e6..8d6954878b5 100644 --- a/dev/translation/README +++ b/dev/translation/README @@ -2,13 +2,18 @@ README (English) -------------------------------- This directory contains tools to generate translation files for a new languages or to update translation files for existing languages. + See Dolibarr Wiki page: https://wiki.dolibarr.org/index.php/Translator_documentation For more information on how to use them. -for Linux OS: -To install transifex client: +Translation of Dolibarr Project at Transifex: +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 -To update transifex client: -sudo pip install --upgrade transifex-client diff --git a/dev/translation/autotranslator.php b/dev/translation/autotranslator.php index 5e8cc13c3c8..fd02febbdcc 100755 --- a/dev/translation/autotranslator.php +++ b/dev/translation/autotranslator.php @@ -21,8 +21,8 @@ * \ingroup dev * \brief This script uses google language ajax api as the translator engine * The main translator function can be found at: - * http://code.google.com/intl/fr/apis/language/translate/overview.html - * http://translate.google.com/translate_tools + * defunct -http://code.google.com/intl/fr/apis/language/translate/overview.html- + * defunct -http://translate.google.com/translate_tools- * https://code.google.com/apis/console */ @@ -58,7 +58,7 @@ $dir=DOL_DOCUMENT_ROOT."/langs"; if (! isset($argv[3])) { 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 "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; } diff --git a/doc/install/README-FR b/doc/install/README-FR index 2cee29cf2df..5872ec0e3d1 100644 --- a/doc/install/README-FR +++ b/doc/install/README-FR @@ -6,13 +6,14 @@ README (french) Téléchargement -------------------------------- -* Dolibarr ERP/CRM can be downloaded at sourceforge: -http://sourceforge.net/projects/dolibarr/files -or from Dolibarr official web site: +* Dolibarr ERP/CRM peut être téléchargé sur sourceforge: +https://sourceforge.net/projects/dolibarr/files + +ou sur le site officiel de Dolibarr: https://www.dolibarr.org -* Most external modules are only available on DoliStore: -https://www.dolistore.org +* La plupart des modules externes ne sont disponibles que sur le DoliStore officiel: +https://www.dolistore.com -------------------------------- @@ -24,4 +25,4 @@ README-FR à la racine. * Une documentation utilisateur francophone plus consistante est disponible en ligne sur le wiki de Dolibarr à l'adresse: -https://wiki.dolibarr.org +https://wiki.dolibarr.org/index.php/Accueil diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 192acc22d83..2689a1a69e6 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -112,13 +112,31 @@ class BOM extends CommonObject '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')), ); + + /** + * @var int rowid + */ public $rowid; + + /** + * @var string ref + */ public $ref; + + /** + * @var string label + */ public $label; + + /** + * @var int bomtype + */ public $bomtype; + + /** + * @var string description + */ public $description; - public $note_public; - public $note_private; /** * @var integer|string date_creation @@ -127,10 +145,30 @@ class BOM extends CommonObject public $tms; + + /** + * @var int Id User creator + */ public $fk_user_creat; + + /** + * @var int Id User modifying + */ public $fk_user_modif; + + /** + * @var string import key + */ public $import_key; + + /** + * @var int status + */ public $status; + + /** + * @var int product Id + */ public $fk_product; public $qty; 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,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), ); + + /** + * @var int rowid + */ public $rowid; + + /** + * @var int fk_bom + */ public $fk_bom; + + /** + * @var int Id of product + */ public $fk_product; + + /** + * @var string description + */ public $description; public $qty; + + /** + * @var int qty frozen + */ public $qty_frozen; public $disable_stock_change; public $efficiency; + + /** + * @var int position of line + */ public $position; + + /** + * @var string import key + */ public $import_key; // END MODULEBUILDER PROPERTIES diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index 7f19b1bd21e..f7098f1d780 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -71,10 +71,16 @@ class Bookmark extends CommonObject */ public $datec; + /** + * @var string url + */ public $url; public $target; // 0=replace, 1=new window + /** + * @var string title + */ public $title; public $position; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 624526a9a5d..47c8431072d 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -170,6 +170,7 @@ if (empty($reshook)) $object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcomm'); $result = $object->update($object->id, $user); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); + else $result = $object->fetch($object->id); } // update outstandng limit diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9e21c584678..b693238924f 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -307,12 +307,10 @@ if ($massaction == 'makepayment') { header('Location: '.$loc); exit; -} elseif ($massaction == 'withdrawrequest') -{ +} elseif ($massaction == 'withdrawrequest') { $langs->load("withdrawals"); - if (!$user->rights->prelevement->bons->creer) - { + if (!$user->rights->prelevement->bons->creer) { $error++; setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); } else { @@ -325,8 +323,7 @@ if ($massaction == 'makepayment') { { $objecttmp = new Facture($db); $result = $objecttmp->fetch($toselectid); - if ($result > 0) - { + if ($result > 0) { $totalpaye = $objecttmp->getSommePaiement(); $totalcreditnotes = $objecttmp->getSumCreditNotesUsed(); $totaldeposits = $objecttmp->getSumDepositsUsed(); @@ -667,7 +664,7 @@ if ($resql) 'presend'=>$langs->trans("SendByMail"), //'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"); $arrayofmassactions['withdrawrequest'] = $langs->trans("MakeWithdrawRequest"); } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index f6a00f606ba..792ff73bcd3 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -632,8 +632,10 @@ if ($object->id > 0) print "\n
\n"; $buttonlabel = $langs->trans("MakeWithdrawRequest"); + $user_perms=$user->rights->prelevement->bons->creer; if ($type == 'bank-transfer') { $buttonlabel = $langs->trans("MakeBankTransferOrder"); + $user_perms=$user->rights->paymentbybanktransfer->create; } // Add a transfer request @@ -641,7 +643,7 @@ if ($object->id > 0) { if ($resteapayer > 0) { - if ($user->rights->prelevement->bons->creer) + if ($user_perms) { $remaintopaylesspendingdebit = $resteapayer - $pending; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index bcf0ce8aa5a..21bf795079a 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -164,10 +164,12 @@ class BonPrelevement extends CommonObject $result = 0; } else { $result = -1; + $this->errors[] = get_class($this)."::AddFacture " . $this->db->lasterror; dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { $result = -2; + $this->errors[]=get_class($this)."::AddFacture linedid Empty"; dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { @@ -245,6 +247,7 @@ class BonPrelevement extends CommonObject $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); $result = 0; } else { + $this->errors[]=get_class($this)."::addline Error -2 " .$this->db->lasterror; dol_syslog(get_class($this)."::addline Error -2"); $result = -2; } @@ -1121,7 +1124,8 @@ class BonPrelevement extends CommonObject if (!$resql) { $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; 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') diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 27e2225b2a2..b2e7b696147 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8046,12 +8046,8 @@ abstract class CommonObject // Delete llx_ecm_files 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; - $resql = $this->db->query($sql); - if (!$resql) - { - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; + $res = $this->deleteEcmFiles(1); // Deleting files physically is done later with the dol_delete_dir_recursive + if (! $res) { $error++; } } @@ -8449,55 +8445,80 @@ abstract class CommonObject /** * 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; $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; + // Delete in database with mode 0 + if ($mode == 0) { + 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; + } + + // 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 - $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 .= ")"; + // Delete in database with mode 1 + if ($mode == 1) { + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files_extrafields"; + $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; + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return false; + } - 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; + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files"; + $sql .= " WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id; + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return false; + } } $this->db->commit(); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index e42622c4170..8254cc56ed2 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1647,7 +1647,7 @@ class SMTPs * - [2] Private * - [3] Company Confidential * - * @return void + * @return string|boolean */ public function getSensitivity() { diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index e229663e55f..978b6e46d9e 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -60,15 +60,29 @@ class EcmFiles extends CommonObject */ 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 */ 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; + + /** + * @var string fullpath origin + */ public $fullpath_orig; /** @@ -76,12 +90,31 @@ class EcmFiles extends CommonObject */ public $description; + /** + * @var string keywords + */ public $keywords; public $cover; 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; + + /** + * @var int|string date create + */ public $date_c = ''; + + /** + * @var int|string date modify + */ public $date_m = ''; /** @@ -94,6 +127,9 @@ class EcmFiles extends CommonObject */ public $fk_user_m; + /** + * @var string acl + */ public $acl; public $src_object_type; public $src_object_id; @@ -135,7 +171,7 @@ class EcmFiles extends CommonObject $this->share = trim($this->share); } if (isset($this->entity)) { - $this->entity = trim($this->entity); + $this->entity = (int) $this->entity; } if (isset($this->filename)) { $this->filename = preg_replace('/\.noexe$/', '', trim($this->filename)); @@ -163,10 +199,10 @@ class EcmFiles extends CommonObject $this->extraparams = trim($this->extraparams); } 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)) { - $this->fk_user_m = trim($this->fk_user_m); + $this->fk_user_m = (int) $this->fk_user_m; } if (isset($this->acl)) { $this->acl = trim($this->acl); @@ -174,13 +210,16 @@ class EcmFiles extends CommonObject if (isset($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_m)) $this->date_m = dol_now(); + if (empty($this->date_c)) { + $this->date_c = dol_now(); + } + if (empty($this->date_m)) { + $this->date_m = dol_now(); + } // If ref not defined $ref = ''; - if (!empty($this->ref)) - { + if (!empty($this->ref)) { $ref = $this->ref; } else { include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; @@ -188,8 +227,8 @@ class EcmFiles extends CommonObject } $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 .= " WHERE filepath ='".$this->db->escape($this->filepath)."'"; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 39b91f42b09..d0dce03c87f 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -272,6 +272,96 @@ if (empty($reshook)) $permissiontodelete = $user->rights->fournisseur->facture->supprimer; $uploaddir = $conf->fournisseur->facture->dir_output; 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"), ); //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'] = ''.$langs->trans("Delete"); if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index a51b2bbd70f..7b02ee60ffa 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -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,'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,'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,'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'); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 2ad8fb32896..9951375677c 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -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_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_fourn (fk_facture_fourn); diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture.sql b/htdocs/install/mysql/tables/llx_prelevement_facture.sql index dbe2cb85f84..53a329f4376 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_facture.sql @@ -20,7 +20,7 @@ create table llx_prelevement_facture ( rowid integer AUTO_INCREMENT PRIMARY KEY, fk_facture integer NULL, - fk_facture_foun integer NULL, + fk_facture_fourn integer NULL, fk_prelevement_lignes integer NOT NULL )ENGINE=innodb; diff --git a/htdocs/opensurvey/wizard/choix_autre.php b/htdocs/opensurvey/wizard/choix_autre.php index 248c44aeddd..42213af2ae2 100644 --- a/htdocs/opensurvey/wizard/choix_autre.php +++ b/htdocs/opensurvey/wizard/choix_autre.php @@ -43,10 +43,10 @@ $arrayoftypecolumn = GETPOST('typecolonne', 'array'); if (isset($_SESSION["nbrecases"])) { for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) { if (isset($arrayofchoices[$i])) { - $_SESSION["choix$i"] = $arrayofchoices[$i]; + $_SESSION["choix".$i] = $arrayofchoices[$i]; } if (isset($arrayoftypecolumn[$i])) { - $_SESSION["typecolonne$i"] = $arrayoftypecolumn[$i]; + $_SESSION["typecolonne".$i] = $arrayoftypecolumn[$i]; } } } else { //nombre de cases par défaut @@ -97,9 +97,6 @@ if (GETPOSTISSET("confirmecreation")) } } -var_dump($_SESSION); exit; - - /* * View */ diff --git a/htdocs/product/list.php b/htdocs/product/list.php index f4056984a7f..12a6c807515 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1282,31 +1282,59 @@ if ($resql) // 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) { if (!empty($arrayfields['p.sellprice'.$key]['checked'])) { print ''; - 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 - // then reuse the cache array if we need prices for other price levels - $resultp = "SELECT p.rowid, p.fk_product, p.price, p.price_ttc, p.price_level, p.date_price"; - $resultp .= " FROM ".MAIN_DB_PREFIX."product_price as p"; - $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); - } + if ($productpricescache[$obj->rowid][$key]['price_base_type'] == 'TTC') { + print price($productpricescache[$obj->rowid][$key]['price_ttc']).' '.$langs->trans("TTC"); + } else { + print price($productpricescache[$obj->rowid][$key]['price']).' '.$langs->trans("HT"); + } } print ''; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 9463aba5277..82984409325 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -127,7 +127,6 @@ class Contacts extends DolibarrApi $result = $this->contact->initAsSpecimen(); } else { $result = $this->contact->fetch('', '', '', $email); - $this->contact->fetchRoles(); } if (!$result) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 08e839ecee1..ce2689a990e 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -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 = '') { - global $db; - $obj_ret = array(); // case of external user, we force socids @@ -294,7 +292,7 @@ class Thirdparties extends DolibarrApi */ public function merge($id, $idtodelete) { - global $db, $hookmanager; + global $hookmanager; $error = 0; @@ -398,8 +396,7 @@ class Thirdparties extends DolibarrApi } // Move links - if (!$error) - { + if (!$error) { // This list is also into the societe/card.php file // TODO Mutualise the list into object societe.class.php $objects = array( @@ -433,57 +430,49 @@ class Thirdparties extends DolibarrApi { require_once DOL_DOCUMENT_ROOT.$object_file; - if (!$errors && !$object_name::replaceThirdparty($this->db, $soc_origin->id, $object->id)) - { - $errors++; + if (!$error && !$object_name::replaceThirdparty($this->db, $soc_origin->id, $object->id)) { + $error++; //setEventMessages($this->db->lasterror(), null, 'errors'); } } } // External modules should update their ones too - if (!$errors) - { + if (!$error) { $reshook = $hookmanager->executeHooks('replaceThirdparty', array( 'soc_origin' => $soc_origin->id, 'soc_dest' => $object->id ), $soc_dest, $action); - if ($reshook < 0) - { + if ($reshook < 0) { //setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $errors++; + $error++; } } - if (!$error) - { + if (!$error) { $object->context = array('merge'=>1, 'mergefromid'=>$soc_origin->id); // Call trigger $result = $object->call_trigger('COMPANY_MODIFY', $user); - if ($result < 0) - { + if ($result < 0) { //setEventMessages($object->error, $object->errors, 'errors'); $error++; } // End call triggers } - if (!$error) - { + if (!$error) { //We finally remove the old thirdparty - if ($soc_origin->delete($soc_origin->id, $user) < 1) - { - $errors++; + if ($soc_origin->delete($soc_origin->id, $user) < 1) { + $error++; } } // End of merge - if ($error) - { + if ($error) { $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.'); @@ -829,8 +818,6 @@ class Thirdparties extends DolibarrApi */ public function getOutStandingProposals($id, $mode = 'customer') { - $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } @@ -873,8 +860,6 @@ class Thirdparties extends DolibarrApi */ public function getOutStandingOrder($id, $mode = 'customer') { - $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } @@ -916,8 +901,6 @@ class Thirdparties extends DolibarrApi */ public function getOutStandingInvoices($id, $mode = 'customer') { - $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } @@ -959,8 +942,6 @@ class Thirdparties extends DolibarrApi */ public function getSalesRepresentatives($id, $mode = 0) { - $obj_ret = array(); - if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } @@ -1139,8 +1120,6 @@ class Thirdparties extends DolibarrApi */ public function getCompanyBankAccount($id) { - global $db, $conf; - if (!DolibarrApiAccess::$user->rights->facture->lire) { throw new RestException(401); } @@ -1330,58 +1309,54 @@ class Thirdparties extends DolibarrApi */ 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); + } $this->company->setDocModel(DolibarrApiAccess::$user, $model); $this->company->fk_bank = $this->company->fk_account; - $outputlangs = $this->langs; + $outputlangs = $langs; $newlang = ''; - if ($this->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 ($this->conf->global->MAIN_MULTILANGS && empty($newlang) && isset($this->company->default_lang)) $newlang = $this->company->default_lang; // for thirdparty + //if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { + 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)) { $outputlangs = new Translate("", $conf); $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 .= " FROM ".MAIN_DB_PREFIX."societe_rib"; if ($id) $sql .= " WHERE fk_soc = ".$id." "; - if ($companybankid) $sql .= " AND id = ".$companybankid.""; + if ($companybankid) $sql .= " AND rowid = ".$companybankid.""; $i = 0; $accounts = array(); $result = $this->db->query($sql); - if ($result) - { - if ($result && $this->db->num_rows($result) == 0) { + if ($result) { + if ($this->db->num_rows($result) == 0) { throw new RestException(404, 'Bank account not found'); } $num = $this->db->num_rows($result); - while ($i < $num) - { + while ($i < $num) { $obj = $this->db->fetch_object($result); $account = new CompanyBankAccount($this->db); @@ -1391,20 +1366,17 @@ class Thirdparties extends DolibarrApi $i++; } } else { - throw new RestException(404, 'Bank account not found'); + throw new RestException(500, 'Sql error '.$this->db->lasterror()); } $moreparams = array( - 'use_companybankid'=>$accounts[0]->id, - 'force_dir_output'=>$this->conf->societe->multidir_output[$this->company->entity].'/'.dol_sanitizeFileName($this->company->id) + 'use_companybankid' => $accounts[0]->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); } else { throw new RestException(500); @@ -1425,8 +1397,6 @@ class Thirdparties extends DolibarrApi */ public function getSocieteAccounts($id, $site = null) { - global $db, $conf; - if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } @@ -1502,8 +1472,6 @@ class Thirdparties extends DolibarrApi */ public function createSocieteAccount($id, $request_data = null) { - global $db; - if (!DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); } @@ -1561,8 +1529,6 @@ class Thirdparties extends DolibarrApi */ public function putSocieteAccount($id, $site, $request_data = null) { - global $db; - if (!DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); } @@ -1644,8 +1610,6 @@ class Thirdparties extends DolibarrApi */ public function patchSocieteAccount($id, $site, $request_data = null) { - global $db; - if (!DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); } @@ -1697,8 +1661,6 @@ class Thirdparties extends DolibarrApi */ public function deleteSocieteAccount($id, $site) { - global $db; - if (!DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); } @@ -1733,8 +1695,6 @@ class Thirdparties extends DolibarrApi */ public function deleteSocieteAccounts($id) { - global $db; - if (!DolibarrApiAccess::$user->rights->societe->creer) { throw new RestException(401); } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index c7cfb2c0899..81da82087ec 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -678,7 +678,10 @@ if ($action == "order" and $placeid != 0) $printer = new dolReceiptPrinter($db); } - $headerorder = '
'.$langs->trans('Place').' '.$place.'
'; + $sql = "SELECT label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) $place); + $resql = $db->query($sql); + $row = $db->fetch_object($resql); + $headerorder = '
'.$langs->trans('Place').' '.$row->label.'
'.$langs->trans("Label").''.$langs->trans("Qty").'
'; $footerorder = '
'.$langs->trans("Label").''.$langs->trans("Qty").'
'.dol_print_date(dol_now(), 'dayhour').'
'; $order_receipt_printer1 = ""; $order_receipt_printer2 = ""; @@ -695,11 +698,15 @@ if ($action == "order" and $placeid != 0) $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id'); $result = array_intersect($catsprinter1, $existing); $count = count($result); + if (!$line->fk_product) $count++; // Print Free-text item (Unassigned printer) to Printer 1 if ($count > 0) { $linestoprint++; $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='1' where rowid=".$line->id; //Set to print on printer 1 $db->query($sql); - $order_receipt_printer1 .= ''.$line->product_label.''.$line->qty; + $order_receipt_printer1 .= ''; + if ($line->fk_product) $order_receipt_printer1 .= $line->product_label; + else $order_receipt_printer1 .= $line->description; + $order_receipt_printer1 .= ''.$line->qty; if (!empty($line->array_options['options_order_notes'])) $order_receipt_printer1 .= "
(".$line->array_options['options_order_notes'].")"; $order_receipt_printer1 .= ''; } @@ -1372,4 +1379,4 @@ if ($action == "search") '; } -print '
'; +print ''; \ No newline at end of file diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index bd25ad54898..631de0a5fa8 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -99,6 +99,10 @@ class Website extends CommonObject * @var integer */ public $fk_default_home; + + /** + * @var int User Create Id + */ public $fk_user_creat; /** @@ -878,13 +882,13 @@ class Website extends CommonObject global $user; $this->id = 0; - + $this->specimen =1; $this->entity = 1; $this->ref = 'myspecimenwebsite'; $this->description = 'A specimen website'; $this->lang = 'en'; $this->otherlang = 'fr,es'; - $this->status = ''; + $this->status = 1; $this->fk_default_home = null; $this->virtualhost = 'http://myvirtualhost'; $this->fk_user_creat = $user->id; @@ -1349,8 +1353,7 @@ class Website extends CommonObject $i++; } - if ($error) - { + if ($error) { return -1; } else { return $num; diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 52c00978c54..727f8cc0ee3 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -281,7 +281,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase preg_match_all('/sql.+\s*\'"\s*\.\s*\$(.........)/', $filecontent, $matches, PREG_SET_ORDER); 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; break; }