From e2072999cf88313ae82996b803205d66dc831ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Stride?= Date: Fri, 28 Aug 2015 17:12:27 +0200 Subject: [PATCH 01/13] ADD : ref_supplier to object property, otherwise not visibly updated on change --- htdocs/fourn/commande/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 29b8d809123..5ad7b3cbe1f 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -121,6 +121,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { + $object->ref_supplier=GETPOST('ref_supplier','alpha'); // ADD : ref_supplier to object property, otherwise not visibly updated on change $result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha')); if ($result < 0) dol_print_error($db, $object->error); } From 1a3d8b5ae435fbf5197498c5659ec053e06bf683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Stride?= Date: Mon, 31 Aug 2015 09:25:39 +0200 Subject: [PATCH 02/13] FIX : adjusted test for affecting supplier reference --- htdocs/fourn/commande/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 5ad7b3cbe1f..4daacc43f8a 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -121,9 +121,10 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { - $object->ref_supplier=GETPOST('ref_supplier','alpha'); // ADD : ref_supplier to object property, otherwise not visibly updated on change + $result=$object->setValueFrom('ref_supplier',GETPOST('ref_supplier','alpha')); 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 From 1a08f65942da6cd9ff766a967fafad169d056d92 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 2 Sep 2015 17:22:19 +0200 Subject: [PATCH 03/13] Fix: problem with pagination --- htdocs/product/stock/replenish.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index efb008df4ff..5cf237050dd 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -57,6 +57,9 @@ $texte = ''; $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); +if ($page == -1) { $page = 0; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; if (!$sortfield) { $sortfield = 'p.ref'; @@ -65,11 +68,6 @@ if (!$sortfield) { if (!$sortorder) { $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->plimit($limit, $offset); +$sql.= $db->plimit($limit + 1, $offset); //print $sql; $resql = $db->query($sql); From 50184babb95a19ff01efb76696b3e3b60441af8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 1 Sep 2015 16:38:53 +0200 Subject: [PATCH 04/13] FIX [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask Close #2893 --- htdocs/compta/facture/class/facture.class.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f5a7c27ecd1..72103f6ac5a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2558,15 +2558,16 @@ class Facture extends CommonInvoice $numref = ""; $numref = $obj->getNextValue($soc,$this,$mode); - if ($numref != "") - { - return $numref; - } - else - { + /** + * $numref can be empty in case we ask for the last value because if there is no invoice created with the + * set up mask. + */ + if ($mode != 'last' && !$numref) { dol_print_error($db,"Facture::getNextNumRef ".$obj->error); return ""; } + + return $numref; } else { From bd21cf5d68c764f989e1fbea8a5125d0ca6c8290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 3 Sep 2015 11:58:20 +0200 Subject: [PATCH 05/13] Updated changelog --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0291eeb3a21..a612e867ecb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.6.4 compared to 3.6.3 ***** +- Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask + ***** ChangeLog for 3.6.3 compared to 3.6.2 ***** - Fix: ref_ext was not saved when recording a customer order from web service - Fix: amarok is a bugged theme making dolidroid failed. We switch to eldy automatically with dolidroid. @@ -43,6 +46,7 @@ English Dolibarr ChangeLog - Fix: Not showing product supplier reference when page break - Fix: [ bug #3341 ] Missing translation in /compta/paiement_charge.php - Fix: [ bug #3342 ] Taxes dictionary page does not accept localized decimals for localtax2 rate +- Fix: [ bug ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. From 7a115c9366ea56e2239738e4cc023d17d96d6876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 3 Sep 2015 11:59:46 +0200 Subject: [PATCH 06/13] Typo --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a612e867ecb..f83979aa8e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,7 +46,6 @@ English Dolibarr ChangeLog - Fix: Not showing product supplier reference when page break - Fix: [ bug #3341 ] Missing translation in /compta/paiement_charge.php - Fix: [ bug #3342 ] Taxes dictionary page does not accept localized decimals for localtax2 rate -- Fix: [ bug ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. From 8bf093a7ce38584072701a3ada62d96afb8dfb41 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 3 Sep 2015 12:12:10 +0200 Subject: [PATCH 07/13] fix : Typo --- htdocs/core/modules/modHoliday.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index e45b40a3f57..bacbd28141b 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -141,7 +141,7 @@ class modHoliday extends DolibarrModules $r++; $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][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) From fed70b1376d640ff8a2e16eb1764971c7e9bcc06 Mon Sep 17 00:00:00 2001 From: philippe grand Date: Thu, 3 Sep 2015 12:57:57 +0200 Subject: [PATCH 08/13] translation missing --- htdocs/holiday/card.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index bbffe26cf9c..c887c111ed2 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -51,12 +51,12 @@ $now=dol_now(); * Actions */ -// Si création de la demande +// If create a request if ($action == 'create') { $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))) { $error++; @@ -81,21 +81,21 @@ if ($action == 'create') $description = trim(GETPOST('description')); $userID = GETPOST('userID'); - // Si pas de date de début + // If no start date if (empty($date_debut)) { header('Location: card.php?action=request&error=nodatedebut'); exit; } - // Si pas de date de fin + // If no end date if (empty($date_fin)) { header('Location: card.php?action=request&error=nodatefin'); exit; } - // Si date de début après la date de fin + // If start date after end date if ($date_debut > $date_fin) { header('Location: card.php?action=request&error=datefin'); @@ -110,7 +110,7 @@ if ($action == 'create') 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); if($nbopenedday < 0.5) { @@ -118,7 +118,7 @@ if ($action == 'create') exit; } - // Si pas de validateur choisi + // If no validator designated if ($valideur < 1) { header('Location: card.php?action=request&error=Valideur'); @@ -134,7 +134,7 @@ if ($action == 'create') $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) { header('Location: card.php?id='.$verif); @@ -142,7 +142,7 @@ if ($action == 'create') } 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); exit; } @@ -162,7 +162,7 @@ if ($action == 'update') else if ($starthalfday == 'afternoon') $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) { 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)); - // Si en attente de validation + // If under validation 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) { $valideur = $_POST['valideur']; $description = trim($_POST['description']); - // Si pas de date de début + // If no start date if (empty($_POST['date_debut_'])) { header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut'); exit; } - // Si pas de date de fin + // If no end date if (empty($_POST['date_fin_'])) { header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin'); exit; } - // Si date de début après la date de fin + // If start date after end date if ($date_debut > $date_fin) { header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin'); exit; } - // Si pas de valideur choisi + // If no validator designated if ($valideur < 1) { header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur'); 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); if ($nbopenedday < 0.5) { @@ -230,7 +230,7 @@ if ($action == 'update') } 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); 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($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)); - // Si c'est bien un brouillon + // If this is a rough draft if ($cp->statut == 1 || $cp->statut == 3) { // Si l'utilisateur à le droit de lire cette demande, il peut la supprimer From 8076ea85eab97f6c27859de0ed0b28f7ab8faf50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Sep 2015 20:07:17 +0200 Subject: [PATCH 09/13] 3.6.4 was packaged --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 73f3ae3e77a..0e23287ac31 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.4'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.6.5'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants From b268ccf064b453974ea197a013e3b46f7ee2b809 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 6 Sep 2015 04:52:03 +0200 Subject: [PATCH 10/13] Fix #3455 In advanced accounting module, button transfer to general ledger don't work --- .../accountancy/class/bookkeeping.class.php | 58 +++++++++++++++---- htdocs/accountancy/journal/bankjournal.php | 2 + .../accountancy/journal/purchasesjournal.php | 3 + htdocs/accountancy/journal/sellsjournal.php | 3 + 4 files changed, 54 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 9dcba514ae1..2e6c300d004 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Olivier Geffroy - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -225,6 +225,8 @@ class BookKeeping */ function create($user='') { + global $conf; + $this->piece_num = 0; // first check if line not yet in bookkeeping @@ -278,13 +280,45 @@ class BookKeeping $this->date_create = $now; } - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping (doc_date, "; - $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 .= " VALUES ('" . $this->doc_date . "','" . $this->doc_type . "','" . $this->doc_ref . "'," . $this->fk_doc . ","; - $sql .= $this->fk_docdet . ",'" . $this->code_tiers . "','" . $this->numero_compte . "','" . $this->db->escape($this->label_compte) . "',"; - $sql .= $this->debit . "," . $this->credit . "," . $this->montant . ",'" . $this->sens . "'," . $user->id . ", '"; - $sql .= $this->date_create . "','" . $this->code_journal . "'," . $this->piece_num . ")"; + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_bookkeeping ("; + + $sql .= "doc_date"; + $sql .= ", doc_type"; + $sql .= ", doc_ref"; + $sql .= ", fk_doc"; + $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); $resql = $this->db->query($sql); @@ -296,19 +330,19 @@ class BookKeeping $result = 0; } else { $result = - 2; - dol_syslog("BookKeeping::Create Erreur $result lecture ID"); + dol_syslog("BookKeeping::Create Error $result lecture ID"); } } else { $result = - 1; - dol_syslog("BookKeeping::Create Erreur $result INSERT Mysql"); + dol_syslog("BookKeeping::Create Error $result INSERT Mysql"); } } else { $result = - 3; - dol_syslog("BookKeeping::Create Erreur $result SELECT Mysql"); + dol_syslog("BookKeeping::Create Error $result SELECT Mysql"); } } else { $result = - 5; - dol_syslog("BookKeeping::Create Erreur $result SELECT Mysql"); + dol_syslog("BookKeeping::Create Error $result SELECT Mysql"); } return $result; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 8125f6ef14d..ac6317d9d1f 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -286,6 +286,7 @@ if ($action == 'writeBookKeeping') $bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->credit = ($mt < 0 ? - $mt : 0); $bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL; + $bookkeeping->fk_user_author = $user->id; if ($tabtype[$key] == 'payment') { @@ -336,6 +337,7 @@ if ($action == 'writeBookKeeping') $bookkeeping->debit = ($mt < 0 ? - $mt : 0); $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_BANK_JOURNAL; + $bookkeeping->fk_user_author = $user->id; if ($tabtype[$key] == 'sc') { $bookkeeping->code_tiers = ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 8b9b7929db8..705434365fa 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -177,6 +177,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; + $bookkeeping->fk_user_author = $user->id; $bookkeeping->create(); } @@ -202,6 +203,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; + $bookkeeping->fk_user_author = $user->id; $bookkeeping->create(); } @@ -228,6 +230,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; + $bookkeeping->fk_user_author = $user->id; $bookkeeping->create(); } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index d80e8f36562..1dd6975ea34 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -188,6 +188,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->credit = ($mt < 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; + $bookkeeping->fk_user_author = $user->id; $bookkeeping->create(); } @@ -213,6 +214,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; + $bookkeeping->fk_user_author = $user->id; $bookkeeping->create(); } @@ -238,6 +240,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt < 0) ? $mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; + $bookkeeping->fk_user_author = $user->id; $bookkeeping->create(); } From a4a72d64c033a775d031628c500d503d0f436fe5 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 6 Sep 2015 06:43:40 +0200 Subject: [PATCH 11/13] New: Accountancy Add message when general ledger is witten --- htdocs/accountancy/journal/bankjournal.php | 2 +- .../accountancy/journal/purchasesjournal.php | 23 ++++++++++++++++--- htdocs/accountancy/journal/sellsjournal.php | 23 ++++++++++++++++--- htdocs/langs/en_US/accountancy.lang | 3 ++- 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index ac6317d9d1f..c97cde97b14 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -402,7 +402,7 @@ if ($action == 'writeBookKeeping') } if (empty($error)) { - setEventMessage($langs->trans('Success'), 'mesgs'); + setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs'); } } // Export diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 705434365fa..14e77e20f3f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -157,6 +157,7 @@ if ($result) { // Bookkeeping Write if ($action == 'writebookkeeping') { $now = dol_now(); + $error = 0; foreach ( $tabfac as $key => $val ) { foreach ( $tabttc[$key] as $k => $mt ) { @@ -179,7 +180,11 @@ if ($action == 'writebookkeeping') { $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 @@ -205,7 +210,11 @@ if ($action == 'writebookkeeping') { $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'); + } } } } @@ -232,10 +241,18 @@ if ($action == 'writebookkeeping') { $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'); + } } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 1dd6975ea34..9eb6d67f56b 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -170,6 +170,7 @@ if ($result) { // Bookkeeping Write if ($action == 'writebookkeeping') { $now = dol_now(); + $error = 0; foreach ( $tabfac as $key => $val ) { foreach ( $tabttc[$key] as $k => $mt ) { @@ -190,7 +191,11 @@ if ($action == 'writebookkeeping') { $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 @@ -216,7 +221,11 @@ if ($action == 'writebookkeeping') { $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'); + } } } } @@ -242,10 +251,18 @@ if ($action == 'writebookkeeping') { $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 if ($action == 'export_csv') { diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index b09dab7f764..57ce6b09201 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -157,4 +157,5 @@ ValidateHistory=Validate Automatically ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used -FicheVentilation=Breakdown card \ No newline at end of file +FicheVentilation=Breakdown card +GeneralLedgerIsWritten=Operations are written in the general ledger \ No newline at end of file From 89b723b2a778e1ba4c8d910840fda2e304c92e7f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 8 Sep 2015 16:23:00 +0200 Subject: [PATCH 12/13] FIX : multientity warehouse management --- htdocs/core/modules/modStock.class.php | 2 +- htdocs/product/class/html.formproduct.class.php | 2 +- htdocs/product/stock/index.php | 4 ++-- htdocs/product/stock/list.php | 2 +- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/product.php | 2 +- htdocs/product/stock/valo.php | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 43c7cec6fb3..8f6840a21b0 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -131,7 +131,7 @@ class modStock extends DolibarrModules $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] .=' 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 diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 69e999b18ea..534e679814a 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -72,7 +72,7 @@ class FormProduct $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_entrepot = e.rowid"; $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.= " ORDER BY e.label"; diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index dc394f898dc..5c149988cfe 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -63,7 +63,7 @@ print "
"; $sql = "SELECT e.label, e.rowid, e.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $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->plimit(15, 0); @@ -118,7 +118,7 @@ $sql.= ", ".MAIN_DB_PREFIX."stock_mouvement as m"; $sql.= ", ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE m.fk_product = p.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"; $sql.= $db->order("datem","DESC"); $sql.= $db->plimit($max,0); diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index c85c501fa58..963974e1dd8 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -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.= " 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.= " WHERE e.entity = ".$conf->entity; +$sql.= " WHERE e.entity IN (".getEntity('stock',1).')'; if ($sref) { $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 5622899c052..39a6271d8cd 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -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.= " WHERE m.fk_product = p.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 ($id) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 6dad4256aef..73d38fa16a4 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -687,7 +687,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; $sql.= " ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= " WHERE ps.reel != 0"; $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.= " ORDER BY e.label"; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 6f5cb7ae578..7c73da3794c 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -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.= " 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.= " WHERE e.entity = ".$conf->entity; +$sql.= " WHERE e.entity IN (".getEntity('stock',1).')'; if ($sref) { $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; From 355fcc78cf2fae81ebcc8aea7a86fadea9f803be Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 8 Sep 2015 20:48:31 +0200 Subject: [PATCH 13/13] Fix #3475 RemiseCheque: Undefined variable $date --- htdocs/compta/paiement/cheque/class/remisecheque.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 917c88e0743..f469b48fdde 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2015 Juanjo Menent * * 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 @@ -744,7 +744,6 @@ class RemiseCheque extends CommonObject $resql=$this->db->query($sql); if ($resql) { - $this->date_bordereau = $date; return 1; } else