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

This commit is contained in:
Laurent Destailleur 2018-10-19 12:58:31 +02:00
commit 0e33f18a3a
7 changed files with 62 additions and 50 deletions

View File

@ -10,6 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -805,7 +806,7 @@ class Categorie extends CommonObject
* @param string $sortorder Sort order
* @param int $limit Limit for list
* @param int $page Page number
* @return array Array of categories
* @return array|int Array of categories, 0 if no cat, -1 on error
*/
function getListForItem($id, $type='customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
@ -974,7 +975,7 @@ class Categorie extends CommonObject
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
*
* @return array Array of categories. this->cats and this->motherof are set.
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/
function get_full_arbo($type, $markafterid=0)
{
@ -1126,7 +1127,7 @@ class Categorie extends CommonObject
*
* @param int $type Type of category (0, 1, ...)
* @param boolean $parent Just parent categories if true
* @return array Table of Object Category
* @return array|int Table of Object Category, -1 on error
*/
function get_all_categories($type=null, $parent=false)
{
@ -1441,7 +1442,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param boolean $exact Exact string search (true/false)
* @param boolean $case Case sensitive (true/false)
* @return array Array of category id
* @return array|int Array of category id, -1 if error
*/
function rechercher($id, $nom, $type, $exact = false, $case = false)
{

View File

@ -76,8 +76,8 @@ class Paiement extends CommonObject
//paiement de llx_c_paiement
public $num_paiement; // Numero du CHQ, VIR, etc...
public $num_payment; // Numero du CHQ, VIR, etc...
public $payment_id; // Id of external modepayment
public $payment_site; // name of external modepayment
public $payment_id; // Id of external modepayment
public $payment_site; // name of external modepayment
public $bank_account; // Id compte bancaire du paiement
public $bank_line; // Id de la ligne d'ecriture bancaire
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
@ -138,8 +138,8 @@ class Paiement extends CommonObject
$this->type_libelle = $obj->type_libelle;
$this->type_code = $obj->type_code;
$this->statut = $obj->statut;
$this->payment_id = $obj->ext_payment_id;
$this->payment_site = $obj->ext_payment_site;
$this->payment_id = $obj->ext_payment_id;
$this->payment_site = $obj->ext_payment_site;
$this->bank_account = $obj->fk_account; // deprecated
$this->fk_account = $obj->fk_account;
@ -233,11 +233,9 @@ class Paiement extends CommonObject
$mtotal = $totalamount;
}
$note = ($this->note_public?$this->note_public:$this->note);
$payment_id = $this->payment_id ? $this->payment_id : null;
$payment_site = $this->payment_site ? $this->payment_site : null;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, ext_payment_id, ext_payment_site, fk_user_creat)";
$sql.= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($note)."', '".$this->db->escape($this->payment_id)."', '".$this->db->escape($this->payment_site)."', ".$user->id.")";
$sql.= " VALUES (".$conf->entity.", '".$this->db->escape($this->ref)."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', ".$total.", ".$mtotal.", ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($note)."', ".($this->payment_id?"'".$this->db->escape($this->payment_id)."'":"null").", ".($this->payment_site?"'".$this->db->escape($this->payment_site)."'":"null").", ".$user->id.")";
dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG);
$resql = $this->db->query($sql);

View File

@ -38,6 +38,11 @@ abstract class CommonDocGenerator
*/
public $error='';
/**
* @var string[] Array of error strings
*/
public $errors = array();
/**
* @var DoliDB Database handler.
*/

View File

@ -4,21 +4,22 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php
@ -46,7 +47,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
public $emetteur;
/**
* @var array() Minimum version of PHP required by module.
* @var array Minimum version of PHP required by module.
* e.g.: PHP 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@ -351,6 +352,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
catch(Exception $e)
{
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
// After construction $odfHandler->contentXml contains content and
@ -366,6 +368,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
// Define substitution array
@ -402,6 +405,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
// Replace tags of lines
@ -434,9 +438,11 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
catch(SegmentException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
$listlines->merge();
@ -460,6 +466,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
}
catch(OdfException $e)
{
dol_syslog($e->getMessage(), LOG_INFO);
}
}
@ -473,7 +480,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
try {
$odfHandler->exportAsAttachedPDF($file);
}catch (Exception $e){
$this->error=$e->getMessage();
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}
@ -481,7 +489,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
try {
$odfHandler->saveToDisk($file);
}catch (Exception $e){
$this->error=$e->getMessage();
$this->error=$e->getMessage();
dol_syslog($e->getMessage(), LOG_INFO);
return -1;
}
}

View File

@ -39,10 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
*/
abstract class ModelePDFCommandes extends CommonDocGenerator
{
/**
* @var string Error code (or message)
*/
public $error='';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**

View File

@ -28,7 +28,7 @@ $out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_typ
$out .= '<div class="tagtd">'.$langs->trans("SelectResource").'</div>';
$out .= '<div class="tagtd">';
$events=array();
$out .= $formresources->select_resource_list('','fk_resource','',1,1,0,$events,'',2);
$out .= $formresources->select_resource_list('','fk_resource','',1,1,0,$events,'',2,null);
$out .= '</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy',(isset($_POST['busy'])?$_POST['busy']:1),1).'</div>';

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -63,12 +64,12 @@ class Ticketlogs// extends CommonObject
public $id;
/**
* @var int ID
* @var string trackid
*/
public $fk_track_id;
/**
* @var int ID
* @var int user create ID
*/
public $fk_user_create;
@ -104,7 +105,7 @@ class Ticketlogs// extends CommonObject
}
if (isset($this->fk_user_create)) {
$this->fk_user_create = trim($this->fk_user_create);
$this->fk_user_create = (int) $this->fk_user_create;
}
if (isset($this->message)) {
@ -143,7 +144,7 @@ class Ticketlogs// extends CommonObject
if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "ticket_logs");
if (!$notrigger) {
//if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -153,7 +154,7 @@ class Ticketlogs// extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
//}
}
// Commit or rollback
@ -232,7 +233,7 @@ class Ticketlogs// extends CommonObject
}
if (isset($this->fk_user_create)) {
$this->fk_user_create = trim($this->fk_user_create);
$this->fk_user_create = (int) $this->fk_user_create;
}
if (isset($this->message)) {
@ -261,8 +262,8 @@ class Ticketlogs// extends CommonObject
$this->errors[] = "Error " . $this->db->lasterror();
}
if (!$error) {
if (!$notrigger) {
//if (!$error) {
//if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -272,8 +273,8 @@ class Ticketlogs// extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
//}
//}
// Commit or rollback
if ($error) {
@ -303,8 +304,8 @@ class Ticketlogs// extends CommonObject
$this->db->begin();
if (!$error) {
if (!$notrigger) {
//if (!$error) {
//if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
@ -314,8 +315,8 @@ class Ticketlogs// extends CommonObject
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
//}
//}
if (!$error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "ticket_logs";
@ -351,10 +352,12 @@ class Ticketlogs// extends CommonObject
*/
public function initAsSpecimen()
{
global $user;
$this->id = 0;
$this->fk_track_id = '';
$this->fk_user_create = '';
$this->fk_user_create = $user->id;
$this->datec = '';
$this->message = '';
}