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

This commit is contained in:
Laurent Destailleur 2015-09-09 13:26:35 +02:00
commit 8c1760fbcf
19 changed files with 154 additions and 77 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -225,6 +225,8 @@ class BookKeeping
*/ */
function create($user='') function create($user='')
{ {
global $conf;
$this->piece_num = 0; $this->piece_num = 0;
// first check if line not yet in bookkeeping // first check if line not yet in bookkeeping
@ -278,13 +280,45 @@ class BookKeeping
$this->date_create = $now; $this->date_create = $now;
} }
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping (doc_date, "; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping (";
$sql .= "doc_type, doc_ref,fk_doc,fk_docdet,code_tiers,numero_compte,label_compte,";
$sql .= "debit,credit,montant,sens,fk_user_author,import_key,code_journal,piece_num)"; $sql .= "doc_date";
$sql .= " VALUES ('" . $this->doc_date . "','" . $this->doc_type . "','" . $this->doc_ref . "'," . $this->fk_doc . ","; $sql .= ", doc_type";
$sql .= $this->fk_docdet . ",'" . $this->code_tiers . "','" . $this->numero_compte . "','" . $this->db->escape($this->label_compte) . "',"; $sql .= ", doc_ref";
$sql .= $this->debit . "," . $this->credit . "," . $this->montant . ",'" . $this->sens . "'," . $user->id . ", '"; $sql .= ", fk_doc";
$sql .= $this->date_create . "','" . $this->code_journal . "'," . $this->piece_num . ")"; $sql .= ", fk_docdet";
$sql .= ", code_tiers";
$sql .= ", numero_compte";
$sql .= ", label_compte";
$sql .= ", debit";
$sql .= ", credit";
$sql .= ", montant";
$sql .= ", sens";
$sql .= ", fk_user_author";
$sql .= ", import_key";
$sql .= ", code_journal";
$sql .= ", piece_num";
$sql .= ") VALUES (";
$sql .= "'" . $this->doc_date . "'";
$sql .= ",'" . $this->doc_type . "'";
$sql .= ",'" . $this->doc_ref . "'";
$sql .= "," . $this->fk_doc;
$sql .= "," . $this->fk_docdet;
$sql .= ",'" . $this->code_tiers . "'";
$sql .= ",'" . $this->numero_compte . "'";
$sql .= ",'" . $this->db->escape($this->label_compte) . "'";
$sql .= "," . $this->debit;
$sql .= "," . $this->credit;
$sql .= "," . $this->montant;
$sql .= ",'" . $this->sens . "'";
$sql .= ",'" . $this->fk_user_author."'";
$sql .= ",'" . $this->date_create . "'";
$sql .= ",'" . $this->code_journal . "'";
$sql .= "," . $this->piece_num;
$sql .= ")";
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -296,19 +330,19 @@ class BookKeeping
$result = 0; $result = 0;
} else { } else {
$result = - 2; $result = - 2;
dol_syslog("BookKeeping::Create Erreur $result lecture ID"); dol_syslog("BookKeeping::Create Error $result lecture ID");
} }
} else { } else {
$result = - 1; $result = - 1;
dol_syslog("BookKeeping::Create Erreur $result INSERT Mysql"); dol_syslog("BookKeeping::Create Error $result INSERT Mysql");
} }
} else { } else {
$result = - 3; $result = - 3;
dol_syslog("BookKeeping::Create Erreur $result SELECT Mysql"); dol_syslog("BookKeeping::Create Error $result SELECT Mysql");
} }
} else { } else {
$result = - 5; $result = - 5;
dol_syslog("BookKeeping::Create Erreur $result SELECT Mysql"); dol_syslog("BookKeeping::Create Error $result SELECT Mysql");
} }
return $result; return $result;

View File

@ -286,6 +286,7 @@ if ($action == 'writeBookKeeping')
$bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0); $bookkeeping->credit = ($mt < 0 ? - $mt : 0);
$bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
if ($tabtype[$key] == 'payment') { if ($tabtype[$key] == 'payment') {
@ -336,6 +337,7 @@ if ($action == 'writeBookKeeping')
$bookkeeping->debit = ($mt < 0 ? - $mt : 0); $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
if ($tabtype[$key] == 'sc') { if ($tabtype[$key] == 'sc') {
$bookkeeping->code_tiers = ''; $bookkeeping->code_tiers = '';
@ -400,7 +402,7 @@ if ($action == 'writeBookKeeping')
} }
if (empty($error)) { if (empty($error)) {
setEventMessage($langs->trans('Success'), 'mesgs'); setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
} }
} }
// Export // Export

