Fix: sql request with pgsql
Fix: bug reported by scrutinizer Doxygen Start to work on multi user assigned to an event.
This commit is contained in:
parent
d74c1a81ab
commit
ad8b92541d
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/Accountingaccount.class.php
|
* \file htdocs/accountancy/class/accountingaccount.class.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Accounting Expert
|
||||||
* \brief Fichier de la classe des comptes comptable
|
* \brief Fichier de la classe des comptes comptable
|
||||||
*/
|
*/
|
||||||
@ -29,8 +29,11 @@
|
|||||||
class AccountingAccount
|
class AccountingAccount
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
var $error;
|
||||||
|
|
||||||
var $id;
|
var $id;
|
||||||
var $rowid;
|
var $rowid;
|
||||||
|
|
||||||
var $datec; // Creation date
|
var $datec; // Creation date
|
||||||
var $fk_pcg_version;
|
var $fk_pcg_version;
|
||||||
var $pcg_type;
|
var $pcg_type;
|
||||||
@ -62,8 +65,10 @@ class AccountingAccount
|
|||||||
*/
|
*/
|
||||||
function fetch($rowid = null, $account_number = null)
|
function fetch($rowid = null, $account_number = null)
|
||||||
{
|
{
|
||||||
if ($rowid || $account_number) {
|
if ($rowid || $account_number)
|
||||||
$sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE ";
|
{
|
||||||
|
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, labe, fk_user_author, fk_user_modifn active";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
|
||||||
if ($rowid) {
|
if ($rowid) {
|
||||||
$sql .= " rowid = '" . $rowid . "'";
|
$sql .= " rowid = '" . $rowid . "'";
|
||||||
} elseif ($account_number) {
|
} elseif ($account_number) {
|
||||||
@ -72,13 +77,12 @@ class AccountingAccount
|
|||||||
|
|
||||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result)
|
||||||
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ($obj)
|
||||||
|
{
|
||||||
$this->id = $obj->rowid;
|
$this->id = $obj->rowid;
|
||||||
$this->rowid = $obj->rowid;
|
$this->rowid = $obj->rowid;
|
||||||
$this->datec = $obj->datec;
|
$this->datec = $obj->datec;
|
||||||
@ -93,7 +97,20 @@ class AccountingAccount
|
|||||||
$this->fk_user_modif = $obj->fk_user_modif;
|
$this->fk_user_modif = $obj->fk_user_modif;
|
||||||
$this->active = $obj->active;
|
$this->active = $obj->active;
|
||||||
|
|
||||||
return $obj->rowid;
|
return $this->id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -88,12 +88,12 @@ $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,";
|
|||||||
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
|
$sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur, s.fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur, s.fournisseur,";
|
||||||
$sql .= " s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
$sql .= " s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn f ON f.rowid = fd.fk_facture_fourn";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
$sql .= " WHERE f.fk_statut > 0 ";
|
$sql .= " WHERE f.fk_statut > 0 ";
|
||||||
if (! empty($conf->multicompany->enabled)) {
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
$sql .= " AND f.entity = " . $conf->entity;
|
$sql .= " AND f.entity = " . $conf->entity;
|
||||||
|
|||||||
@ -90,11 +90,11 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot
|
|||||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, ";
|
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, ";
|
||||||
$sql .= " ct.accountancy_code_sell as account_tva";
|
$sql .= " ct.accountancy_code_sell as account_tva";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet fd";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture f ON f.rowid = fd.fk_facture";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc";
|
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||||
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
|
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
|
||||||
if (! empty($conf->multicompany->enabled)) {
|
if (! empty($conf->multicompany->enabled)) {
|
||||||
|
|||||||
@ -57,12 +57,14 @@ class ActionComm extends CommonObject
|
|||||||
var $punctual = 1; // Milestone
|
var $punctual = 1; // Milestone
|
||||||
var $percentage; // Percentage
|
var $percentage; // Percentage
|
||||||
var $location; // Location
|
var $location; // Location
|
||||||
|
|
||||||
var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
|
var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events)
|
||||||
var $priority; // Small int (0 By default)
|
var $priority; // Small int (0 By default)
|
||||||
var $note; // Description
|
var $note; // Description
|
||||||
|
|
||||||
var $usertodo; // Object user that must do action
|
var $userassigned; // Array of user ids
|
||||||
var $userdone; // Object user that did action
|
var $usertodo; // Object user of owner
|
||||||
|
var $userdone; // Object user that did action (deprecated)
|
||||||
|
|
||||||
var $societe; // Company linked to action (optional)
|
var $societe; // Company linked to action (optional)
|
||||||
var $contact; // Contact linked to action (optional)
|
var $contact; // Contact linked to action (optional)
|
||||||
@ -89,10 +91,10 @@ class ActionComm extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
||||||
$this->author = new stdClass();
|
//$this->author = new stdClass();
|
||||||
$this->usermod = new stdClass();
|
//$this->usermod = new stdClass();
|
||||||
$this->usertodo = new stdClass();
|
//$this->usertodo = new stdClass();
|
||||||
$this->userdone = new stdClass();
|
//$this->userdone = new stdClass();
|
||||||
$this->societe = new stdClass();
|
$this->societe = new stdClass();
|
||||||
$this->contact = new stdClass();
|
$this->contact = new stdClass();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -87,20 +87,37 @@ $hookmanager->initHooks(array('actioncard'));
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('addassignedtouser'))
|
// Remove user to assigned list
|
||||||
|
if (! empty($_POST['removedassigned']))
|
||||||
|
{
|
||||||
|
$idtoremove=$_POST['removedassigned'];
|
||||||
|
if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1);
|
||||||
|
else $tmpassigneduserids=array();
|
||||||
|
unset($tmpassigneduserids[$idtoremove]);
|
||||||
|
//var_dump($_POST['removedassigned']);exit;
|
||||||
|
$_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids);
|
||||||
|
$donotclearsession=1;
|
||||||
|
if ($action == 'add') $action = 'create';
|
||||||
|
if ($action == 'update') $action = 'edit';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add user to assigned list
|
||||||
|
if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser'))
|
||||||
{
|
{
|
||||||
// Add a new user
|
// Add a new user
|
||||||
if (GETPOST('affectedto') > 0)
|
if (GETPOST('affectedto') > 0)
|
||||||
{
|
{
|
||||||
$assignedtouser=array();
|
$assignedtouser=array();
|
||||||
if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
|
if (! empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
|
||||||
$assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1);
|
$assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1);
|
||||||
$_SESSION['assignedtouser']=dol_json_encode($assignedtouser);
|
$_SESSION['assignedtouser']=dol_json_encode($assignedtouser);
|
||||||
}
|
}
|
||||||
$donotclearsession=1;
|
$donotclearsession=1;
|
||||||
$action='create';
|
if ($action == 'add') $action = 'create';
|
||||||
|
if ($action == 'update') $action = 'edit';
|
||||||
}
|
}
|
||||||
// Add action
|
|
||||||
|
// Add event
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -131,22 +148,22 @@ if ($action == 'add')
|
|||||||
// Check parameters
|
// Check parameters
|
||||||
if (! $datef && $percentage == 100)
|
if (! $datef && $percentage == 100)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++; $donotclearsession=1;
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label'))
|
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label'))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++; $donotclearsession=1;
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialisation objet cactioncomm
|
// Initialisation objet cactioncomm
|
||||||
if (! GETPOST('actioncode'))
|
if (! GETPOST('actioncode') > 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++; $donotclearsession=1;
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
||||||
}
|
}
|
||||||
@ -161,7 +178,6 @@ if ($action == 'add')
|
|||||||
$object->priority = GETPOST("priority")?GETPOST("priority"):0;
|
$object->priority = GETPOST("priority")?GETPOST("priority"):0;
|
||||||
$object->fulldayevent = (! empty($fulldayevent)?1:0);
|
$object->fulldayevent = (! empty($fulldayevent)?1:0);
|
||||||
$object->location = GETPOST("location");
|
$object->location = GETPOST("location");
|
||||||
$object->transparency = (GETPOST("transparency")=='on'?1:0);
|
|
||||||
$object->label = trim(GETPOST('label'));
|
$object->label = trim(GETPOST('label'));
|
||||||
$object->fk_element = GETPOST("fk_element");
|
$object->fk_element = GETPOST("fk_element");
|
||||||
$object->elementtype = GETPOST("elementtype");
|
$object->elementtype = GETPOST("elementtype");
|
||||||
@ -186,18 +202,35 @@ if ($action == 'add')
|
|||||||
$object->percentage = $percentage;
|
$object->percentage = $percentage;
|
||||||
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
|
$object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60;
|
||||||
|
|
||||||
$usertodo=new User($db);
|
$listofuserid=dol_json_decode($_SESSION['assignedtouser']);
|
||||||
if ($_POST["affectedto"] > 0)
|
$i=0;
|
||||||
|
foreach($listofuserid as $key => $value)
|
||||||
{
|
{
|
||||||
$usertodo->fetch($_POST["affectedto"]);
|
if ($i == 0) // First entry
|
||||||
|
{
|
||||||
|
$usertodo=new User($db);
|
||||||
|
if ($key > 0)
|
||||||
|
{
|
||||||
|
$usertodo->fetch($key);
|
||||||
}
|
}
|
||||||
$object->usertodo = $usertodo;
|
$object->usertodo = $usertodo;
|
||||||
|
$object->transparency = (GETPOST("transparency")=='on'?1:0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0));
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||||
|
{
|
||||||
$userdone=new User($db);
|
$userdone=new User($db);
|
||||||
if ($_POST["doneby"] > 0)
|
if ($_POST["doneby"] > 0)
|
||||||
{
|
{
|
||||||
$userdone->fetch($_POST["doneby"]);
|
$userdone->fetch($_POST["doneby"]);
|
||||||
}
|
}
|
||||||
$object->userdone = $userdone;
|
$object->userdone = $userdone;
|
||||||
|
}
|
||||||
|
|
||||||
$object->note = trim($_POST["note"]);
|
$object->note = trim($_POST["note"]);
|
||||||
if (isset($_POST["contactid"])) $object->contact = $contact;
|
if (isset($_POST["contactid"])) $object->contact = $contact;
|
||||||
@ -214,16 +247,22 @@ if ($action == 'add')
|
|||||||
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
|
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
|
if (empty($object->usertodo))
|
||||||
|
{
|
||||||
|
$error++; $donotclearsession=1;
|
||||||
|
$action = 'create';
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
|
||||||
|
}
|
||||||
if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
|
if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++; $donotclearsession=1;
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! GETPOST('apyear') && ! GETPOST('adyear'))
|
if (! GETPOST('apyear') && ! GETPOST('adyear'))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++; $donotclearsession=1;
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
|
||||||
}
|
}
|
||||||
@ -265,42 +304,14 @@ if ($action == 'add')
|
|||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$error=$langs->trans($object->error);
|
$error=$langs->trans($object->error);
|
||||||
setEventMessage($error,'errors');
|
setEventMessage($error,'errors');
|
||||||
$action = 'create';
|
$action = 'create'; $donotclearsession=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
$langs->load("errors");
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$action = 'create'; $donotclearsession=1;
|
||||||
if (! empty($object->error)) setEventMessage($langs->trans($object->error), 'errors');
|
|
||||||
if (count($object->errors)) setEventMessage($object->errors, 'errors');
|
|
||||||
|
|
||||||
$action = 'create';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Action suppression de l'action
|
|
||||||
*/
|
|
||||||
if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
|
||||||
{
|
|
||||||
$object->fetch($id);
|
|
||||||
|
|
||||||
if ($user->rights->agenda->myactions->delete
|
|
||||||
|| $user->rights->agenda->allactions->delete)
|
|
||||||
{
|
|
||||||
$result=$object->delete();
|
|
||||||
|
|
||||||
if ($result >= 0)
|
|
||||||
{
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setEventMessage($object->error,'errors');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -348,25 +359,59 @@ if ($action == 'update')
|
|||||||
|
|
||||||
if (! $datef && $percentage == 100)
|
if (! $datef && $percentage == 100)
|
||||||
{
|
{
|
||||||
$error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd"));
|
$error++; $donotclearsession=1;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),$object->errors,'errors');
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
$usertodo=new User($db);
|
$listofuserid=dol_json_decode($_SESSION['assignedtouser']);
|
||||||
if ($_POST["affectedto"])
|
$i=0;
|
||||||
|
foreach($listofuserid as $key => $value)
|
||||||
{
|
{
|
||||||
$usertodo->fetch($_POST["affectedto"]);
|
if ($i == 0) // First entry
|
||||||
|
{
|
||||||
|
$usertodo=new User($db);
|
||||||
|
if ($key > 0)
|
||||||
|
{
|
||||||
|
$usertodo->fetch($key);
|
||||||
}
|
}
|
||||||
$object->usertodo = $usertodo;
|
$object->usertodo = $usertodo;
|
||||||
$object->transparency=(GETPOST("transparency")=='on'?1:0);
|
$object->transparency=(GETPOST("transparency")=='on'?1:0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0));
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||||
|
{
|
||||||
$userdone=new User($db);
|
$userdone=new User($db);
|
||||||
if ($_POST["doneby"])
|
if ($_POST["doneby"])
|
||||||
{
|
{
|
||||||
$userdone->fetch($_POST["doneby"]);
|
$userdone->fetch($_POST["doneby"]);
|
||||||
}
|
}
|
||||||
$object->userdone = $userdone;
|
$object->userdone = $userdone;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
if (! GETPOST('actioncode') > 0)
|
||||||
|
{
|
||||||
|
$error++; $donotclearsession=1;
|
||||||
|
$action = 'edit';
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result=$cactioncomm->fetch(GETPOST('actioncode'));
|
||||||
|
}
|
||||||
|
if (empty($object->usertodo))
|
||||||
|
{
|
||||||
|
$error++; $donotclearsession=1;
|
||||||
|
$action = 'edit';
|
||||||
|
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
@ -383,17 +428,13 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
setEventMessages($object->error,$object->errors,'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result < 0)
|
if (! $error)
|
||||||
{
|
|
||||||
setEventMessage($object->error,'errors');
|
|
||||||
setEventMessage($object->errors,'errors');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (! empty($backtopage))
|
if (! empty($backtopage))
|
||||||
{
|
{
|
||||||
@ -403,6 +444,30 @@ if ($action == 'update')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* delete event
|
||||||
|
*/
|
||||||
|
if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
||||||
|
{
|
||||||
|
$object->fetch($id);
|
||||||
|
|
||||||
|
if ($user->rights->agenda->myactions->delete
|
||||||
|
|| $user->rights->agenda->allactions->delete)
|
||||||
|
{
|
||||||
|
$result=$object->delete();
|
||||||
|
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error,$object->errors,'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action move update, used when user move an event in calendar by drag'n drop
|
* Action move update, used when user move an event in calendar by drag'n drop
|
||||||
*/
|
*/
|
||||||
@ -576,15 +641,14 @@ if ($action == 'create')
|
|||||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
|
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="3"><input type="text" name="location" size="50" value="'.(GETPOST('location')?GETPOST('location'):$object->location).'"></td></tr>';
|
||||||
|
|
||||||
// Assigned to
|
// Assigned to
|
||||||
$var=false;
|
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
|
||||||
if (empty($donotclearsession))
|
if (empty($donotclearsession))
|
||||||
{
|
{
|
||||||
$assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
|
$assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id);
|
||||||
$_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1)));
|
$_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1)));
|
||||||
}
|
}
|
||||||
//print $form->select_dolusers_forevent('affectedto',1);
|
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1);
|
||||||
print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
|
//print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -599,7 +663,7 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Realised by
|
// Realised by
|
||||||
if ($conf->global->AGENDA_ENABLE_DONEBY)
|
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||||
{
|
{
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td>';
|
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td>';
|
||||||
print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1);
|
print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1);
|
||||||
@ -704,11 +768,6 @@ if ($action == 'create')
|
|||||||
// View or edit
|
// View or edit
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
if ($error)
|
|
||||||
{
|
|
||||||
dol_htmloutput_errors($error);
|
|
||||||
}
|
|
||||||
|
|
||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
$object->fetch_optionals($id,$extralabels);
|
$object->fetch_optionals($id,$extralabels);
|
||||||
|
|
||||||
@ -833,7 +892,14 @@ if ($id > 0)
|
|||||||
|
|
||||||
// Assigned to
|
// Assigned to
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
|
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td colspan="3">';
|
||||||
print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1);
|
$listofuserid=array();
|
||||||
|
if (empty($donotclearsession))
|
||||||
|
{
|
||||||
|
if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency);
|
||||||
|
$_SESSION['assignedtouser']=dol_json_encode($listofuserid);
|
||||||
|
}
|
||||||
|
print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1);
|
||||||
|
//print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table><br><br><table class="border" width="100%">';
|
print '</table><br><br><table class="border" width="100%">';
|
||||||
@ -844,7 +910,7 @@ if ($id > 0)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Realised by
|
// Realised by
|
||||||
if ($conf->global->AGENDA_ENABLE_DONEBY)
|
if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
|
||||||
{
|
{
|
||||||
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
|
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
|
||||||
print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1);
|
print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1);
|
||||||
|
|||||||
@ -3164,7 +3164,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
|
$sql.= ' p.ref as product_ref, p.fk_product_type, p.label as product_label,';
|
||||||
$sql.= ' p.description as product_desc';
|
$sql.= ' p.description as product_desc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON l.fk_product=p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||||
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
$sql.= ' WHERE l.fk_facture = '.$this->id;
|
||||||
$sql.= ' ORDER BY l.rang ASC, l.rowid';
|
$sql.= ' ORDER BY l.rang ASC, l.rowid';
|
||||||
|
|
||||||
|
|||||||
@ -104,11 +104,11 @@ $sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_t
|
|||||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||||
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
||||||
$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly";
|
$sql.= " ct.accountancy_code_buy as account_tva, ct.recuperableonly";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva as ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn";
|
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
|
$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc" ;
|
||||||
$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity;
|
$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity;
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||||
else $sql.= " AND f.type IN (0,1,2,3)";
|
else $sql.= " AND f.type IN (0,1,2,3)";
|
||||||
|
|||||||
@ -105,10 +105,10 @@ $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd
|
|||||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||||
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
|
$sql.= " ct.accountancy_code_sell as account_tva, ct.recuperableonly";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
|
$sql.= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
|
$sql.= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND fd.info_bits = ct.recuperableonly AND ct.fk_pays = '".$idpays."'";
|
||||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||||
$sql.= " AND f.fk_statut > 0";
|
$sql.= " AND f.fk_statut > 0";
|
||||||
|
|||||||
@ -1289,7 +1289,7 @@ class Form
|
|||||||
* @return string HTML select string
|
* @return string HTML select string
|
||||||
* @see select_dolgroups
|
* @see select_dolgroups
|
||||||
*/
|
*/
|
||||||
function select_dolusers_forevent($htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
|
function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@ -1297,18 +1297,24 @@ class Form
|
|||||||
|
|
||||||
// Method with no ajax
|
// Method with no ajax
|
||||||
//$out.='<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
//$out.='<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
$out.='<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
|
||||||
|
$out.='<script type="text/javascript" language="javascript">jQuery(document).ready(function () { jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });})</script>';
|
||||||
$out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
|
$out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
|
||||||
$out.='<input type="submit" class="button" name="addassignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
|
$out.='<input type="submit" class="button" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
|
||||||
$assignedtouser=array();
|
$assignedtouser=array();
|
||||||
if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
|
if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
|
||||||
if (count($assignedtouser)) $out.='<br>';
|
if (count($assignedtouser)) $out.='<br>';
|
||||||
|
$i=0;
|
||||||
foreach($assignedtouser as $key => $value)
|
foreach($assignedtouser as $key => $value)
|
||||||
{
|
{
|
||||||
$userstatic->fetch($key);
|
$userstatic->fetch($key);
|
||||||
$out.=$userstatic->getNomUrl(1);
|
$out.=$userstatic->getNomUrl(1);
|
||||||
|
if ($i == 0) $out.=' ('.$langs->trans("Owner").')';
|
||||||
|
$out.=' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$userstatic->id.'" class="removedassigned" id="removedassigned_'.$userstatic->id.'" name="removedassigned_'.$userstatic->id.'">';
|
||||||
//$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional"));
|
//$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional"));
|
||||||
//$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy"));
|
//$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy"));
|
||||||
$out.='<br>';
|
$out.='<br>';
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//$out.='</form>';
|
//$out.='</form>';
|
||||||
|
|||||||
@ -186,12 +186,12 @@ class Entrepot extends CommonObject
|
|||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement";
|
||||||
$sql.= " WHERE fk_entrepot = " . $this->id;
|
$sql.= " WHERE fk_entrepot = " . $this->id;
|
||||||
dol_syslog("Entrepot::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql1=$this->db->query($sql);
|
$resql1=$this->db->query($sql);
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock";
|
||||||
$sql.= " WHERE fk_entrepot = " . $this->id;
|
$sql.= " WHERE fk_entrepot = " . $this->id;
|
||||||
dol_syslog("Entrepot::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql2=$this->db->query($sql);
|
$resql2=$this->db->query($sql);
|
||||||
|
|
||||||
if ($resql1 && $resql2)
|
if ($resql1 && $resql2)
|
||||||
@ -202,8 +202,8 @@ class Entrepot extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql1=$this->db->query($sql);
|
$resql1=$this->db->query($sql);
|
||||||
|
|
||||||
// Update denormalized fields because we change content of produt_stock
|
// Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product p SET p.stock= (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$resql2=$this->db->query($sql);
|
$resql2=$this->db->query($sql);
|
||||||
@ -217,7 +217,7 @@ class Entrepot extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
return -1;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -375,7 +375,7 @@ else
|
|||||||
|
|
||||||
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,";
|
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,";
|
||||||
$sql.= " ps.pmp, ps.reel as value";
|
$sql.= " ps.pmp, ps.reel as value";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= " WHERE ps.fk_product = p.rowid";
|
$sql.= " WHERE ps.fk_product = p.rowid";
|
||||||
$sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
|
$sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse)
|
||||||
$sql.= " AND ps.fk_entrepot = ".$object->id;
|
$sql.= " AND ps.fk_entrepot = ".$object->id;
|
||||||
|
|||||||
@ -123,14 +123,21 @@ class AllTests
|
|||||||
require_once dirname(__FILE__).'/DiscountTest.php';
|
require_once dirname(__FILE__).'/DiscountTest.php';
|
||||||
$suite->addTestSuite('DiscountTest');
|
$suite->addTestSuite('DiscountTest');
|
||||||
|
|
||||||
|
require_once dirname(__FILE__).'/ContratTest.php';
|
||||||
|
$suite->addTestSuite('ContratTest');
|
||||||
|
|
||||||
|
require_once dirname(__FILE__).'/FichinterTest.php';
|
||||||
|
$suite->addTestSuite('FichinterTest');
|
||||||
|
|
||||||
|
require_once dirname(__FILE__).'/PropalTest.php';
|
||||||
|
$suite->addTestSuite('PropalTest');
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/CommandeTest.php';
|
require_once dirname(__FILE__).'/CommandeTest.php';
|
||||||
$suite->addTestSuite('CommandeTest');
|
$suite->addTestSuite('CommandeTest');
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/CommandeFournisseurTest.php';
|
require_once dirname(__FILE__).'/CommandeFournisseurTest.php';
|
||||||
$suite->addTestSuite('CommandeFournisseurTest');
|
$suite->addTestSuite('CommandeFournisseurTest');
|
||||||
|
|
||||||
require_once dirname(__FILE__).'/ContratTest.php';
|
|
||||||
$suite->addTestSuite('ContratTest');
|
|
||||||
require_once dirname(__FILE__).'/FactureTest.php';
|
require_once dirname(__FILE__).'/FactureTest.php';
|
||||||
$suite->addTestSuite('FactureTest');
|
$suite->addTestSuite('FactureTest');
|
||||||
require_once dirname(__FILE__).'/FactureRecTest.php';
|
require_once dirname(__FILE__).'/FactureRecTest.php';
|
||||||
@ -139,8 +146,7 @@ class AllTests
|
|||||||
$suite->addTestSuite('FactureTestRounding');
|
$suite->addTestSuite('FactureTestRounding');
|
||||||
require_once dirname(__FILE__).'/FactureFournisseurTest.php';
|
require_once dirname(__FILE__).'/FactureFournisseurTest.php';
|
||||||
$suite->addTestSuite('FactureFournisseurTest');
|
$suite->addTestSuite('FactureFournisseurTest');
|
||||||
require_once dirname(__FILE__).'/PropalTest.php';
|
|
||||||
$suite->addTestSuite('PropalTest');
|
|
||||||
require_once dirname(__FILE__).'/UserTest.php';
|
require_once dirname(__FILE__).'/UserTest.php';
|
||||||
$suite->addTestSuite('UserTest');
|
$suite->addTestSuite('UserTest');
|
||||||
require_once dirname(__FILE__).'/UserGroupTest.php';
|
require_once dirname(__FILE__).'/UserGroupTest.php';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user