diff --git a/ChangeLog b/ChangeLog index f62facbdc3686..43203e0f938bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,12 @@ FIX: Not showing task extrafields when creating from left menu FIX [ bug #3288 ] Tasks box is not properly drawn FIX [ bug #3211 ] Outstading bill amount of a client showed wrong amounts FIX [ bug #3321 ] Users with certain permissions were shown a "forbidden access" page even if they had the rights +FIX [ bug #3426 ] Unable to create an invoice from a contract with extrafields +FIX [ bug #3431 ] Invoice bank account is not respected +FIX [ bug #3432 ] Spaces should be removed from IBAN when formatting it +FIX [ bug #3358 ] Tasks box does not work with PostgreSQL +FIX [ bug #3383 ] Company name is overlapped with company direction in PDF models +FIX [ bug #3460 ] Bank account is not saved when creating a customer invoice and facing an error message NEW: Created new ContratLigne::insert function @@ -47,11 +53,11 @@ FIX send mail, copy sendto don't read the list of contact FIX Properly escape untrusted data to prevent HTML injection. FIX send mail, copy sendto don't read the list of contact -Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose +Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to restore old path. -WARNING: +WARNING: Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40. Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost. @@ -61,7 +67,7 @@ make a Dolibarr upgrade. ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: -- New: Match other auth system: Login can be done entering login or user +- New: Match other auth system: Login can be done entering login or user email (this open the road for SSO). - New: Agenda export by project #1967. - New: Increase length of thirdparty to 128 chars. @@ -82,14 +88,14 @@ For users: - New: Can filter on status on interventions. - New: Add help info of field type into dictionary of payment types. - New: Add proposals into referer page of thirdparty. -- New: On contact list can set filter on both active and not active (no more exclusive select). +- New: On contact list can set filter on both active and not active (no more exclusive select). - New: Intervention documents are now available in ECM module. - New: Can attach supplier order to a customer order. -- New: Supervisor is now visible into user list. +- New: Supervisor is now visible into user list. - New: Add user of creation and validation on invoice export. - New: Add info page about browser. - New: Enable feature developed for 3.6 we forgot to enabled: Adding prefix - on uploaded file names. + on uploaded file names. - New: No more dependency between contract and service module. - New: [ task #867 ] Remove ESAEB external module code from core. - New: Can create proposal from an intervention. @@ -120,7 +126,7 @@ For users: Use accesskey on form search. - New: Intervention documents are now available in ECM module. - New: Add attachments on user card + in ECM module. -- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. +- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template. - New: [ task #1204 ] add Numering contrat module free (like leopard in product module). - New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice. - New: Enable supplier price log table. @@ -128,8 +134,8 @@ For users: - New: [ task #1218 ] Can drag and drop an event from calendar to change its day. - New: Optimize size of image static resources. - New: Add hourly and daily amount on user card. Add weekly working hours and salary on user card. -- New: Content of predefined email come firstly from table llx_c_email_template, then translation key. -- New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture +- New: Content of predefined email come firstly from table llx_c_email_template, then translation key. +- New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. - New: Add more search field in list of cheque deposits. - New: Add feature to order to invoice on supplier part. @@ -231,8 +237,8 @@ Dolibarr better: - Deprecated module "oscommerce" were removed. - Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php - Some field into database were renamed from "libelle" to "label". -- Table llx_c_pays were renamed into llx_c_country. -- Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after +- Table llx_c_pays were renamed into llx_c_country. +- Triggers *_BUILDDOC are removed. Building a doc is not a business event. For action after creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. - A lot of pages named fiche.php were renamed into card.php - A lot of pages named liste.php were renamed into list.php @@ -393,7 +399,7 @@ For users: - Fix: Add actions events not implemented. - Fix: Price min of composition is not supplier price min by quantity. - Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers. -- Fix: [ bug #1439 ] impossible to remove a a translation (multilanguage-feature) +- Fix: [ bug #1439 ] impossible to remove a a translation (multilanguage-feature) - New: If multilangue is enabled, mail (from propal, invoice, etc...) message is pre-defaulted in Customer language - Fix: [ bug #1459 ] _ADD_CONTACT and _DEL_CONTACT triggers do not intercept insertion when reported an error - Fix: [ bug #1478 ] BILL_PAYED trigger action does not intercept failure under some circumstances @@ -423,8 +429,8 @@ For developers: - New: A module can disable a standard ECM view. - New: Add multilang support into product webservice. - New: Add hooks on project card page. -- New: Add call_trigger method on CommonObject class. So new trigger call within object is just : -$result = $this->call_trigger($trigger_name, $user) +- New: Add call_trigger method on CommonObject class. So new trigger call within object is just : +$result = $this->call_trigger($trigger_name, $user) WARNING: Following change may create regression for some external modules, but was necessary to make Dolibarr better: diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 9dcba514ae19d..2e6c300d00459 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 @@ function fetch_all_per_mvt($piecenum) */ function create($user='') { + global $conf; + $this->piece_num = 0; // first check if line not yet in bookkeeping @@ -278,13 +280,45 @@ function create($user='') $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 @@ function create($user='') $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 8125f6ef14d21..c97cde97b1409 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -286,6 +286,7 @@ $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 @@ $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 = ''; @@ -400,7 +402,7 @@ } 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 8b9b7929db85a..14e77e20f3f39 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -157,6 +157,7 @@ // Bookkeeping Write if ($action == 'writebookkeeping') { $now = dol_now(); + $error = 0; foreach ( $tabfac as $key => $val ) { foreach ( $tabttc[$key] as $k => $mt ) { @@ -177,8 +178,13 @@ $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(); + $result = $bookkeeping->create(); + if ($result < 0) { + $error ++; + setEventMessage($object->errors, 'errors'); + } } // Product / Service @@ -202,8 +208,13 @@ $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(); + $result = $bookkeeping->create(); + if ($result < 0) { + $error ++; + setEventMessage($object->errors, 'errors'); + } } } } @@ -228,11 +239,20 @@ $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(); + $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 d80e8f3656289..9eb6d67f56be2 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -170,6 +170,7 @@ // Bookkeeping Write if ($action == 'writebookkeeping') { $now = dol_now(); + $error = 0; foreach ( $tabfac as $key => $val ) { foreach ( $tabttc[$key] as $k => $mt ) { @@ -188,8 +189,13 @@ $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(); + $result = $bookkeeping->create(); + if ($result < 0) { + $error ++; + setEventMessage($object->errors, 'errors'); + } } // Product / Service @@ -213,8 +219,13 @@ $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(); + $result = $bookkeeping->create(); + if ($result < 0) { + $error ++; + setEventMessage($object->errors, 'errors'); + } } } } @@ -238,11 +249,20 @@ $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(); + $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/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 930fee833fac8..9a98b389bd01d 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -505,7 +505,7 @@ //Mode liste -if (($action != 'create' && $action != 'add') || !$error) +if (($action != 'create' && $action != 'add') && !$error) { llxHeader(); ?> diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index b360f6b63157c..dc04004653f12 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2121,6 +2121,10 @@ print ''; // Bank Account + if (isset($_POST['fk_account'])) { + $fk_account = $_POST['fk_account']; + } + print '' . $langs->trans('BankAccount') . ''; $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b1f5c5bd89649..69c023bc8d8be 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2572,15 +2572,16 @@ function getNextNumRef($soc,$mode='next') $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 { diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 5e893fe7d1e98..e3f30fc5c0ec8 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -129,10 +129,12 @@ '__CHECK_READ__' => '', //'__LASTNAME__' => $obj2->lastname, //'__FIRSTNAME__' => $obj2->firstname, - '__REF__' => $object->ref, + '__FACREF__' => $object->ref, // For backward compatibility + '__REF__' => $object->ref, '__REFCLIENT__' => $object->thirdparty->name ); + $subject=make_substitutions($subject, $substitutionarray); $message=make_substitutions($message, $substitutionarray); $actiontypecode='AC_FAC'; @@ -160,7 +162,7 @@ } else { - //$result=$mailfile->sendfile(); + $result=$mailfile->sendfile(); if ($result) { $resultmasssend.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain " @@ -215,7 +217,6 @@ $langs->load("other"); $resultmasssend.='
'.$langs->trans('ErrorCantReadFile',$file).'
'; dol_syslog('Failed to read file: '.$file); - break ; } } } @@ -469,8 +470,8 @@ else $titre.=' ('.$langs->trans("All").')'; $link=''; - if (empty($option)) $link=''.$langs->trans("ShowUnpaidLateOnly").''; - elseif ($option == 'late') $link=''.$langs->trans("ShowUnpaidAll").''; + if (empty($option)) $link=''.$langs->trans("ShowUnpaidLateOnly").''; + elseif ($option == 'late') $link=''.$langs->trans("ShowUnpaidAll").''; print_fiche_titre($titre,$link); //print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',0); // We don't want pagination on this page diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 2359d70d07b16..e95ddc60eaa92 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -1,7 +1,8 @@ - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin +/* Copyright (C) 2001-2005 Rodolphe Quiedeville + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2015 Raphaël Doursenaud * * 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 @@ -574,7 +575,7 @@ $chargestatic->lib=$obj->libelle; $chargestatic->paye=$obj->paye; print ''.$chargestatic->getNomUrl(1).''; - print ''.dol_print_date($obj->date_ech,'day').''; + print ''.dol_print_date($db->jdate($obj->date_ech),'day').''; print ''.price($obj->amount).''; print ''.price($obj->sumpaid).''; print ''.$chargestatic->getLibStatut(3).''; @@ -915,8 +916,8 @@ $obj = $db->fetch_object($resql); $var=!$var; - print "".dol_print_date($obj->da,"day").""; - print "$obj->libelle $obj->label"; + print "".dol_print_date($db->jdate($obj->da),"day").""; + print "".$obj->libelle." ".$obj->label.""; $i++; } $db->free($resql); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 36ef0e2a1e9d6..8b3e34dd47fc4 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 @@ -742,7 +742,6 @@ function set_number($user, $number) $resql=$this->db->query($sql); if ($resql) { - $this->date_bordereau = $date; return 1; } else diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index f389b380b9973..b5aab7090d6d5 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -304,7 +304,7 @@ } else { - $sql = "SELECT s.nom, s.rowid as socid, sum(pf.amount) as amount_ttc"; + $sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; $sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f"; diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 678b3bfaa2e75..008a0ef3e2cf3 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -168,7 +168,7 @@ // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; // Amount - print "".price($obj->amount,0,$outputlangs,1,-1,-1,$conf->currency).""; + print "".price($obj->amount).""; print " "; print "\n"; @@ -177,7 +177,7 @@ $i++; } print ''.$langs->trans("Total").''; - print ''.price($total,0,$outputlangs,1,-1,-1,$conf->currency).""; + print ''.price($total).""; print " "; print ""; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ba12d039e103b..3e1e3fd1720c1 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -499,9 +499,10 @@ function update_perso($id, $user=null) */ function fetch($id, $user=0, $ref_ext='') { - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); global $langs; + dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG); + $langs->load("companies"); $sql = "SELECT c.rowid, c.fk_soc, c.ref_ext, c.civility as civility_id, c.lastname, c.firstname,"; @@ -524,7 +525,6 @@ function fetch($id, $user=0, $ref_ext='') if ($id) $sql.= " WHERE c.rowid = ". $id; elseif ($ref_ext) $sql .= " WHERE c.ref_ext = '".$this->db->escape($ref_ext)."'"; - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -565,7 +565,7 @@ function fetch($id, $user=0, $ref_ext='') $this->email = $obj->email; $this->jabberid = $obj->jabberid; - $this->skype = $obj->skype; + $this->skype = $obj->skype; $this->priv = $obj->priv; $this->mail = $obj->email; diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index 2d14a319a8028..63f96a0c513de 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -27,6 +27,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index 5bdd45c75d472..6fe4dc6017f29 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2015 Regis Houssin * * 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 @@ -26,6 +26,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); require '../../main.inc.php'; diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 3020f12f0c4ab..c2011c87d4cf4 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -136,7 +136,6 @@ function loadBox($max=5) } } else { - dol_syslog("box_prospect::loadBox not allowed de read this box content",LOG_ERR); $this->info_box_contents[0][0] = array('td' => 'align="left"', 'text' => $langs->trans("ReadPermissionNotAllowed")); } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index b0070e2a4f33a..815db7daefbef 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -80,7 +80,7 @@ function loadBox($max=5) $sql = "SELECT pt.fk_statut, count(pt.rowid) as nb, sum(ptt.task_duration) as durationtot, sum(pt.planned_workload) as plannedtot"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt"; - $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = ".date("Y")." "; + $sql.= " WHERE DATE_FORMAT(pt.datec,'%Y') = '".date("Y")."' "; $sql.= " AND pt.rowid = ptt.fk_task"; $sql.= " GROUP BY pt.fk_statut "; $sql.= " ORDER BY pt.fk_statut DESC"; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4bbe7b3aa9823..f9eeffbb0184f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1837,7 +1837,7 @@ function add_object_linked($origin=null, $origin_id=null) * @return void * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') + function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR') { global $conf; @@ -1865,11 +1865,11 @@ function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype= $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element); - if (empty($sourceid) && empty($targetid)) + /*if (empty($sourceid) && empty($targetid)) { dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERROR); return -1; - } + }*/ // Links beetween objects are stored in this table $sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; @@ -3375,6 +3375,11 @@ function fetch_optionals($rowid='',$optionsArray='') { if (empty($rowid)) $rowid=$this->id; + //To avoid SQL errors. Probably not the better solution though + if (!$this->table_element) { + return 0; + } + if (! is_array($optionsArray)) { // optionsArray not already loaded, so we load it diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 8f6847bcb9a6e..3b62556f48291 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -24,12 +24,12 @@ /** * Function get content from an URL (use proxy if proxy defined) * - * @param string $url URL to call. - * @param string $postorget 'POST', 'GET', 'HEAD' - * @param string $param Parameters of URL (x=value1&y=value2) - * @param string $followlocation 1=Follow location, 0=Do not follow - * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) - * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) + * @param string $url URL to call. + * @param string $postorget 'POST', 'GET', 'HEAD', 'PUTALREADYFORMATED' + * @param string $param Parameters of URL (x=value1&y=value2) or may be a formated content with PUTALREADYFORMATED + * @param string $followlocation 1=Follow location, 0=Do not follow + * @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....) + * @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) */ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array()) { @@ -74,10 +74,19 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea else if ($postorget == 'PUT') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' - if ( ! is_array($param) ) - parse_str($param, $array_param); + if (! is_array($param)) parse_str($param, $array_param); + else + { + dol_syslog("parameter param must be a string", LOG_WARNING); + $array_param=$param; + } curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields } + else if ($postorget == 'PUTALREADYFORMATED') + { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // param = content of post, like a xml string + } else if ($postorget == 'HEAD') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD' diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 794ba7ac2afcf..b80b06b6aaa49 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -631,7 +631,8 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default if ($account->getCountryCode() == 'IN') $ibankey="IFSC"; if (! empty($account->iban)) { - $ibanDisplay_temp = $outputlangs->convToOutputCharset($account->iban); + //Remove whitespaces to ensure we are dealing with the format we expect + $ibanDisplay_temp = str_replace(' ', '', $outputlangs->convToOutputCharset($account->iban)); $ibanDisplay = ""; for($i = 0; $i < dol_strlen($ibanDisplay_temp); $i++) @@ -1585,55 +1586,52 @@ function pdf_getLinkedObjects($object,$outputlangs) if ($objecttype == 'propal') { $outputlangs->load('propal'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefProposal"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'commande') { $outputlangs->load('orders'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref) . ($objects[$i]->ref_client ? ' ('.$objects[$i]->ref_client.')' : ''); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref) . ($elementobject->ref_client ? ' ('.$elementobject->ref_client.')' : ''); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date,'day','',$outputlangs); } } else if ($objecttype == 'contrat') { $outputlangs->load('contracts'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefContract"); - $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateContract"); - $linkedobjects[$objecttype]['date_value'] = dol_print_date($objects[$i]->date_contrat,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date_contrat,'day','',$outputlangs); } } else if ($objecttype == 'shipping') { $outputlangs->load('orders'); $outputlangs->load('sendings'); - $num=count($objects); - for ($i=0;$i<$num;$i++) + foreach($objects as $elementobject) { - $objects[$i]->fetchObjectLinked(); - $order = $objects[$i]->linkedObjects['commande'][0]; + $elementobject->fetchObjectLinked(); + $order = $elementobject->linkedObjects['commande'][0]; $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); $linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); - $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($objects[$i]->ref); + $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); $linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending"); $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); - $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($objects[$i]->date_delivery,'day','',$outputlangs); + $linkedobjects[$objecttype]['date_value'].= ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } } } diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index cbe711ab7dfc2..9365f4a96bd03 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1259,9 +1259,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index 2b8aaa2181822..670870421cbb5 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -1219,9 +1219,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index f9ad83b944d25..60636e0db2fa3 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -647,9 +647,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $this->recipient->name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($this->recipient->name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } } diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 312e8bc5e1f1f..c424d7a2ae3f9 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -652,9 +652,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetXY($blDestX,$Yoff); $pdf->MultiCell($blW,3, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information - $pdf->SetFont('','', $default_font_size - 3); - $pdf->SetXY($blDestX,$Yoff+(dol_nboflines_bis($carac_client_name,50)*4)); - $pdf->MultiCell($blW,2, $carac_client, 0, 'L'); + $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetXY($posx+2,$posy); + $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 847cf98aa36f8..25651ebc1a706 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -674,9 +674,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 6d1f5636b851a..bf565e5334148 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -868,9 +868,9 @@ function _tableau_info(&$pdf, $object, $posy, $outputlangs) // If payment mode not forced or forced to VIR, show payment with BAN if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR') { - if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) + if (! empty($object->fk_account) || ! empty($conf->global->FACTURE_RIB_NUMBER)) { - $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); + $bankid=(empty($object->fk_account)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_account); $account = new Account($this->db); $account->fetch($bankid); @@ -1506,11 +1506,13 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // Show recipient name $pdf->SetXY($posx+2,$posy+3); $pdf->SetFont('','B', $default_font_size); - $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L'); + + $posy = $pdf->getY(); // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 9f2bf42c98d85..80f4b4fc3ec9b 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -643,9 +643,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } } diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index e3e9be994117b..365fbef4cdfb7 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -854,9 +854,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 4942619b7fb5a..40f3b56f6367b 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -222,7 +222,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facturedet as fd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; @@ -278,7 +278,7 @@ function __construct($db) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uc.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON f.fk_user_valid = uv.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_extrafields as extra ON f.rowid = extra.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiement as p ON pf.fk_paiement = p.rowid'; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index e45b40a3f57c0..bacbd28141bcf 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -141,7 +141,7 @@ function __construct($db) $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) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 43c7cec6fb306..8f6840a21b0c8 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -131,7 +131,7 @@ function __construct($db) $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/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index daf6dfd7f372c..b15f5059eb45f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1389,9 +1389,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index effd8d58dbcfe..03256fbc9ee15 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -1044,9 +1044,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index f814eaefb46e4..a20971fa181aa 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1098,9 +1098,11 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetFont('','B', $default_font_size); $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L'); + $posy = $pdf->getY(); + // Show recipient information $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4)); + $pdf->SetXY($posx+2,$posy); $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); } } diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index cd2ea51285048..ea93d63532222 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -51,7 +51,9 @@ public function isActive() global $conf; try { - if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH='/usr/share/php'; + if (empty($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH)) { + $conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH=DOL_DOCUMENT_ROOT . '/includes/chromephp/'; + } set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); //print 'rrrrr'.get_include_path(); @@ -86,9 +88,9 @@ public function configure() array( 'name' => $langs->trans('IncludePath','SYSLOG_CHROMEPHP_INCLUDEPATH'), 'constant' => 'SYSLOG_CHROMEPHP_INCLUDEPATH', - 'default' => '/usr/share/php', + 'default' => DOL_DOCUMENT_ROOT . '/includes/chromephp/', 'attr' => 'size="60"', - 'example' => DOL_DOCUMENT_ROOT.'/includes/chromephp' + 'example' =>'/usr/share/php' ) ); } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 29b8d809123a4..4daacc43f8a17 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -121,8 +121,10 @@ if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer) { + $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 diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index e62402feabb50..f4adaf1ba0d19 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -264,9 +264,17 @@ $resql = $db->query($sql); if ($resql) { - while ( $row = $db->fetch_row($resql) ) + $num = $db->num_rows($resql); + $i = 0; + + if ($num) { - $products_dispatched[$row[0]] = $row[2]; + while ($i < $num) + { + $objd = $db->fetch_object($resql); + $products_dispatched[$objd->rowid] = price2num($objd->qty, 5); + $i++; + } } $db->free($resql); } @@ -322,7 +330,7 @@ } else { - $remaintodispatch=($objp->qty - $products_dispatched[$objp->rowid]); // Calculation of dispatched + $remaintodispatch=(price2num($objp->qty, 5) - $products_dispatched[$objp->rowid]); // Calculation of dispatched if ($remaintodispatch < 0) $remaintodispatch=0; if ($remaintodispatch) { diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index bbffe26cf9ccf..c887c111ed2c5 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -51,12 +51,12 @@ * 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 @@ $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 @@ 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 @@ 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 @@ $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 @@ } 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 @@ 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 @@ $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 @@ } 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 @@ } } -// 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 @@ $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 diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z new file mode 100755 index 0000000000000..df25b6497f084 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z new file mode 100755 index 0000000000000..2053dd16f0311 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensed.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z new file mode 100755 index 0000000000000..71cef637e8331 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z new file mode 100755 index 0000000000000..af54a16a09a5a Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedb.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z new file mode 100755 index 0000000000000..23445ef2f4ba7 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z new file mode 100755 index 0000000000000..37da24ac6a9f8 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedbi.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z new file mode 100755 index 0000000000000..1b98d135f6843 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z new file mode 100755 index 0000000000000..aa35d093a8470 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusanscondensedi.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z new file mode 100755 index 0000000000000..d5fff04b70447 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansextralight.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansextralight.z b/htdocs/includes/tcpdf/fonts/dejavusansextralight.z new file mode 100755 index 0000000000000..a966f6de5c413 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansextralight.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z new file mode 100755 index 0000000000000..209e2d50b7425 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmono.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmono.z b/htdocs/includes/tcpdf/fonts/dejavusansmono.z new file mode 100755 index 0000000000000..126cc9228fe34 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmono.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z new file mode 100755 index 0000000000000..76b78bc8f8b3c Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonob.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonob.z b/htdocs/includes/tcpdf/fonts/dejavusansmonob.z new file mode 100755 index 0000000000000..ef5638e2510ab Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonob.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z new file mode 100755 index 0000000000000..aa6da4149775e Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z new file mode 100755 index 0000000000000..a866f79821ada Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonobi.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z new file mode 100755 index 0000000000000..0fa53ab2eff7b Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.ctg.z differ diff --git a/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z new file mode 100755 index 0000000000000..14be5c14e57e0 Binary files /dev/null and b/htdocs/includes/tcpdf/fonts/dejavusansmonoi.z differ diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index b09dab7f7645a..57ce6b09201f6 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 diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 3cd39d4101fcf..79c241a9d7ecb 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -50,9 +50,9 @@ $startdate=$enddate=''; if (!empty($_POST['startdatemonth'])) - $startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); + $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); if (!empty($_POST['enddatemonth'])) - $enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); + $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); /* * View diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index b359287d24fd0..94b24e459f8ac 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -72,9 +72,9 @@ $startdate=$enddate=''; if (!empty($_POST['startdatemonth'])) - $startdate = dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); + $startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']); if (!empty($_POST['enddatemonth'])) - $enddate = dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); + $enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']); /* diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 69e999b18ea40..534e679814ab4 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -72,7 +72,7 @@ function loadWarehouses($fk_product=0) $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/class/product.class.php b/htdocs/product/class/product.class.php index f30874690fab2..11ecd5426ffda 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2998,7 +2998,7 @@ function load_stock() $sql = "SELECT ps.reel, ps.fk_entrepot, ps.pmp, ps.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; $sql.= ", ".MAIN_DB_PREFIX."entrepot as w"; - $sql.= " WHERE w.entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE w.entity IN (".getEntity('stock', 1).")"; $sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND ps.fk_product = ".$this->id; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 4de63ea97348e..0d74a85425bb7 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -355,7 +355,7 @@ function list_array($status=1) $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot"; - $sql.= " WHERE entity IN (".getEntity('warehouse', 1).")"; + $sql.= " WHERE entity IN (".getEntity('stock', 1).")"; $sql.= " AND statut = ".$status; $result = $this->db->query($sql); diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index dc394f898dcb2..5c149988cfe5c 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -63,7 +63,7 @@ $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."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 c85c501fa58e9..963974e1dd89b 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -56,7 +56,7 @@ $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 5622899c0529d..39a6271d8cda3 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -129,7 +129,7 @@ $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 6dad4256aef63..73d38fa16a48e 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -687,7 +687,7 @@ function init_price() $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/replenish.php b/htdocs/product/stock/replenish.php index efb008df4ff32..5cf237050ddf3 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -57,6 +57,9 @@ $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 (!$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 @@ } $sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($limit, $offset); +$sql.= $db->plimit($limit + 1, $offset); //print $sql; $resql = $db->query($sql); diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 6f5cb7ae578f4..7c73da3794c4b 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -56,7 +56,7 @@ $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)."%'";