View File

@ -157,6 +157,7 @@ if ($result) {
// Bookkeeping Write // Bookkeeping Write
if ($action == 'writebookkeeping') { if ($action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0;
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
@ -177,8 +178,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->debit = ($mt <= 0) ? $mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
// Product / Service // Product / Service
@ -202,8 +208,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
} }
} }
@ -228,11 +239,20 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
} }
} }
if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
}
} }

View File

@ -170,6 +170,7 @@ if ($result) {
// Bookkeeping Write // Bookkeeping Write
if ($action == 'writebookkeeping') { if ($action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0;
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
@ -188,8 +189,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? $mt : 0; $bookkeeping->credit = ($mt < 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
// Product / Service // Product / Service
@ -213,8 +219,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
} }
} }
@ -238,11 +249,20 @@ if ($action == 'writebookkeeping') {
$bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? $mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->create(); $result = $bookkeeping->create();
if ($result < 0) {
$error ++;
setEventMessage($object->errors, 'errors');
}
} }
} }
} }
if (empty($error)) {
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
}
} }
// Export // Export
if ($action == 'export_csv') { if ($action == 'export_csv') {

View File

@ -2572,15 +2572,16 @@ class Facture extends CommonInvoice
$numref = ""; $numref = "";
$numref = $obj->getNextValue($soc,$this,$mode); $numref = $obj->getNextValue($soc,$this,$mode);
if ($numref != "") /**
{ * $numref can be empty in case we ask for the last value because if there is no invoice created with the
return $numref; * set up mask.
} */
else if ($mode != 'last' && !$numref) {
{
dol_print_error($db,"Facture::getNextNumRef ".$obj->error); dol_print_error($db,"Facture::getNextNumRef ".$obj->error);
return ""; return "";
} }
return $numref;
} }
else else
{ {

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2015 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
@ -742,7 +742,6 @@ class RemiseCheque extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$this->date_bordereau = $date;
return 1; return 1;
} }
else else

View File

@ -141,7 +141,7 @@ class modHoliday extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 20002; // Permission id (must not be already used) $this->rights[$r][0] = 20002; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify hollidays for everybody'; // Permission label $this->rights[$r][1] = 'Create/modify holidays for everybody'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'write_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)

View File

@ -131,7 +131,7 @@ class modStock extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_stock as ps, '.MAIN_DB_PREFIX.'entrepot as e';
$this->export_sql_end[$r] .=' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid'; $this->export_sql_end[$r] .=' WHERE p.rowid = ps.fk_product AND ps.fk_entrepot = e.rowid';
$this->export_sql_end[$r] .=' AND e.entity = '.$conf->entity; $this->export_sql_end[$r] .=' AND e.entity IN ('.getEntity('stock',1).')';
// Imports // Imports

View File

@ -121,8 +121,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
{ {
$result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha')); $result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha'));
if ($result < 0) dol_print_error($db, $object->error); if ($result < 0) dol_print_error($db, $object->error);
else $object->ref_supplier=GETPOST('ref_supplier','alpha'); // ADD : ref_supplier to object property, otherwise not visibly updated on change
} }
// conditions de reglement // conditions de reglement

View File

