2
0
forked from Wavyzz/dolibarr
Conflicts:
	htdocs/product/stock/replenishorders.php
This commit is contained in:
Laurent Destailleur
2019-10-29 11:43:35 +01:00
3 changed files with 29 additions and 16 deletions

View File

@@ -1843,10 +1843,15 @@ function dol_convert_file($fileinput, $ext='png', $fileoutput='')
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext; if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
$count = $image->getNumberImages(); $count = $image->getNumberImages();
if (! dol_is_file($fileoutput) || is_writeable($fileoutput)) if (! dol_is_file($fileoutput) || is_writeable($fileoutput))
{ {
$ret = $image->writeImages($fileoutput, true); try {
$ret = $image->writeImages($fileoutput, true);
}
catch(Exception $e)
{
dol_syslog($e->getMessage(), LOG_WARNING);
}
} }
else else
{ {

View File

@@ -115,6 +115,11 @@ class ExpenseReport extends CommonObject
*/ */
const STATUS_VALIDATED = 2; const STATUS_VALIDATED = 2;
/**
* Classified canceled
*/
const STATUS_CANCELED = 4;
/** /**
* Classified approved * Classified approved
*/ */
@@ -1217,10 +1222,10 @@ class ExpenseReport extends CommonObject
$this->date_debut = $this->db->jdate($objp->date_debut); $this->date_debut = $this->db->jdate($objp->date_debut);
if ($this->fk_statut != 2) if ($this->fk_statut != self::STATUS_VALIDATED)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_statut = 2"; $sql.= " SET fk_statut = ".self::STATUS_VALIDATED;
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::set_save_from_refuse sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::set_save_from_refuse sql=".$sql, LOG_DEBUG);
@@ -1255,12 +1260,12 @@ class ExpenseReport extends CommonObject
// date approval // date approval
$this->date_approve = $now; $this->date_approve = $now;
if ($this->fk_statut != 5) if ($this->fk_statut != self::STATUS_APPROVED)
{ {
$this->db->begin(); $this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = 5, fk_user_approve = ".$fuser->id.","; $sql.= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = ".self::STATUS_APPROVED.", fk_user_approve = ".$fuser->id.",";
$sql.= " date_approve='".$this->db->idate($this->date_approve)."'"; $sql.= " date_approve='".$this->db->idate($this->date_approve)."'";
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
@@ -1317,10 +1322,10 @@ class ExpenseReport extends CommonObject
$error = 0; $error = 0;
// date de refus // date de refus
if ($this->fk_statut != 99) if ($this->fk_statut != self::STATUS_REFUSED)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = 99, fk_user_refuse = ".$fuser->id.","; $sql.= " SET ref = '".$this->db->escape($this->ref)."', fk_statut = ".self::STATUS_REFUSED.", fk_user_refuse = ".$fuser->id.",";
$sql.= " date_refuse='".$this->db->idate($now)."',"; $sql.= " date_refuse='".$this->db->idate($now)."',";
$sql.= " detail_refuse='".$this->db->escape($details)."',"; $sql.= " detail_refuse='".$this->db->escape($details)."',";
$sql.= " fk_user_approve = NULL"; $sql.= " fk_user_approve = NULL";
@@ -1386,7 +1391,7 @@ class ExpenseReport extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET paid = 0"; $sql.= " SET paid = 0, fk_statut = ".self::STATUS_APPROVED;
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::set_unpaid sql=".$sql, LOG_DEBUG); dol_syslog(get_class($this)."::set_unpaid sql=".$sql, LOG_DEBUG);
@@ -1443,12 +1448,12 @@ class ExpenseReport extends CommonObject
// phpcs:enable // phpcs:enable
$error = 0; $error = 0;
$this->date_cancel = $this->db->idate(gmmktime()); $this->date_cancel = $this->db->idate(gmmktime());
if ($this->fk_statut != 4) if ($this->fk_statut != self::STATUS_CANCELED)
{ {
$this->db->begin(); $this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_statut = 4, fk_user_cancel = ".$fuser->id; $sql.= " SET fk_statut = ".self::STATUS_CANCELED.", fk_user_cancel = ".$fuser->id;
$sql.= ", date_cancel='".$this->db->idate($this->date_cancel)."'"; $sql.= ", date_cancel='".$this->db->idate($this->date_cancel)."'";
$sql.= " ,detail_cancel='".$this->db->escape($detail)."'"; $sql.= " ,detail_cancel='".$this->db->escape($detail)."'";
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;

View File

@@ -1,8 +1,9 @@
<?php <?php
/* /*
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -153,7 +154,9 @@ if (GETPOST('statut', 'int')) {
$sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut'; $sql .= ' GROUP BY cf.rowid, cf.ref, cf.date_creation, cf.fk_statut';
$sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom'; $sql .= ', cf.total_ttc, cf.fk_user_author, u.login, s.rowid, s.nom';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit+1, $offset); if (! $sproduct) {
$sql .= $db->plimit($limit+1, $offset);
}
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@@ -269,7 +272,7 @@ if ($resql)
$userstatic = new User($db); $userstatic = new User($db);
while ($i < min($num,$conf->liste_limit)) while ($i < min($num, $sproduct?$num:$conf->liste_limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);