@ -51,12 +51,12 @@ $now=dol_now();
* Actions * Actions
*/ */
// Si création de la demande // If create a request
if ($action == 'create') if ($action == 'create')
{ {
$cp = new Holiday($db); $cp = new Holiday($db);
// Si pas le droit de créer une demande // If no right to create a request
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all))) if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
{ {
$error++; $error++;
@ -81,21 +81,21 @@ if ($action == 'create')
$description = trim(GETPOST('description')); $description = trim(GETPOST('description'));
$userID = GETPOST('userID'); $userID = GETPOST('userID');
// Si pas de date de début // If no start date
if (empty($date_debut)) if (empty($date_debut))
{ {
header('Location: card.php?action=request&error=nodatedebut'); header('Location: card.php?action=request&error=nodatedebut');
exit; exit;
} }
// Si pas de date de fin // If no end date
if (empty($date_fin)) if (empty($date_fin))
{ {
header('Location: card.php?action=request&error=nodatefin'); header('Location: card.php?action=request&error=nodatefin');
exit; exit;
} }
// Si date de début après la date de fin // If start date after end date
if ($date_debut > $date_fin) if ($date_debut > $date_fin)
{ {
header('Location: card.php?action=request&error=datefin'); header('Location: card.php?action=request&error=datefin');
@ -110,7 +110,7 @@ if ($action == 'create')
exit; exit;
} }
// Si aucun jours ouvrés dans la demande // If there is no Business Days within request
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
if($nbopenedday < 0.5) if($nbopenedday < 0.5)
{ {
@ -118,7 +118,7 @@ if ($action == 'create')
exit; exit;
} }
// Si pas de validateur choisi // If no validator designated
if ($valideur < 1) if ($valideur < 1)
{ {
header('Location: card.php?action=request&error=Valideur'); header('Location: card.php?action=request&error=Valideur');
@ -134,7 +134,7 @@ if ($action == 'create')
$verif = $cp->create($userid); $verif = $cp->create($userid);
// Si pas d'erreur SQL on redirige vers la fiche de la demande // If no SQL error we redirect to the request card
if ($verif > 0) if ($verif > 0)
{ {
header('Location: card.php?id='.$verif); header('Location: card.php?id='.$verif);
@ -142,7 +142,7 @@ if ($action == 'create')
} }
else else
{ {
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL // Otherwise we display the request form with the SQL error message
header('Location: card.php?action=request&error=SQL_Create&msg='.$cp->error); header('Location: card.php?action=request&error=SQL_Create&msg='.$cp->error);
exit; exit;
} }
@ -162,7 +162,7 @@ if ($action == 'update')
else if ($starthalfday == 'afternoon') $halfday=-1; else if ($starthalfday == 'afternoon') $halfday=-1;
else if ($endhalfday == 'morning') $halfday=1; else if ($endhalfday == 'morning') $halfday=1;
// Si pas le droit de modifier une demande // If no right to modify a request
if (! $user->rights->holiday->write) if (! $user->rights->holiday->write)
{ {
header('Location: card.php?action=request&error=CantUpdate'); header('Location: card.php?action=request&error=CantUpdate');
@ -174,40 +174,40 @@ if ($action == 'update')
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all)); $canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
// Si en attente de validation // If under validation
if ($cp->statut == 1) if ($cp->statut == 1)
{ {
// Si c'est le créateur ou qu'il a le droit de tout lire / modifier // If this is the requestor or has read/write rights
if ($canedit) if ($canedit)
{ {
$valideur = $_POST['valideur']; $valideur = $_POST['valideur'];
$description = trim($_POST['description']); $description = trim($_POST['description']);
// Si pas de date de début // If no start date
if (empty($_POST['date_debut_'])) { if (empty($_POST['date_debut_'])) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut'); header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut');
exit; exit;
} }
// Si pas de date de fin // If no end date
if (empty($_POST['date_fin_'])) { if (empty($_POST['date_fin_'])) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin'); header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin');
exit; exit;
} }
// Si date de début après la date de fin // If start date after end date
if ($date_debut > $date_fin) { if ($date_debut > $date_fin) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin'); header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin');
exit; exit;
} }
// Si pas de valideur choisi // If no validator designated
if ($valideur < 1) { if ($valideur < 1) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur'); header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur');
exit; exit;
} }
// Si pas de jours ouvrés dans la demande // If there is no Business Days within request
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday); $nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
if ($nbopenedday < 0.5) if ($nbopenedday < 0.5)
{ {
@ -230,7 +230,7 @@ if ($action == 'update')
} }
else else
{ {
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL // Otherwise we display the request form with the SQL error message
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=SQL_Create&msg='.$cp->error); header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=SQL_Create&msg='.$cp->error);
exit; exit;
} }
@ -241,7 +241,7 @@ if ($action == 'update')
} }
} }
// Si suppression de la demande // If delete of request
if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes') if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes')
{ {
if($user->rights->holiday->delete) if($user->rights->holiday->delete)
@ -255,7 +255,7 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes')
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all)); $canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
// Si c'est bien un brouillon // If this is a rough draft
if ($cp->statut == 1 || $cp->statut == 3) if ($cp->statut == 1 || $cp->statut == 3)
{ {
// Si l'utilisateur à le droit de lire cette demande, il peut la supprimer // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer

View File

@ -158,3 +158,4 @@ ValidateHistory=Validate Automatically
ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used
FicheVentilation=Breakdown card FicheVentilation=Breakdown card
GeneralLedgerIsWritten=Operations are written in the general ledger

View File

@ -72,7 +72,7 @@ class FormProduct
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_entrepot = e.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_entrepot = e.rowid";
$sql.= " AND ps.fk_product = '".$fk_product."'"; $sql.= " AND ps.fk_product = '".$fk_product."'";
} }
$sql.= " WHERE e.entity = ".$conf->entity; $sql.= " WHERE e.entity IN (".getEntity('stock',1).')';
$sql.= " AND e.statut = 1"; $sql.= " AND e.statut = 1";
$sql.= " ORDER BY e.label"; $sql.= " ORDER BY e.label";

View File

@ -63,7 +63,7 @@ print "</table></form><br>";
$sql = "SELECT e.label, e.rowid, e.statut"; $sql = "SELECT e.label, e.rowid, e.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " WHERE e.statut in (0,1)"; $sql.= " WHERE e.statut in (0,1)";
$sql.= " AND e.entity = ".$conf->entity; $sql.= " AND e.entity IN (".getEntity('stock',1).')';
$sql.= $db->order('e.statut','DESC'); $sql.= $db->order('e.statut','DESC');
$sql.= $db->plimit(15, 0); $sql.= $db->plimit(15, 0);
@ -118,7 +118,7 @@ $sql.= ", ".MAIN_DB_PREFIX."stock_mouvement as m";
$sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= ", ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE m.fk_product = p.rowid"; $sql.= " WHERE m.fk_product = p.rowid";
$sql.= " AND m.fk_entrepot = e.rowid"; $sql.= " AND m.fk_entrepot = e.rowid";
$sql.= " AND e.entity = ".$conf->entity; $sql.= " AND e.entity IN (".getEntity('stock',1).')';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0"; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0";
$sql.= $db->order("datem","DESC"); $sql.= $db->order("datem","DESC");
$sql.= $db->plimit($max,0); $sql.= $db->plimit($max,0);

View File

@ -56,7 +56,7 @@ $sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellv
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
$sql.= " WHERE e.entity = ".$conf->entity; $sql.= " WHERE e.entity IN (".getEntity('stock',1).')';
if ($sref) if ($sref)
{ {
$sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'";

View File

@ -129,7 +129,7 @@ $sql.= " ".MAIN_DB_PREFIX."stock_mouvement as m)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON m.fk_user_author = u.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON m.fk_user_author = u.rowid";
$sql.= " WHERE m.fk_product = p.rowid"; $sql.= " WHERE m.fk_product = p.rowid";
$sql.= " AND m.fk_entrepot = e.rowid"; $sql.= " AND m.fk_entrepot = e.rowid";
$sql.= " AND e.entity = ".$conf->entity; $sql.= " AND e.entity IN (".getEntity('stock',1).')';
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0"; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0";
if ($id) if ($id)
{ {

View File

@ -687,7 +687,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
$sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps";
$sql.= " WHERE ps.reel != 0"; $sql.= " WHERE ps.reel != 0";
$sql.= " AND ps.fk_entrepot = e.rowid"; $sql.= " AND ps.fk_entrepot = e.rowid";
$sql.= " AND e.entity = ".$conf->entity; $sql.= " AND e.entity IN (".getEntity('stock',1).')';
$sql.= " AND ps.fk_product = ".$product->id; $sql.= " AND ps.fk_product = ".$product->id;
$sql.= " ORDER BY e.label"; $sql.= " ORDER BY e.label";

View File

@ -57,6 +57,9 @@ $texte = '';
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
if (!$sortfield) { if (!$sortfield) {
$sortfield = 'p.ref'; $sortfield = 'p.ref';
@ -65,11 +68,6 @@ if (!$sortfield) {
if (!$sortorder) { if (!$sortorder) {
$sortorder = 'ASC'; $sortorder = 'ASC';
} }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
// Force limit to no (currently solution to solve loosing selection when using pagination. No pagination on this page)
$limit = 0;
/* /*
@ -309,7 +307,7 @@ if ($usevirtualstock)
} }
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit, $offset); $sql.= $db->plimit($limit + 1, $offset);
//print $sql; //print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@ -56,7 +56,7 @@ $sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sell
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid";
$sql.= " WHERE e.entity = ".$conf->entity; $sql.= " WHERE e.entity IN (".getEntity('stock',1).')';
if ($sref) if ($sref)
{ {
$sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'";