diff --git a/.tx/config b/.tx/config index fcd276390ee..a89b56c1013 100644 --- a/.tx/config +++ b/.tx/config @@ -2,6 +2,12 @@ host = https://www.transifex.com lang_map = uz: uz_UZ +[dolibarr.accountancy] +file_filter = htdocs/langs//accountancy.lang +source_file = htdocs/langs/en_US/accountancy.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.admin] file_filter = htdocs/langs//admin.lang source_file = htdocs/langs/en_US/admin.lang diff --git a/ChangeLog b/ChangeLog index 1f07b3dc1de..531c4802c61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,7 +31,7 @@ For users: shown on main product card. - New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to create an automatic event into agenda. -- New: Add new type of event (when type of events are used, not by default) +- New: Add new type of event (when type of events are used, not by default). - New: Add country into table of thirdparties type. This will allow to provide a list of thirdparty types specific to a country (like argentina that need type A or B). @@ -42,16 +42,20 @@ For users: Differentiate text and img. Use label into quick search form. Use accesskey on form search. -- New: Intervention documents are now available in ECM module -- New: Add attachments on user card + in ECM module +- 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: [ 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 -- New: [ task #1204 ] add a External reference to contract +- 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. +- New: [ task #1204 ] add a External reference to contract. - 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 + onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. +- New: Add more search field in list of cheque deposits. - Upgrade phpexcel lib to 1.7.8 - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1470, #1472, #1473] User trigger problem @@ -70,6 +74,7 @@ For users: - Fix: [ bug #1506, #1507 ] ECM trigger error problem - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. +- New: Add dunning into accountancy report New experimental module: - New: Module Accounting Expert to manage accountancy @@ -79,7 +84,6 @@ New experimental module: Ari Elbaz Florian Henry Juanjo Menent - And to the contributors : Jeff Info 2000 euros Nord Anim 120 euros @@ -95,25 +99,25 @@ For developers: - New: Add a css style "cursorpointer". - New: Select list of users can return user into hierarchy. - New: getBrowserInfo can return type of layout of browser (classic/phone/tablet) -- New: Add hook "searchAgendaFrom". +- New: Add hook "searchAgendaFrom" and "beforePDFCreation". - New: Add trigger DON_UPDATE, DON_DELETE - New: Add country iso code on 3 chars into table of countries. - Qual: Removed hard coded rowid into data init of table llx_c_action_trigger. - LINEBILL_DELETE, LINK_DELETE, ORDER_SUPPLIER_DELETE, RESOURCE_DELETE trigger called before SQL delete - New: [ Task #1481 ] Add trigger BILL_SUPPLIER_UPDATE. - New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE. -- New: Added hook "formConfirm" and "doActions" for supplier invoice card -- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card -- New: renamed table llx_c_pays to llx_c_country & libelle field to label -- Qual: Renamed table llx_c_civilite into llx_c_civility - field civilite into label in the same table +- New: Added hook "formConfirm" and "doActions" for supplier invoice card. +- New: [ task #1511, #1426 ] Added hook "doActions" for supplier card and supplier order card. +- New: renamed table llx_c_pays to llx_c_country & libelle field to label. +- Qual: Renamed table llx_c_civilite into llx_c_civility, + field civilite into label in the same table, and field civilite into civility in other table -WARNING: Following change may create regression for some external modules, but was necessary to make +WARNING: Following changes may create regression for some external modules, but was necessary to make Dolibarr better: - Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php -- Some field into database wwere renamed from "libelle" to "label". +- 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 creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. @@ -136,6 +140,8 @@ For users: - Fix: Must unaccent strings into SEPA file. - Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: cents for indian ruppes are calle paisa and paise. +- Fix: Invoices payments may be older than invoices. +- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/build/debian/control b/build/debian/control index f4f9e12aa58..fc0cee30319 100755 --- a/build/debian/control +++ b/build/debian/control @@ -68,4 +68,4 @@ Description: Web based software to manage a company or foundation PDF exports, And a lot more modules... . - You can also add third parties external modules or develop yours. + You can also add external modules from third parties or develop yours. diff --git a/dev/skeletons/skeleton_webservice_server.php b/dev/skeletons/skeleton_webservice_server.php index 278057fd4f6..52bb46455cb 100644 --- a/dev/skeletons/skeleton_webservice_server.php +++ b/dev/skeletons/skeleton_webservice_server.php @@ -269,5 +269,4 @@ function createSkeleton($authentication,$skeleton) } // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 8ba0a69acb3..3cba3ce99cd 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -2,7 +2,8 @@ /custom* /extensions* /nltechno* -/anco* +/ancot* +/teclib* /bootstrap* /google* /multicompany* diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index c8b8c8a7d97..ca7e5f84e07 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 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 @@ -130,9 +131,6 @@ print "
\n"; * Params * */ -$list = array ( - 'ACCOUNTING_SEPARATORCSV' -); $num = count($list); if ($num) { diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 66f5efef04d..02cb262b209 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -3,7 +3,8 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) - * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 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 diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index 77b7d15e1c3..f7507cda234 100644 --- a/htdocs/accountancy/admin/journaux.php +++ b/htdocs/accountancy/admin/journaux.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Marcos García + * Copyright (C) 2014 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 diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index de3bbf5c1db..b0e5096699b 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -137,11 +137,11 @@ else { print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey')); - print '
'; + print ''; print '
'; print ''; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 82c3ec3ca10..e6ada14a7db 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/accountancy/class/Accountingaccount.class.php + * \file htdocs/accountancy/class/accountingaccount.class.php * \ingroup Accounting Expert * \brief Fichier de la classe des comptes comptable */ @@ -29,8 +29,11 @@ class AccountingAccount { var $db; + var $error; + var $id; var $rowid; + var $datec; // Creation date var $fk_pcg_version; var $pcg_type; @@ -62,8 +65,10 @@ class AccountingAccount */ function fetch($rowid = null, $account_number = null) { - if ($rowid || $account_number) { - $sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE "; + if ($rowid || $account_number) + { + $sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, labe, fk_user_author, fk_user_modifn active"; + $sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE"; if ($rowid) { $sql .= " rowid = '" . $rowid . "'"; } elseif ($account_number) { @@ -72,28 +77,40 @@ class AccountingAccount dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); - if ($result) { + if ($result) + { $obj = $this->db->fetch_object($result); - } else { - return null; + + if ($obj) + { + $this->id = $obj->rowid; + $this->rowid = $obj->rowid; + $this->datec = $obj->datec; + $this->tms = $obj->tms; + $this->fk_pcg_version = $obj->fk_pcg_version; + $this->pcg_type = $obj->pcg_type; + $this->pcg_subtype = $obj->pcg_subtype; + $this->account_number = $obj->account_number; + $this->account_parent = $obj->account_parent; + $this->label = $obj->label; + $this->fk_user_author = $obj->fk_user_author; + $this->fk_user_modif = $obj->fk_user_modif; + $this->active = $obj->active; + + return $this->id; + } + else + { + return 0; + } + } + else + { + dol_print_error($this->db); } } - $this->id = $obj->rowid; - $this->rowid = $obj->rowid; - $this->datec = $obj->datec; - $this->tms = $obj->tms; - $this->fk_pcg_version = $obj->fk_pcg_version; - $this->pcg_type = $obj->pcg_type; - $this->pcg_subtype = $obj->pcg_subtype; - $this->account_number = $obj->account_number; - $this->account_parent = $obj->account_parent; - $this->label = $obj->label; - $this->fk_user_author = $obj->fk_user_author; - $this->fk_user_modif = $obj->fk_user_modif; - $this->active = $obj->active; - - return $obj->rowid; + return -1; } /** diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 2df4d675b20..9ae070c25e0 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -1,7 +1,8 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2014 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 @@ -40,7 +41,7 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->read) accessforbidden(); // Filter diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index aff9f7aa3a7..9215d5a9d98 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -2,7 +2,8 @@ /* Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) - * Copyright (C) 2014 Florian Henry + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2014 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 @@ -43,7 +44,7 @@ $account_parent = GETPOST('account_parent'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 02602262e2c..fefed420621 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 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 @@ -44,7 +45,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f2d5a586b37..82c3a09e20a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -132,7 +132,7 @@ if ($result) { $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); $cptcli = (! empty($conf->global->COMPTA_ACCOUNT_CUSTOMER) ? $conf->global->COMPTA_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef")); $cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); - $cptsociale = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef")); + $accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef")); $tabpay = array (); $tabbq = array (); @@ -173,21 +173,26 @@ if ($result) { $tabtype[$obj->rowid] = $links[$key]['type']; - if ($links[$key]['type'] == 'payment') { + if ($links[$key]['type'] == 'payment') + { $paymentstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'payment_supplier') { + } + else if ($links[$key]['type'] == 'payment_supplier') + { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); - } else if ($links[$key]['type'] == 'company') { - + } + else if ($links[$key]['type'] == 'company') + { $societestatic->id = $links[$key]['url_id']; $societestatic->nom = $links[$key]['label']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } else if ($links[$key]['type'] == 'sc') { - + } + else if ($links[$key]['type'] == 'sc') + { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; @@ -196,7 +201,9 @@ if ($result) { if ($reg[1] == 'socialcontribution') $reg[1] = 'SocialContribution'; $chargestatic->lib = $langs->trans($reg[1]); - } else { + } + else + { $chargestatic->lib = $links[$key]['label']; } $chargestatic->ref = $chargestatic->lib; @@ -211,29 +218,33 @@ if ($result) { dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); - if ($resultmid) { + if ($resultmid) + { $objmid = $db->fetch_object($resultmid); $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; } - } else if ($links[$key]['type'] == 'payment_vat') { - + } + else if ($links[$key]['type'] == 'payment_vat') + { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } else if ($links[$key]['type'] == 'payment_salary') { - + } + else if ($links[$key]['type'] == 'payment_salary') + { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cptsociale] += $obj->amount; - } else if ($links[$key]['type'] == 'banktransfert') { - + $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; + } + else if ($links[$key]['type'] == 'banktransfert') + { $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabtp[$obj->rowid][$cpttva] += $obj->amount; } /*else { - $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; + $tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount; }*/ } $tabbq[$obj->rowid][$compta_bank] += $obj->amount; @@ -477,14 +488,14 @@ if ($action == 'export_csv') { llxHeader('', $langs->trans("BankJournal")); - $nom = $langs->trans("BankJournal"); - $nomlink = ''; + $namereport = $langs->trans("BankJournal"); + $namelink = ''; $periodlink = ''; $exportlink = ''; $builddate = time(); $description = $langs->trans("DescBankJournal") . '
'; $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); - report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); + report_header($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); print ''; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index e0c2ceb8e36..c9d21f5d9be 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -28,7 +28,7 @@ */ require '../../main.inc.php'; - + // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -88,12 +88,12 @@ $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,"; $sql .= " fd.rowid as fdid, fd.description, fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,"; $sql .= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur, s.fournisseur,"; $sql .= " s.code_compta_fournisseur, p.accountancy_code_buy , ct.accountancy_code_buy as account_tva, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det fd"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn f ON f.rowid = fd.fk_facture_fourn"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc"; +$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " WHERE f.fk_statut > 0 "; if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity = " . $conf->entity; @@ -113,13 +113,13 @@ if ($result) { // les variables $cptfour = (! empty($conf->global->COMPTA_ACCOUNT_SUPPLIER)) ? $conf->global->COMPTA_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"); $cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)) ? $conf->global->COMPTA_VAT_ACCOUNT : $langs->trans("CodeNotDef"); - + $tabfac = array (); $tabht = array (); $tabtva = array (); $tabttc = array (); $tabcompany = array (); - + $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); @@ -133,7 +133,7 @@ if ($result) { $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT)) ? $conf->global->COMPTA_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"); } $compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva); - + $tabfac[$obj->rowid]["date"] = $obj->df; $tabfac[$obj->rowid]["ref"] = $obj->ref; $tabfac[$obj->rowid]["type"] = $obj->type; @@ -145,9 +145,9 @@ if ($result) { $tabcompany[$obj->rowid] = array ( 'id' => $obj->socid, 'name' => $obj->name, - 'code_fournisseur' => $obj->code_compta_fournisseur + 'code_fournisseur' => $obj->code_compta_fournisseur ); - + $i ++; } } else { @@ -160,11 +160,11 @@ if ($result) { // Bookkeeping Write if ($action == 'writebookkeeping') { $now = dol_now(); - + foreach ( $tabfac as $key => $val ) { foreach ( $tabttc[$key] as $k => $mt ) { // get compte id and label - + $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; @@ -180,10 +180,10 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; - + $bookkeeping->create(); } - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { @@ -205,18 +205,18 @@ if ($action == 'writebookkeeping') { $bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; - + $bookkeeping->create(); } } } - + // VAT // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { // get compte id and label - + $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_ref = $val["ref"]; @@ -232,7 +232,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->create(); } } @@ -243,21 +243,21 @@ if ($action == 'writebookkeeping') { if ($action == 'export_csv') { $sep = $conf->global->ACCOUNTING_SEPARATORCSV; - + header('Content-Type: text/csv'); header('Content-Disposition: attachment;filename=journal_achats.csv'); - + if ($conf->global->ACCOUNTING_MODELCSV == 1) // Modèle Export Cegid Expert { foreach ( $tabfac as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; - + if ($mt) { print $date . $sep; print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep; @@ -270,7 +270,7 @@ if ($action == 'export_csv') { print "\n"; } } - + // VAT // var_dump($tabtva); foreach ( $tabtva[$key] as $k => $mt ) { @@ -289,7 +289,7 @@ if ($action == 'export_csv') { print $date . $sep; print $conf->global->ACCOUNTING_PURCHASE_JOURNAL . $sep; print length_accountg($conf->global->COMPTA_ACCOUNT_SUPPLIER) . $sep; - + foreach ( $tabttc[$key] as $k => $mt ) { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'D' : 'C') . $sep; @@ -303,11 +303,11 @@ if ($action == 'export_csv') { { foreach ( $tabfac as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), 'day'); - + $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { @@ -333,7 +333,7 @@ if ($action == 'export_csv') { print "\n"; } } - + // Third party print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; @@ -347,11 +347,11 @@ if ($action == 'export_csv') { } } } else { - + llxHeader('', '', ''); - + $form = new Form($db); - + $nom = $langs->trans("PurchasesJournal"); $nomlink = ''; $periodlink = ''; @@ -364,11 +364,11 @@ if ($action == 'export_csv') { $description .= $langs->trans("DepositsAreIncluded"); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); - + print ''; - + print ''; - + print ' '; - + /* * Show result array */ print '

'; - + $i = 0; print ""; print ""; @@ -397,21 +397,21 @@ if ($action == 'export_csv') { print ""; print ""; print "\n"; - + $var = true; $r = ''; - + $invoicestatic = new FactureFournisseur($db); $companystatic = new Fournisseur($db); - + foreach ( $tabfac as $key => $val ) { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); - + $date = dol_print_date($db->jdate($val["date"]), 'day'); - + // Product / Service foreach ( $tabht[$key] as $k => $mt ) { if ($mt) { @@ -441,16 +441,16 @@ if ($action == 'export_csv') { } } print ""; - + // Third party // print ""; print ""; print ""; - + foreach ( $tabttc[$key] as $k => $mt ) { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; - + print ""; } print ""; - + $var = ! $var; } - + print "
" . $langs->trans("Account") . "" . $langs->trans("Type") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . "
".$conf->global->COMPTA_JOURNAL_BUY."" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accounta($k); print "" . $langs->trans("ThirdParty"); print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')'; @@ -459,12 +459,12 @@ if ($action == 'export_csv') { print '' . ($mt >= 0 ? price($mt) : '') . "
"; - + // End of page llxFooter(); } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 587a0d387a4..79444fbca60 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -90,11 +90,11 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, "; $sql .= " ct.accountancy_code_sell as account_tva"; -$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet fd"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = fd.fk_product"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount aa ON aa.rowid = fd.fk_code_ventilation"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "facture f ON f.rowid = fd.fk_facture"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "societe s ON s.rowid = f.fk_soc"; +$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product"; +$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; +$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'"; $sql .= " WHERE fd.fk_code_ventilation > 0 "; if (! empty($conf->multicompany->enabled)) { diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 3ff70b4e670..b0078839b55 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent s * * 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 @@ -45,7 +46,7 @@ $codeventil = GETPOST('codeventil'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); if ($action == 'ventil' && $user->rights->accounting->access) { diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index cd6ef6bcb53..7d633c575f1 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2014 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 @@ -39,7 +40,7 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->read) accessforbidden(); // Filter diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 41ab92aa765..8b2a870220d 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -4,7 +4,8 @@ * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) - * Copyright (C) 2013-2014 Florian Henry a + * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 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 @@ -44,7 +45,7 @@ $langs->load("accountancy"); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 84f548344b8..259dc5aab39 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry + * Copyright (C) 2014 Juanjo Menent s * * 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 @@ -45,7 +46,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); // Security check if ($user->societe_id > 0) accessforbidden(); -if (! $user->rights->accounting->access) +if (! $user->rights->accounting->ventilation->dispatch) accessforbidden(); $formventilation = new FormVentilation($db); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 9bd164a9b32..79ba8597672 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -130,7 +130,7 @@ abstract class ActionsAdherentCardCommon } else { - $this->errors=$nuser->error; + $this->errors[]=$nuser->error; $this->db->rollback(); } diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 9e2f1f2a8eb..cbb2f197148 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -276,7 +276,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $ $db->begin(); // Create subscription - $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend, $option); + $crowid=$object->cotisation($datecotisation, $cotisation, $accountid, $operation, $label, $num_chq, $emetteur_nom, $emetteur_banque, $datesubend); if ($crowid <= 0) { $error++; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index a866ecd9a70..215f2eae069 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -324,8 +324,8 @@ if ($conf->use_javascript_ajax) '   '.$titre.''. ''. ''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default',0,'class="menuNew" id="new'.$menu['rowid'].'"').' '. - ''.img_delete('default',0,'class="menuDel" id="del'.$menu['rowid'].'"').' '. + ''.img_edit_add('default').' '. + ''.img_delete('default').' '. ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. '' ); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 2247df9493e..6094bb7e4f1 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -55,7 +55,7 @@ if ($action == "set") if (! $res > 0) $error++; $id=GETPOST('PRELEVEMENT_ID_BANKACCOUNT','int'); - $account = new Account($db, $id); + $account = new Account($db); if($account->fetch($id)>0) { diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 74037147760..9d5317fdd88 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -366,9 +366,11 @@ print $langs->trans("BackupDescY").'

'; id="filename_template" value="" />

@@ -376,16 +378,19 @@ echo $file; array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")), - 'gz' => array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")), -); +$compression=array(); if ($label == 'MySQL') { -// $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function + $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")); + $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); + // $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function $compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2")); } - +else +{ + $compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("Default")); + $compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); +} // Show compression choices print '
'; diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index d66df365afa..0cd1ae19fa9 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -94,7 +94,7 @@ print $langs->trans("RestoreDesc3",DOL_DATA_ROOT).'

'; ?>
/> - +
trans("ImportPostgreSqlDesc"); print '
'; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 57fbb045a02..203776bc7f9 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2014 Laurent Destailleur * Copyright (C) 2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -289,7 +289,9 @@ if ($what == 'postgresql') if (preg_match("/\s/",$command)) $command=$command=escapeshellarg($command); // Use quotes on command //$param=escapeshellarg($dolibarr_main_db_name)." -h ".escapeshellarg($dolibarr_main_db_host)." -u ".escapeshellarg($dolibarr_main_db_user)." -p".escapeshellarg($dolibarr_main_db_pass); - $param=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host; + //$param="-F c"; + $param="-F p"; + $param.=" --no-tablespaces --inserts -h ".$dolibarr_main_db_host; $param.=" -U ".$dolibarr_main_db_user; if (! empty($dolibarr_main_db_port)) $param.=" -p ".$dolibarr_main_db_port; if (GETPOST("sql_compat") && GETPOST("sql_compat") == 'ANSI') $param.=" --disable-dollar-quoting"; diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index fc9d0489e9a..85139b56ba9 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -50,7 +50,7 @@ print "
\n"; $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/'; $interfaces = new Interfaces($db); -$triggers = $interfaces->getTriggersList(0,'priority'); +$triggers = $interfaces->getTriggersList(); print ' diff --git a/htdocs/categories/admin/categorie_extrafields.php b/htdocs/categories/admin/categorie_extrafields.php index 2da54e77712..712f60f25cd 100644 --- a/htdocs/categories/admin/categorie_extrafields.php +++ b/htdocs/categories/admin/categorie_extrafields.php @@ -65,7 +65,7 @@ llxHeader('',$langs->trans("Categories"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("CategoriesSetup"),$linkback,'setup'); -$head = categoriesadmin_prepare_head(null); +$head = categoriesadmin_prepare_head(); dol_fiche_head($head, 'attributes_categories', $langs->trans("Categories"), 0, 'category'); diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 7f8ceac853e..e68d2e416f8 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -396,7 +396,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Member")); - $head=member_prepare_head($member, $user); + $head=member_prepare_head($member); $titre=$langs->trans("Member"); $picto='user'; dol_fiche_head($head, 'category', $titre,0,$picto); @@ -471,7 +471,7 @@ else if ($id || $ref) llxHeader("","",$langs->trans("Contact")); - $head=contact_prepare_head($object, $user); + $head=contact_prepare_head($object); $titre=$langs->trans("ContactsAddresses"); $picto='contact'; dol_fiche_head($head, 'category', $titre,0,$picto); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index aa71db608fc..4fe49999111 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -52,17 +52,19 @@ class ActionComm extends CommonObject var $datep; // Date action start (datep) var $datef; // Date action end (datep2) - var $durationp = -1; // -1=Unkown duration + var $durationp = -1; // -1=Unkown duration // deprecated var $fulldayevent = 0; // 1=Event on full day var $punctual = 1; // Milestone var $percentage; // Percentage var $location; // Location + var $transparency; // Transparency (ical standard). Used to say if people assigned to event are busy or not by event. 0=available, 1=busy, 2=busy (refused events) var $priority; // Small int (0 By default) var $note; // Description - var $usertodo; // Object user that must do action - var $userdone; // Object user that did action + var $userassigned; // Array of user ids + var $usertodo; // Object user of owner + var $userdone; // Object user that did action (deprecated) var $societe; // Company linked to action (optional) var $contact; // Contact linked to action (optional) @@ -89,10 +91,10 @@ class ActionComm extends CommonObject { $this->db = $db; - $this->author = new stdClass(); - $this->usermod = new stdClass(); - $this->usertodo = new stdClass(); - $this->userdone = new stdClass(); + //$this->author = new stdClass(); + //$this->usermod = new stdClass(); + //$this->usertodo = new stdClass(); + //$this->userdone = new stdClass(); $this->societe = new stdClass(); $this->contact = new stdClass(); } @@ -122,7 +124,7 @@ class ActionComm extends CommonObject if (empty($this->transparency)) $this->transparency = 0; if ($this->percentage > 100) $this->percentage = 100; //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; - if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep); + if (! empty($this->datep) && ! empty($this->datef)) $this->durationp=($this->datef - $this->datep); // deprecated //if (! empty($this->date) && ! empty($this->dateend)) $this->durationa=($this->dateend - $this->date); if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep; //if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date; @@ -167,7 +169,7 @@ class ActionComm extends CommonObject $sql.= "(datec,"; $sql.= "datep,"; $sql.= "datep2,"; - $sql.= "durationp,"; + $sql.= "durationp,"; // deprecated $sql.= "fk_action,"; $sql.= "code,"; $sql.= "fk_soc,"; @@ -186,7 +188,7 @@ class ActionComm extends CommonObject $sql.= "'".$this->db->idate($now)."',"; $sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").","; $sql.= (strval($this->datef)!=''?"'".$this->db->idate($this->datef)."'":"null").","; - $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; + $sql.= (isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null").","; // deprecated $sql.= (isset($this->type_id)?$this->type_id:"null").","; $sql.= (isset($this->code)?" '".$this->code."'":"null").","; $sql.= (isset($this->societe->id) && $this->societe->id > 0?" '".$this->societe->id."'":"null").","; @@ -258,9 +260,10 @@ class ActionComm extends CommonObject * Load object from database * * @param int $id Id of action to get + * @param string $ref Ref of action to get * @return int <0 if KO, >0 if OK */ - function fetch($id) + function fetch($id, $ref='') { global $langs; @@ -269,8 +272,8 @@ class ActionComm extends CommonObject $sql.= " a.ref_ext,"; $sql.= " a.datep,"; $sql.= " a.datep2,"; + $sql.= " a.durationp,"; // deprecated $sql.= " a.datec,"; - $sql.= " a.durationp,"; $sql.= " a.tms as datem,"; $sql.= " a.code, a.label, a.note,"; $sql.= " a.fk_soc,"; @@ -286,7 +289,9 @@ class ActionComm extends CommonObject $sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; - $sql.= " WHERE a.id=".$id." AND a.fk_action=c.id"; + $sql.= " WHERE a.fk_action=c.id"; + if ($ref) $sql.= " AND a.id=".$ref; // No field ref, we use id + else $sql.= " AND a.id=".$id; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql=$this->db->query($sql); @@ -311,6 +316,7 @@ class ActionComm extends CommonObject $this->label = $obj->label; $this->datep = $this->db->jdate($obj->datep); $this->datef = $this->db->jdate($obj->datep2); + $this->durationp = $this->durationp; // deprecated $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); @@ -434,7 +440,7 @@ class ActionComm extends CommonObject if (empty($this->fulldayevent)) $this->fulldayevent = 0; if ($this->percentage > 100) $this->percentage = 100; //if ($this->percentage == 100 && ! $this->dateend) $this->dateend = $this->date; - if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep); + if ($this->datep && $this->datef) $this->durationp=($this->datef - $this->datep); // deprecated //if ($this->date && $this->dateend) $this->durationa=($this->dateend - $this->date); if ($this->datep && $this->datef && $this->datep > $this->datef) $this->datef=$this->datep; //if ($this->date && $this->dateend && $this->date > $this->dateend) $this->dateend=$this->date; @@ -455,6 +461,7 @@ class ActionComm extends CommonObject $sql.= ", label = ".($this->label ? "'".$this->db->escape($this->label)."'":"null"); $sql.= ", datep = ".(strval($this->datep)!='' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null'); + $sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated $sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null"); $sql.= ", fk_soc =". ($this->societe->id > 0 ? "'".$this->societe->id."'":"null"); $sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null"); @@ -857,7 +864,7 @@ class ActionComm extends CommonObject $sql = "SELECT a.id,"; $sql.= " a.datep,"; // Start $sql.= " a.datep2,"; // End - $sql.= " a.durationp,"; + $sql.= " a.durationp,"; // deprecated $sql.= " a.datec, a.tms as datem,"; $sql.= " a.label, a.code, a.note, a.fk_action as type_id,"; $sql.= " a.fk_soc,"; @@ -934,12 +941,12 @@ class ActionComm extends CommonObject $event['type']=$type; $datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); $dateend=$this->db->jdate($obj->datep2)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); - $duration=$obj->durationp; + $duration=($datestart && $dateend)?($dateend - $datestart):0; $event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":""); $event['desc']=$obj->note; $event['startdate']=$datestart; - $event['duration']=$duration; // Not required with type 'journal' $event['enddate']=$dateend; // Not required with type 'journal' + $event['duration']=$duration; // Not required with type 'journal' $event['author']=dolGetFirstLastname($obj->firstname, $obj->lastname); $event['priority']=$obj->priority; $event['fulldayevent']=$obj->fulldayevent; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 27be46bd9e1..929600512c7 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2013 Juanjo Menent @@ -87,20 +87,37 @@ $hookmanager->initHooks(array('actioncard')); * Actions */ -if (GETPOST('addassignedtouser')) +// Remove user to assigned list +if (! empty($_POST['removedassigned'])) +{ + $idtoremove=$_POST['removedassigned']; + if (! empty($_SESSION['assignedtouser'])) $tmpassigneduserids=dol_json_decode($_SESSION['assignedtouser'],1); + else $tmpassigneduserids=array(); + unset($tmpassigneduserids[$idtoremove]); + //var_dump($_POST['removedassigned']);exit; + $_SESSION['assignedtouser']=dol_json_encode($tmpassigneduserids); + $donotclearsession=1; + if ($action == 'add') $action = 'create'; + if ($action == 'update') $action = 'edit'; +} + +// Add user to assigned list +if (GETPOST('addassignedtouser') || GETPOST('updateassignedtouser')) { // Add a new user if (GETPOST('affectedto') > 0) { $assignedtouser=array(); - if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); + if (! empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); $assignedtouser[GETPOST('affectedto')]=array('transparency'=>GETPOST('transparency'),'mandatory'=>1); $_SESSION['assignedtouser']=dol_json_encode($assignedtouser); } $donotclearsession=1; - $action='create'; + if ($action == 'add') $action = 'create'; + if ($action == 'update') $action = 'edit'; } -// Add action + +// Add event if ($action == 'add') { $error=0; @@ -131,22 +148,22 @@ if ($action == 'add') // Check parameters if (! $datef && $percentage == 100) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label')) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors'); } // Initialisation objet cactioncomm - if (! GETPOST('actioncode')) + if (! GETPOST('actioncode') > 0) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); } @@ -161,7 +178,6 @@ if ($action == 'add') $object->priority = GETPOST("priority")?GETPOST("priority"):0; $object->fulldayevent = (! empty($fulldayevent)?1:0); $object->location = GETPOST("location"); - $object->transparency = (GETPOST("transparency")=='on'?1:0); $object->label = trim(GETPOST('label')); $object->fk_element = GETPOST("fk_element"); $object->elementtype = GETPOST("elementtype"); @@ -186,18 +202,35 @@ if ($action == 'add') $object->percentage = $percentage; $object->duree=((float) (GETPOST('dureehour') * 60) + (float) GETPOST('dureemin')) * 60; - $usertodo=new User($db); - if ($_POST["affectedto"] > 0) + $listofuserid=dol_json_decode($_SESSION['assignedtouser']); + $i=0; + foreach($listofuserid as $key => $value) { - $usertodo->fetch($_POST["affectedto"]); + if ($i == 0) // First entry + { + $usertodo=new User($db); + if ($key > 0) + { + $usertodo->fetch($key); + } + $object->usertodo = $usertodo; + $object->transparency = (GETPOST("transparency")=='on'?1:0); + } + + $object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0)); + + $i++; } - $object->usertodo = $usertodo; - $userdone=new User($db); - if ($_POST["doneby"] > 0) + + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { - $userdone->fetch($_POST["doneby"]); + $userdone=new User($db); + if ($_POST["doneby"] > 0) + { + $userdone->fetch($_POST["doneby"]); + } + $object->userdone = $userdone; } - $object->userdone = $userdone; $object->note = trim($_POST["note"]); if (isset($_POST["contactid"])) $object->contact = $contact; @@ -214,16 +247,22 @@ if ($action == 'add') if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; // Check parameters + if (empty($object->usertodo)) + { + $error++; $donotclearsession=1; + $action = 'create'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); + } if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent)))) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors'); } if (! GETPOST('apyear') && ! GETPOST('adyear')) { - $error++; + $error++; $donotclearsession=1; $action = 'create'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors'); } @@ -265,42 +304,14 @@ if ($action == 'add') $langs->load("errors"); $error=$langs->trans($object->error); setEventMessage($error,'errors'); - $action = 'create'; + $action = 'create'; $donotclearsession=1; } } else { $db->rollback(); - $langs->load("errors"); - - if (! empty($object->error)) setEventMessage($langs->trans($object->error), 'errors'); - if (count($object->errors)) setEventMessage($object->errors, 'errors'); - - $action = 'create'; - } - } -} - -/* - * Action suppression de l'action - */ -if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') -{ - $object->fetch($id); - - if ($user->rights->agenda->myactions->delete - || $user->rights->agenda->allactions->delete) - { - $result=$object->delete(); - - if ($result >= 0) - { - header("Location: index.php"); - exit; - } - else - { - setEventMessage($object->error,'errors'); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create'; $donotclearsession=1; } } } @@ -348,25 +359,59 @@ if ($action == 'update') if (! $datef && $percentage == 100) { - $error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd")); + $error++; $donotclearsession=1; + setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),$object->errors,'errors'); $action = 'edit'; } // Users - $usertodo=new User($db); - if ($_POST["affectedto"]) + $listofuserid=dol_json_decode($_SESSION['assignedtouser']); + $i=0; + foreach($listofuserid as $key => $value) { - $usertodo->fetch($_POST["affectedto"]); - } - $object->usertodo = $usertodo; - $object->transparency=(GETPOST("transparency")=='on'?1:0); + if ($i == 0) // First entry + { + $usertodo=new User($db); + if ($key > 0) + { + $usertodo->fetch($key); + } + $object->usertodo = $usertodo; + $object->transparency=(GETPOST("transparency")=='on'?1:0); + } - $userdone=new User($db); - if ($_POST["doneby"]) - { - $userdone->fetch($_POST["doneby"]); + $object->userassigned[$key]=array('id'=>$key, 'transparency'=>(GETPOST("transparency")=='on'?1:0)); + + $i++; + } + + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) + { + $userdone=new User($db); + if ($_POST["doneby"]) + { + $userdone->fetch($_POST["doneby"]); + } + $object->userdone = $userdone; + } + + // Check parameters + if (! GETPOST('actioncode') > 0) + { + $error++; $donotclearsession=1; + $action = 'edit'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors'); + } + else + { + $result=$cactioncomm->fetch(GETPOST('actioncode')); + } + if (empty($object->usertodo)) + { + $error++; $donotclearsession=1; + $action = 'edit'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionAffectedTo")), 'errors'); } - $object->userdone = $userdone; // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); @@ -383,17 +428,13 @@ if ($action == 'update') } else { + setEventMessages($object->error,$object->errors,'errors'); $db->rollback(); } } } - if ($result < 0) - { - setEventMessage($object->error,'errors'); - setEventMessage($object->errors,'errors'); - } - else + if (! $error) { if (! empty($backtopage)) { @@ -403,6 +444,30 @@ if ($action == 'update') } } +/* + * delete event + */ +if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes') +{ + $object->fetch($id); + + if ($user->rights->agenda->myactions->delete + || $user->rights->agenda->allactions->delete) + { + $result=$object->delete(); + + if ($result >= 0) + { + header("Location: index.php"); + exit; + } + else + { + setEventMessages($object->error,$object->errors,'errors'); + } + } +} + /* * Action move update, used when user move an event in calendar by drag'n drop */ @@ -576,15 +641,14 @@ if ($action == 'create') print ''; // Assigned to - $var=false; print ''; print '
'.$langs->trans("Location").'
'.$langs->trans("ActionAffectedTo").''; if (empty($donotclearsession)) { $assignedtouser=GETPOST("affectedtouser")?GETPOST("affectedtouser"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id); $_SESSION['assignedtouser']=dol_json_encode(array($assignedtouser=>array('transparency'=>1,'mandatory'=>1))); } - //print $form->select_dolusers_forevent('affectedto',1); - print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); + print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1); + //print $form->select_dolusers(GETPOST("affectedto")?GETPOST("affectedto"):(! empty($object->usertodo->id) && $object->usertodo->id > 0 ? $object->usertodo->id : $user->id),'affectedto',1); print '
'; @@ -599,7 +663,7 @@ if ($action == 'create') print ''; // Realised by - if ($conf->global->AGENDA_ENABLE_DONEBY) + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print ''.$langs->trans("ActionDoneBy").''; print $form->select_dolusers(GETPOST("doneby")?GETPOST("doneby"):(! empty($object->userdone->id) && $percent==100?$object->userdone->id:0),'doneby',1); @@ -704,11 +768,6 @@ if ($action == 'create') // View or edit if ($id > 0) { - if ($error) - { - dol_htmloutput_errors($error); - } - $result=$object->fetch($id); $object->fetch_optionals($id,$extralabels); @@ -833,7 +892,14 @@ if ($id > 0) // Assigned to print ''.$langs->trans("ActionAffectedTo").''; - print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1); + $listofuserid=array(); + if (empty($donotclearsession)) + { + if (is_object($object->usertodo)) $listofuserid[$object->usertodo->id]=array('id'=>$object->usertodo->id,'transparency'=>$object->transparency); + $_SESSION['assignedtouser']=dol_json_encode($listofuserid); + } + print $form->select_dolusers_forevent(($action=='create'?'add':'update'),'affectedto',1); + //print $form->select_dolusers($object->usertodo->id>0?$object->usertodo->id:-1,'affectedto',1); print ''; print '

'; @@ -844,7 +910,7 @@ if ($id > 0) print ''; // Realised by - if ($conf->global->AGENDA_ENABLE_DONEBY) + if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { print '"; print ''; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 3e530ef8676..5f6c9d35cbf 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -66,6 +66,7 @@ $origin = GETPOST('origin', 'alpha'); $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); $lineid = GETPOST('lineid', 'int'); +$contactid = GETPOST('contactid','int'); // PDF $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -76,8 +77,7 @@ $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($co $NBLINES = 4; // Security check -if (! empty($user->societe_id)) - $socid = $user->societe_id; +if (! empty($user->societe_id)) $socid = $user->societe_id; $result = restrictedArea($user, 'propal', $id); $object = new Propal($db); @@ -261,7 +261,7 @@ else if ($action == 'add' && $user->rights->propal->creer) { $object->remise_percent = GETPOST('remise_percent'); $object->remise_absolue = GETPOST('remise_absolue'); $object->socid = GETPOST('socid'); - $object->contactid = GETPOST('contactidp'); + $object->contactid = GETPOST('contactid'); $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated @@ -285,7 +285,7 @@ else if ($action == 'add' && $user->rights->propal->creer) { $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->contactid = GETPOST('contactidp'); + $object->contactid = GETPOST('contactid'); $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated @@ -450,9 +450,9 @@ else if ($action == 'add' && $user->rights->propal->creer) { if ($id > 0) { // Insertion contact par defaut si defini - if (GETPOST('contactidp') > 0) + if (GETPOST('contactid') > 0) { - $result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external'); + $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); if ($result < 0) { $error++; @@ -1256,7 +1256,8 @@ $companystatic = new Societe($db); $now = dol_now(); // Add new proposal -if ($action == 'create') { +if ($action == 'create') +{ print_fiche_titre($langs->trans("NewProp")); $soc = new Societe($db); @@ -1356,12 +1357,16 @@ if ($action == 'create') { } print '' . "\n"; - // Contacts - if ($socid > 0) { + // Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice. + if ($socid > 0) + { print "'; + } + if ($socid > 0) + { // Ligne info remises tiers print ''; // Ligne info remises tiers diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4ca6175d785..40bfbe6490d 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -338,9 +338,10 @@ class Account extends CommonObject /** * Create bank account into database * + * @param User $user Object user making creation * @return int < 0 if KO, > 0 if OK */ - function create() + function create($user='') { global $langs,$conf; @@ -665,10 +666,9 @@ class Account extends CommonObject return 1; } else - { + { return 0; } - $this->db->free($result); } else { diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index c118186df27..770f2afd2ef 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -102,7 +102,7 @@ if ($_POST["action"] == 'add') if (! $error) { - $id = $account->create($user->id); + $id = $account->create($user); if ($id > 0) { $_GET["id"]=$id; // Force chargement page en mode visu @@ -306,7 +306,7 @@ if ($action == 'create') $doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70); $doleditor->Create(); print ''; - + print '
'.$langs->trans("ActionDoneBy").''; print $form->select_dolusers($object->userdone->id> 0?$object->userdone->id:-1,'doneby',1); diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 76176930da3..524901336a7 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -327,11 +327,11 @@ if ($id > 0) print ''; if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'cond_reglement_id',-1,1); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id',1); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->cond_reglement_id,'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none'); } print "
" . $langs->trans("DefaultContact") . ''; - $form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist); + $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); print '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index ccf92cc2b0b..8e2f1c5595e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -233,7 +233,7 @@ else if ($action == 'add' && $user->rights->commande->creer) { $object->date_livraison = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); - $object->contactid = GETPOST('contactidp'); + $object->contactid = GETPOST('contactid'); // If creation from another object of another module (Example: origin=propal, originid=1) if (! empty($origin) && ! empty($originid)) { @@ -383,8 +383,8 @@ else if ($action == 'add' && $user->rights->commande->creer) { // Insert default contacts if defined if ($object_id > 0) { - if (GETPOST('contactidp')) { - $result = $object->add_contact(GETPOST('contactidp'), 'CUSTOMER', 'external'); + if (GETPOST('contactid')) { + $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); if ($result < 0) { setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); $error ++; @@ -1484,7 +1484,7 @@ if ($action == 'create' && $user->rights->commande->creer) { */ if ($socid > 0) { print "
" . $langs->trans("DefaultContact") . ''; - $form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist); + $form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist); print '
'; print '
'; @@ -510,7 +510,7 @@ else $account->fetch(GETPOST('id','int')); print_fiche_titre($langs->trans("EditFinancialAccount")); - + if ($conf->use_javascript_ajax) { print "\n".''; + $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); + $out.=''; $assignedtouser=array(); if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true); if (count($assignedtouser)) $out.='
'; + $i=0; foreach($assignedtouser as $key => $value) { $userstatic->fetch($key); $out.=$userstatic->getNomUrl(1); + if ($i == 0) $out.=' ('.$langs->trans("Owner").')'; + $out.=' '; //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); //$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy")); $out.='
'; + $i++; } //$out.=''; @@ -3043,7 +3050,7 @@ class Form * @param int $page Page * @param string $selected Id condition pre-selectionne * @param string $htmlname Name of select html field - * @param int $addempty Ajoute entree vide + * @param int $addempty Add empty entry * @return void */ function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0) @@ -3344,7 +3351,7 @@ class Form * @param string $htmlname Nom du formulaire select * @return void */ - function form_contacts($page, $societe, $selected='', $htmlname='contactidp') + function form_contacts($page, $societe, $selected='', $htmlname='contactid') { global $langs, $conf; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 261754801a9..6f70ba71673 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -250,6 +250,21 @@ class FormMail if (! empty($_SESSION["listofnames"])) $listofnames=explode(';',$_SESSION["listofnames"]); if (! empty($_SESSION["listofmimes"])) $listofmimes=explode(';',$_SESSION["listofmimes"]); + // Define output language + $outputlangs = $langs; + $newlang = ''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels']; + if (! empty($newlang)) + { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('other'); + } + + // Get message template + $arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs); + + $out.= "\n\n"; if ($this->withform == 1) { @@ -439,7 +454,7 @@ class FormMail } $out.= "\n"; } - + // CCC if (! empty($this->withtoccc) || is_array($this->withtoccc)) { @@ -492,19 +507,23 @@ class FormMail // Topic if (! empty($this->withtopic)) { - $this->withtopic=make_substitutions($this->withtopic,$this->substit); + $defaulttopic=""; + if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['topic']) $defaulttopic=$arraydefaultmessage['topic']; + elseif (! is_numeric($this->withtopic)) $defaulttopic=$this->withtopic; + + $defaulttopic=make_substitutions($defaulttopic,$this->substit); $out.= ''; $out.= ''.$langs->trans("MailTopic").''; $out.= ''; if ($this->withtopicreadonly) { - $out.= $this->withtopic; - $out.= ''; + $out.= $defaulttopic; + $out.= ''; } else { - $out.= 'withtopic)?'':$this->withtopic)) .'" />'; + $out.= ''; } $out.= "\n"; } @@ -563,31 +582,8 @@ class FormMail if (! empty($this->withbody)) { $defaultmessage=""; - - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) - $newlang = $this->param['langsmodels']; - - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outputlangs->load('other'); - } - - - // TODO A partir du type, proposer liste de messages dans table llx_c_email_template - if ($this->param["models"]=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); } - elseif ($this->param["models"]=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } - elseif ($this->param["models"]=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); } - elseif ($this->param["models"]=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); } - elseif ($this->param["models"]=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); } - elseif ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } - elseif ($this->param["models"]=='shipping_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendShipping"); } - elseif ($this->param["models"]=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } - elseif ($this->param["models"]=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } - elseif (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; } + if (count($arraydefaultmessage) > 0 && $arraydefaultmessage['content']) $defaultmessage=$arraydefaultmessage['content']; + elseif (! is_numeric($this->withbody)) $defaultmessage=$this->withbody; // Complete substitution array if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_ADD_PAYMENT_URL)) @@ -679,5 +675,65 @@ class FormMail return $out; } } + + + + /** + * Return template of email + * Search into table c_email_template + * + * @param DoliDB $db Database handler + * @param string $type_template Get message for key module + * @param string $user Use template public or limited to this user + * @param Translate $outputlangs Output lang object + * @return array array('topic'=>,'content'=>,..) + */ + private function getEMailTemplate($db, $type_template, $user, $outputlangs) + { + $ret=array(); + + $sql = "SELECT topic, content"; + $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; + $sql.= " WHERE type_template='".$db->escape($type_template)."'"; + $sql.= " AND entity IN (".getEntity("c_email_templates").")"; + $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; + // TODO Add field and where filter on language code + //print $sql; + + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) + { + $ret['topic']=$obj->topic; + $ret['content']=$obj->content; + } + else + { + $defaultmessage=''; + if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); } + elseif ($type_template=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); } + elseif ($type_template=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); } + elseif ($type_template=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); } + elseif ($type_template=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); } + elseif ($type_template=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); } + elseif ($type_template=='shipping_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendShipping"); } + elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } + elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } + + $ret['topic']=''; + $ret['content']=$defaultmessage; + } + + $db->free($resql); + return $ret; + } + else + { + dol_print_error($db); + return -1; + } + } } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 6593b2d896b..25263deee46 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1209,11 +1209,14 @@ class DoliDBPgsql extends DoliDB */ function getPathOfRestore() { - $fullpathofdump='/pathtopgrestore/pg_restore'; + //$tool='pg_restore'; + $tool='psql'; - if (file_exists('/usr/bin/pg_restore')) + $fullpathofdump='/pathtopgrestore/'.$tool; + + if (file_exists('/usr/bin/'.$tool)) { - $fullpathofdump='/usr/bin/pg_restore'; + $fullpathofdump='/usr/bin/'.$tool; } else { @@ -1223,7 +1226,7 @@ class DoliDBPgsql extends DoliDB { $liste=$this->fetch_array($resql); $basedir=$liste['data_directory']; - $fullpathofdump=preg_replace('/data$/','bin',$basedir).'/pg_restore'; + $fullpathofdump=preg_replace('/data$/','bin',$basedir).'/'.$tool; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2e2bf34a75d..c7b8de5a461 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1841,7 +1841,8 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ if ($srconly) return $fullpathpicto; else { - $tmparray=explode(':',$titlealt); + $tmparray=array(0=>$titlealt); + if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB $title=$tmparray[0]; $alt=empty($tmparray[1])?'':$tmparray[1]; return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup @@ -1939,29 +1940,31 @@ function img_pdf($titlealt = 'default', $size = 3) * Show logo + * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img * @return string Return tag img */ -function img_edit_add($titlealt = 'default') +function img_edit_add($titlealt = 'default', $other = '') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Add'); - return img_picto($titlealt, 'edit_add.png'); + return img_picto($titlealt, 'edit_add.png', $other); } /** * Show logo - * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img * @return string Return tag img */ -function img_edit_remove($titlealt = 'default') +function img_edit_remove($titlealt = 'default', $other='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Remove'); - return img_picto($titlealt, 'edit_remove.png'); + return img_picto($titlealt, 'edit_remove.png', $other); } /** @@ -2252,6 +2255,47 @@ function img_phone($titlealt = 'default', $option = 0) return img_picto($titlealt, $img); } +/** + * Show search logo + * + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img + * @return string Retourne tag img + */ +function img_search($titlealt = 'default', $other = '') +{ + global $conf, $langs; + + if ($titlealt == 'default') $titlealt = $langs->trans('Search'); + + $img = img_picto($titlealt, 'search.png', $other, false, 1); + + $input = ''; + + return $input; +} + +/** + * Show search logo + * + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img + * @return string Retourne tag img + */ +function img_searchclear($titlealt = 'default', $other = '') +{ + global $conf, $langs; + + if ($titlealt == 'default') $titlealt = $langs->trans('Search'); + + $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); + + $input = ''; + + return $input; +} /** * Show information for admin users diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index fdb5a26109e..05abcd625e8 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1221,7 +1221,7 @@ function dol_print_reduction($reduction,$langs) $string = ''; if ($reduction == 100) { - $string = $langs->trans("Offered"); + $string = $langs->transnoentities("Offered"); } else { @@ -1326,7 +1326,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) if (! $tmpdir) { unset($listofdir[$key]); continue; } if (is_dir($tmpdir)) { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0,true); // Disable hook for the moment + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e44b0dd413c..7a8f2302c12 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -642,6 +642,7 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta $sortfield=''; $sortorder=''; + $project_year_filter=0; $title=$langs->trans("Project"); if ($statut == 0) $title=$langs->trans("ProjectDraft"); @@ -681,6 +682,17 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta { $sql.= " AND p.fk_statut = ".$statut; } + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { + $project_year_filter = GETPOST("project_year_filter"); + //Check if empty or invalid year. Wildcard ignores the sql check + if ($project_year_filter != "*") { + if (empty($project_year_filter) || !ctype_digit($project_year_filter)) { // + $project_year_filter = date("Y"); + } + $sql.= " AND (p.dateo IS NULL OR p.dateo <= ".$db->idate(dol_get_last_day($project_year_filter,12,false)).")"; + $sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")"; + } + } $sql.= " GROUP BY p.rowid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut"; $sql.= " ORDER BY p.title, p.ref"; @@ -724,6 +736,19 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta { dol_print_error($db); } + print ""; + + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { + //Add the year filter input + print ''; + print ''; + print ''; + print ''; + print '\n"; + print '
'.$langs->trans("Year").'
'; + print ''; + print "
'; + } } diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index af5473ef3e2..210fe8d647e 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -39,22 +39,22 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Home - Sytem info insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$user->admin', __HANDLER__, 'left', 300__+MAX_llx_menu__, 'home', 'admintools', 1__+MAX_llx_menu__, '/admin/tools/index.php?leftmenu=admintools', 'SystemTools', 0, 'admin', '', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 208__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/browser.php?leftmenu=admintools', 'InfoBrowser', 1, 'admin', '', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/phpinfo.php?leftmenu=admintools', 'InfoPHP', 1, 'admin', '', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 210__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/database.php?leftmenu=admintools', 'InfoDatabase', 1, 'admin', '', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 301__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_export.php?leftmenu=admintools', 'Backup', 1, 'admin', '', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 302__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/dolibarr_import.php?leftmenu=admintools', 'Restore', 1, 'admin', '', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 305__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/update.php?leftmenu=admintools', 'MenuUpgrade', 1, 'admin', '', '', 2, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 304__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && function_exists("eaccelerator_info")', __HANDLER__, 'left', 306__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/eaccelerator.php?leftmenu=admintools', 'EAccelerator', 1, 'admin', '', '', 2, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listevents.php?leftmenu=admintools', 'Audit', 1, 'admin', '', '', 2, 10, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 308__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/listsessions.php?leftmenu=admintools', 'Sessions', 1, 'admin', '', '', 2, 11, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 303__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 307__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 309__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/tools/purge.php?leftmenu=admintools', 'Purge', 1, 'admin', '', '', 2, 12, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 310__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/support/index.php?leftmenu=admintools', 'HelpCenter', 1, 'help', '', '_blank', 2, 13, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__); -- Home - Menu users and groups insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__); @@ -102,7 +102,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/fiche.php?action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/liste.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3103__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/valo.php', 'EnhancedValue', 1, 'stocks', '$user->rights->stock->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 682c00ef77a..1d7aa1a5a9a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -918,7 +918,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Grand livre $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping'); if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); - if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); + if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); // Accountancy journals if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') @@ -1068,7 +1068,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Stocks"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock'); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/fiche.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/liste.php", $langs->trans("List"), 1, $user->rights->stock->lire); - if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/valo.php", $langs->trans("EnhancedValue"), 1, $user->rights->stock->lire); if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); if ($conf->fournisseur->enabled) if (empty($leftmenu) || $leftmenu=="stock") $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->lire && $user->rights->fournisseur->lire); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index f7f9c561e01..8a8ab5fa89e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -153,6 +153,36 @@ class pdf_crabe extends ModelePDFFactures $outputlangs->load("bills"); $outputlangs->load("products"); + $nblignes = count($object->lines); + + // Loop on each lines to detect if there is at least one image to show + $realpatharray=array(); + if (! empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) + { + for ($i = 0 ; $i < $nblignes ; $i++) + { + if (empty($object->lines[$i]->fk_product)) continue; + + $objphoto = new Product($this->db); + $objphoto->fetch($object->lines[$i]->fk_product); + + $pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/"; + $dir = $conf->product->dir_output.'/'.$pdir; + + $realpath=''; + foreach ($objphoto->liste_photos($dir,1) as $key => $obj) + { + $filename=$obj['photo']; + //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; + $realpath = $dir.$filename; + break; + } + + if ($realpath) $realpatharray[$i]=$realpath; + } + } + if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; + if ($conf->facture->dir_output) { $object->fetch_thirdparty(); @@ -195,9 +225,8 @@ class pdf_crabe extends ModelePDFFactures global $action; $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks - $nblignes = count($object->lines); - - $pdf=pdf_getInstance($this->format); + // Create pdf instance + $pdf=pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page @@ -309,17 +338,43 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); + // Define size of image if we need it + $imglinesize=array(); + if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); + $showpricebeforepagebreak=1; + $posYAfterImage=0; + $posYAfterDescription=0; + + // We start with Photo of product line + if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + { + $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposbefore+1); + + $curY = $tab_top_newpage; + $showpricebeforepagebreak=0; + } + + if (isset($imglinesize['width']) && isset($imglinesize['height'])) + { + $curX = $this->posxpicture-1; + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + // $pdf->Image does not increase value return by getY, so we save it manually + $posYAfterImage=$curY+$imglinesize['height']; + } + // Description of product line $curX = $this->posxdesc-1; - $showpricebeforepagebreak=1; - $pdf->startTransaction(); - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { @@ -327,7 +382,7 @@ class pdf_crabe extends ModelePDFFactures $pageposafter=$pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY(); //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; @@ -351,14 +406,15 @@ class pdf_crabe extends ModelePDFFactures { $pdf->commitTransaction(); } - + $posYAfterDescription=$pdf->GetY(); + $nexY = $pdf->GetY(); $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - // We suppose that a too long description is moved completely on next page + // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { $pdf->setPage($pageposafter); $curY = $tab_top_newpage; } @@ -430,6 +486,8 @@ class pdf_crabe extends ModelePDFFactures if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; $this->tva[$vatrate] += $tvaligne; + if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; + // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { @@ -512,11 +570,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->Output($file,'F'); // Add pdfgeneration hook - if (! is_object($hookmanager)) - { - include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; - $hookmanager=new HookManager($this->db); - } $hookmanager->initHooks(array('pdfgeneration')); $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); global $action; @@ -894,7 +947,7 @@ class pdf_crabe extends ModelePDFFactures //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; + if (in_array((string) $localtax_type, array('1','3','5'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -927,7 +980,7 @@ class pdf_crabe extends ModelePDFFactures //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; + if (in_array((string) $localtax_type, array('1','3','5'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -1121,7 +1174,6 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($resteapayer, 0, $outputlangs), $useborder, 'R', 1); - // Fin $pdf->SetFont('','', $default_font_size - 1); $pdf->SetTextColor(0,0,0); } @@ -1180,6 +1232,16 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } + if (! empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) + { + $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + //$pdf->SetXY($this->posxpicture-1, $tab_top+1); + //$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C'); + } + } + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 4a1915b0a34..fa2e3c85c06 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -82,7 +82,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->option_modereg = 0; // Affiche mode reglement $this->option_condreg = 0; // Affiche conditions reglement $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 0; // Dispo en plusieurs langues + $this->option_multilang = 1; // Dispo en plusieurs langues $this->option_draft_watermark = 1; //Support add of a watermark on drafts // Get source company @@ -222,22 +222,22 @@ class pdf_soleil extends ModelePDFFicheinter $nexY = $tab_top + 7; $pdf->SetXY($this->marge_gauche, $tab_top); - $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); - $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); + $pdf->MultiCell(190,5,$outputlangs->transnoentities("Description"),0,'L',0); + $pdf->line($this->marge_gauche, $tab_top + 5, $this->page_largeur-$this->marge_droite, $tab_top + 5); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetXY($this->marge_gauche, $tab_top + 8); + $pdf->SetXY($this->marge_gauche, $tab_top + 5); $text=$object->description; if ($object->duree > 0) { - $totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); + $totaltime=convertSecondToTime($object->duration,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; } $desc=dol_htmlentitiesbr($text,1); //print $outputlangs->convToOutputCharset($desc); exit; - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); + $pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); $nexY = $pdf->GetY(); $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); @@ -262,7 +262,12 @@ class pdf_soleil extends ModelePDFFicheinter $pageposbefore=$pdf->getPage(); // Description of product line - $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; + $txt=$outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); + if ($objectligne->duration > 0) + { + $txt.=" - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration); + } + $txt=''.dol_htmlentitiesbr($txt,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 0, $curX, $curY + 1, dol_concatdesc($txt,$desc), 0, 1, 0); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index e02a6b7e27e..f1871c175a6 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -205,7 +205,7 @@ class pdf_azur extends ModelePDFPropales { if (dol_mkdir($dir) < 0) { - $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); return 0; } } @@ -383,6 +383,7 @@ class pdf_azur extends ModelePDFPropales $pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY(); + //var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit; if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page @@ -551,12 +552,11 @@ class pdf_azur extends ModelePDFPropales $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - //$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); // Affiche zone versements /* - if ($deja_regle) + if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) { $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } @@ -729,20 +729,22 @@ class pdf_azur extends ModelePDFPropales // Si mode reglement non force ou si force a CHQ if (! empty($conf->global->FACTURE_CHQ_NUMBER)) { + $diffsizetitle=(empty($conf->global->PDF_DIFFSIZE_TITLE)?3:$conf->global->PDF_DIFFSIZE_TITLE); + if ($conf->global->FACTURE_CHQ_NUMBER > 0) { $account = new Account($this->db); $account->fetch($conf->global->FACTURE_CHQ_NUMBER); $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','B', $default_font_size - 3); + $pdf->SetFont('','B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$account->proprio),0,'L',0); $posy=$pdf->GetY()+1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); + $pdf->SetFont('','', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); $posy=$pdf->GetY()+2; } @@ -750,14 +752,14 @@ class pdf_azur extends ModelePDFPropales if ($conf->global->FACTURE_CHQ_NUMBER == -1) { $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','B', $default_font_size - 3); + $pdf->SetFont('','B', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo',$this->emetteur->name),0,'L',0); $posy=$pdf->GetY()+1; if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) { $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','', $default_font_size - 3); + $pdf->SetFont('','', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy=$pdf->GetY()+2; } @@ -768,10 +770,11 @@ class pdf_azur extends ModelePDFPropales // 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($conf->global->FACTURE_RIB_NUMBER)) + if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER)) { + $bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank); $account = new Account($this->db); - $account->fetch($conf->global->FACTURE_RIB_NUMBER); + $account->fetch($bankid); $curx=$this->marge_gauche; $cury=$posy; @@ -971,6 +974,7 @@ class pdf_azur extends ModelePDFPropales foreach( $localtax_rate as $tvakey => $tvaval ) { + // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1091,7 +1095,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; - if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 6, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); } $pdf->SetDrawColor(128,128,128); @@ -1102,7 +1106,7 @@ class pdf_azur extends ModelePDFPropales if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6); // line prend une position y en 2eme param et 4eme param + $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param $pdf->SetXY($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); @@ -1235,11 +1239,11 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); $posy+=1; - $pdf->SetFont('','', $default_font_size - 1); + $pdf->SetFont('','', $default_font_size - 2); if ($object->ref_client) { - $posy+=5; + $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php index 29ab105ee91..91eb7056b2c 100644 --- a/htdocs/expedition/liste.php +++ b/htdocs/expedition/liste.php @@ -34,6 +34,10 @@ $expeditionid = GETPOST('id','int'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'expedition',$expeditionid,''); +$search_ref_exp = GETPOST("search_ref_exp"); +$search_ref_liv = GETPOST('search_ref_liv'); +$search_societe = GETPOST("search_societe"); + $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); @@ -47,6 +51,13 @@ if (! $sortfield) $sortfield="e.ref"; if (! $sortorder) $sortorder="DESC"; $limit = $conf->liste_limit; +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_ref_exp=''; + $search_ref_liv=''; + $search_societe=''; +} /* * View @@ -79,10 +90,9 @@ if ($socid) { $sql.= " AND e.fk_soc = ".$socid; } -if (GETPOST('sf_ref','alpha')) -{ - $sql.= " AND e.ref like '%".$db->escape(GETPOST('sf_ref','alpha'))."%'"; -} +if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); +if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1,$offset); @@ -94,7 +104,10 @@ if ($resql) $expedition = new Expedition($db); - $param="&socid=$socid"; + $param=""; + if ($search_ref_exp) $param.= "&search_ref_exp=".$search_ref_exp; + if ($search_ref_liv) $param.= "&search_ref_liv=".$search_ref_liv; + if ($search_societe) $param.= "&search_societe=".$search_societe; print_barre_liste($langs->trans('ListOfSendings'), $page, "liste.php",$param,$sortfield,$sortorder,'',$num); @@ -103,14 +116,44 @@ if ($resql) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"liste.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),"ship2bill.php","e.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Company"),"ship2bill.php","s.nom", "", $param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDeliveryPlanned"),"ship2bill.php","e.date_delivery","",$param, 'align="center"',$sortfield,$sortorder); if($conf->livraison_bon->enabled) { - print_liste_field_titre($langs->trans("DateReceived"),"liste.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DeliveryOrder"),"ship2bill.php","e.date_expedition","",$param, '',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateReceived"),"ship2bill.php","e.date_expedition","",$param, 'align="center"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),"ship2bill.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print "\n"; + + // Lignes des champs de filtre + print ''; + print ''; + print ''; + print ''; + if($conf->livraison_bon->enabled) { + print ''; + } + print ''; + print ''; + + print "\n"; + $var=True; while ($i < min($num,$limit)) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index c60d2c9eac4..6aaf29c7ac2 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent * @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php'; /** - * Classe des gestion des fiches interventions + * Class to manage interventions */ class Fichinter extends CommonObject { diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 889e584d99a..edd5372471e 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1682,11 +1682,11 @@ else if ($id > 0 || ! empty($ref)) { if ($object->statut != 2) { - print ''; + print ''; } else { - print ''; + print ''; } } } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index cb343627959..4dfb8489c9c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -63,8 +63,9 @@ $search_status=GETPOST('search_status'); */ $form = new Form($db); +$interventionstatic=new Fichinter($db); -llxHeader(); +llxHeader('', $langs->trans("Intervention")); $sql = "SELECT"; @@ -102,8 +103,6 @@ if ($result) { $num = $db->num_rows($result); - $interventionstatic=new Fichinter($db); - $urlparam="&socid=$socid"; print_barre_liste($langs->trans("ListOfInterventions"), $page, $_SERVER['PHP_SELF'], $urlparam, $sortfield, $sortorder, '', $num); @@ -114,9 +113,9 @@ if ($result) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],''); if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + print_liste_field_titre('',$_SERVER["PHP_SELF"],''); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"fd.date","",$urlparam,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Duration"),$_SERVER["PHP_SELF"],"fd.duree","",$urlparam,'align="right"',$sortfield,$sortorder); } @@ -131,15 +130,16 @@ if ($result) print ''; - print ''; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + // Desc of line + print ''; print ''; print ''; } print ''; print "\n"; @@ -166,9 +166,9 @@ if ($result) print $companystatic->getNomUrl(1,'',44); print ''; print ''; - print ''; if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) { + print ''; print '\n"; print ''; } diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index de70bf696cc..2c84085af46 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -526,11 +526,11 @@ elseif ($action == 'update_line' && $user->rights->fournisseur->facture->creer) } - $localtax1tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty); $remise_percent=GETPOST('remise_percent'); - $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1tx, $localtax2tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); + $result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent); if ($result >= 0) { unset($_POST['label']); @@ -626,13 +626,13 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer) $tvatx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); $npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, $_POST['idprodfournprice']); - $localtax1tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); - $localtax2tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); + $localtax1_tx= get_localtax($tvatx, 1, $mysoc,$object->thirdparty); + $localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty); $type = $productsupplier->type; // TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first) - $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1tx, $localtax2tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); + $result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, '', '', 0, $npr); } if ($idprod == -2 || $idprod == 0) { diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index c66a03382de..a93ac142e9a 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -106,8 +106,8 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye if ($datepaye && ($datepaye < $tmpinvoice->date)) { $langs->load("errors"); - $error++; - setEventMessage($langs->transnoentities("ErrorPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'errors'); + //$error++; + setEventMessage($langs->transnoentities("WarningPaymentDateLowerThanInvoiceDate", dol_print_date($datepaye,'day'), dol_print_date($tmpinvoice->date, 'day'), $tmpinvoice->ref), 'warnings'); } } diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index e6b8e526bf2..24cb1a6203d 100644 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -18,6 +18,19 @@ -- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user); -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); +ALTER TABLE llx_bank_account ADD COLUMN fk_user_author integer; + +ALTER TABLE llx_propal ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_commande ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_facture ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_product ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_fichinter ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_commande_fournisseur ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_facture_fourn ADD COLUMN fk_user_modif integer after fk_user_author; +ALTER TABLE llx_bank_account ADD COLUMN fk_user_modif integer after fk_user_author; + + +ALTER TABLE llx_fichinter ADD COLUMN ref_ext varchar(255); -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 87769ab9558..868acf7fff0 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -108,6 +108,7 @@ UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps -- VMYSQL DELETE from llx_menu where module = 'margins' and url = '/margin/index.php' and not exists (select * from llx_const where name = 'MAIN_MODULE_MARGIN' or name = 'MAIN_MODULE_MARGINS'); +ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur; ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur; @@ -178,3 +179,9 @@ UPDATE llx_actioncomm set fk_user_action = fk_user_author where fk_user_author > -- DROP TABLE llx_pos_moviments; -- DROP TABLE llx_pos_ticketdet; +-- To replace amount on all invoice and lines when forgetting to apply a 20% vat +-- update llx_facturedet set tva_tx = 20 where tva_tx = 0; +-- update llx_facturedet set total_ht = round(total_ttc / 1.2, 5) where total_ht = total_ttc; +-- update llx_facturedet set total_tva = total_ttc - total_ht where total_vat = 0; +-- update llx_facture set total = round(total_ttc / 1.2, 5) where total_ht = total_ttc; +-- update llx_facture set tva = total_ttc - total where tva = 0; diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index 63a0e23762d..bb2da7841b8 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -30,6 +30,8 @@ create table llx_bank_account ref varchar(12) NOT NULL, label varchar(30) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id + fk_user_author integer, + fk_user_modif integer, bank varchar(60), code_banque varchar(8), code_guichet varchar(6), diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index 3cf3fdac226..90e8fd7af71 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -36,9 +36,10 @@ create table llx_commande date_valid datetime, -- date de validation date_cloture datetime, -- date de cloture date_commande date, -- date de la commande - fk_user_author integer, -- createur de la commande - fk_user_valid integer, -- valideur de la commande - fk_user_cloture integer, -- auteur cloture + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating + fk_user_cloture integer, -- user closing source smallint, fk_statut smallint default 0, amount_ht real default 0, diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index d8076c1c06c..2ecf9e10442 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -30,16 +30,17 @@ create table llx_commande_fournisseur ref_supplier varchar(30), fk_soc integer NOT NULL, - fk_projet integer DEFAULT 0, -- projet auquel est rattache la commande + fk_projet integer DEFAULT 0, -- project id tms timestamp, date_creation datetime, -- date de creation date_valid datetime, -- date de validation date_approve datetime, -- date de approve date_commande date, -- date de la commande - fk_user_author integer, -- createur de la commande - fk_user_valid integer, -- valideur de la commande - fk_user_approve integer, -- auteur approve + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating + fk_user_approve integer, -- user approving source smallint NOT NULL, fk_statut smallint default 0, amount_ht real default 0, diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 2522ee7a73e..433bef887f1 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -56,8 +56,9 @@ create table llx_facture fk_statut smallint DEFAULT 0 NOT NULL, - fk_user_author integer, -- createur de la facture - fk_user_valid integer, -- valideur de la facture + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating fk_facture_source integer, -- facture origine si facture avoir fk_projet integer DEFAULT NULL, -- projet auquel est associee la facture diff --git a/htdocs/install/mysql/tables/llx_facture_fourn.sql b/htdocs/install/mysql/tables/llx_facture_fourn.sql index 2bb85f8400e..3a71c2455aa 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn.sql @@ -52,8 +52,9 @@ create table llx_facture_fourn fk_statut smallint DEFAULT 0 NOT NULL, - fk_user_author integer, -- createur de la facture - fk_user_valid integer, -- valideur de la facture + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating fk_facture_source integer, -- facture origine si facture avoir fk_projet integer, -- projet auquel est associee la facture diff --git a/htdocs/install/mysql/tables/llx_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index b2397b2d2c3..58f953c7196 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -24,13 +24,15 @@ create table llx_fichinter fk_projet integer DEFAULT 0, -- projet auquel est rattache la fiche fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche ref varchar(30) NOT NULL, -- number + ref_ext varchar(255), entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp, datec datetime, -- date de creation date_valid datetime, -- date de validation - datei date, -- date de livraison du bon d'intervention - fk_user_author integer, -- createur de la fiche - fk_user_valid integer, -- valideur de la fiche + datei date, -- date de livraison du bon d'intervention + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- valideur de la fiche fk_statut smallint DEFAULT 0, duree real, -- duree totale de l'intervention description text, diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 0ab9a24785c..e9703fc90cf 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -48,8 +48,9 @@ create table llx_product recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT localtax1_tx double(6,3) DEFAULT 0, -- Spanish local VAT 1 localtax2_tx double(6,3) DEFAULT 0, -- Spanish local VAT 2 - fk_user_author integer DEFAULT NULL, - tosell tinyint DEFAULT 1, -- Product you sell + fk_user_author integer DEFAULT NULL, -- user making creation + fk_user_modif integer, -- user making last change + tosell tinyint DEFAULT 1, -- Product you sell tobuy tinyint DEFAULT 1, -- Product you buy tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch or eat-by management fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module) diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index c9ab3ecd138..90996073021 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -38,9 +38,10 @@ create table llx_propal fin_validite datetime, -- date de fin de validite date_valid datetime, -- date de validation date_cloture datetime, -- date de cloture - fk_user_author integer, -- createur de la propale - fk_user_valid integer, -- valideur de la propale - fk_user_cloture integer, -- cloture de la propale signee ou non signee + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating + fk_user_cloture integer, -- user closing (signed or not) fk_statut smallint DEFAULT 0 NOT NULL, price real DEFAULT 0, -- (obsolete) remise_percent real DEFAULT 0, -- remise globale relative en pourcent (obsolete) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 6745b56daf1..3d9681774d8 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -66,26 +66,26 @@ Lineofinvoice=Line of invoice VentilatedinAccount=Ventilated successfully in the accounting account NotVentilatedinAccount=Not ventilated in the accounting account -ACCOUNTINGEX_SEPARATORCSV=Separator CSV +ACCOUNTING_SEPARATORCSV=Separator CSV -ACCOUNTINGEX_LIMIT_LIST_VENTILATION=Number of elements to be ventilated shown by page (maximum recommended : 50) -ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO=Begin the sorting of the pages of ventilation "Has to ventilate" by the most recent elements -ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE=Begin the sorting of the pages of ventilation "Ventilated" by the most recent elements +ACCOUNTING_LIMIT_LIST_VENTILATION=Number of elements to be ventilated shown by page (maximum recommended : 50) +ACCOUNTING_LIST_SORT_VENTILATION_TODO=Begin the sorting of the pages of ventilation "Has to ventilate" by the most recent elements +ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the pages of ventilation "Ventilated" by the most recent elements AccountLength=Length of the accounting accounts shown in Dolibarr AccountLengthDesc=Function allowing to feign a length of accounting account by replacing spaces by the zero figure. This function touches only the display, it does not modify the accounting accounts registered in Dolibarr. For the export, this function is necessary to be compatible with certain software. -ACCOUNTINGEX_LENGTH_GACCOUNT=Length of the general accounts -ACCOUNTINGEX_LENGTH_AACCOUNT=Length of the third party accounts +ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounts +ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounts -ACCOUNTINGEX_SELL_JOURNAL=Sell journal -ACCOUNTINGEX_PURCHASE_JOURNAL=Purchase journal -ACCOUNTINGEX_BANK_JOURNAL=Bank journal -ACCOUNTINGEX_CASH_JOURNAL=Cash journal -ACCOUNTINGEX_MISCELLANEOUS_JOURNAL=Miscellaneous journal -ACCOUNTINGEX_SOCIAL_JOURNAL=Social journal +ACCOUNTING_SELL_JOURNAL=Sell journal +ACCOUNTING_PURCHASE_JOURNAL=Purchase journal +ACCOUNTING_BANK_JOURNAL=Bank journal +ACCOUNTING_CASH_JOURNAL=Cash journal +ACCOUNTING_MISCELLANEOUS_JOURNAL=Miscellaneous journal +ACCOUNTING_SOCIAL_JOURNAL=Social journal -ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH=Account of transfer -ACCOUNTINGEX_ACCOUNT_SUSPENSE=Account of wait +ACCOUNTING_ACCOUNT_TRANSFER_CASH=Account of transfer +ACCOUNTING_ACCOUNT_SUSPENSE=Account of wait COMPTA_PRODUCT_BUY_ACCOUNT=Accounting account by default for bought products (if not defined in the product sheet) COMPTA_PRODUCT_SOLD_ACCOUNT=Accounting account by default for the sold products (if not defined in the product sheet) @@ -122,6 +122,7 @@ CustomerInvoicePayment=Payment of invoice customer ThirdPartyAccount=Thirdparty account +NewAccountingMvt=New movement NumMvts=Number of movement ListeMvts=List of the movement ErrorDebitCredit=Debit and Credit cannot have a value at the same time diff --git a/htdocs/langs/en_US/donations.lang b/htdocs/langs/en_US/donations.lang index 728661dfa04..66ddea95a5c 100644 --- a/htdocs/langs/en_US/donations.lang +++ b/htdocs/langs/en_US/donations.lang @@ -30,3 +30,4 @@ SearchADonation=Search a donation DonationRecipient=Donation recipient ThankYou=Thank You IConfirmDonationReception=The recipient declare reception, as a donation, of the following amount +MinimumAmount=Minimum amount is %s diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 89404614db5..ed8354b9e8d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -133,7 +133,6 @@ ErrorPHPNeedModule=Error, your PHP must have module %s installed to use t ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s ErrorWarehouseMustDiffers=Source and target warehouses must differs ErrorBadFormat=Bad format! -ErrorPaymentDateLowerThanInvoiceDate=Payment date (%s) cant' be before invoice date (%s) for invoice %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, this member is not yet linked to any thirdparty. Link member to an existing third party or create a new thirdparty before creating subscription with invoice. ErrorThereIsSomeDeliveries=Error, there is some deliveries linked to this shipment. Deletion refused. ErrorCantDeletePaymentReconciliated=Can't delete a payment that had generated a bank transaction that was conciliated @@ -155,4 +154,6 @@ WarningCloseAlways=Warning, closing is done even if amount differs between sourc WarningUsingThisBoxSlowDown=Warning, using this box slow down seriously all pages showing the box. WarningClickToDialUserSetupNotComplete=Setup of ClickToDial information for your user are not complete (see tab ClickToDial onto your user card). WarningNotRelevant=Irrelevant operation for this dataset -WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. \ No newline at end of file +WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Feature disabled when display setup is optimized for blind person or text browsers. +WarningPaymentDateLowerThanInvoiceDate=Payment date (%s) is earlier than invoice date (%s) for invoice %s. +WarningTooManyDataPleaseUseMoreFilters=Too many data. Please use more filters diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 266ce059d8b..17641a0ab3e 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -24,8 +24,8 @@ NameAndSignatureOfInternalContact=Name and signature of intervening : NameAndSignatureOfExternalContact=Name and signature of customer : DocumentModelStandard=Standard document model for interventions InterventionCardsAndInterventionLines=Interventions and lines of interventions -ClassifyBilled=Classify "Billed" -ClassifyUnBilled=Classify "Unbilled" +InterventionClassifyBilled=Classify "Billed" +InterventionClassifyUnBilled=Classify "Unbilled" StatusInterInvoiced=Billed RelatedInterventions=Related interventions ShowIntervention=Show intervention diff --git a/htdocs/langs/es_ES/accountancy.lang b/htdocs/langs/es_ES/accountancy.lang index afcb8456a5d..4298ceddbc6 100644 --- a/htdocs/langs/es_ES/accountancy.lang +++ b/htdocs/langs/es_ES/accountancy.lang @@ -1,148 +1,150 @@ -# Dolibarr language file - es_ES - Experto de la contabilidad +# Dolibarr language file - en_US - Accounting Expert CHARSET=UTF-8 Accounting=Contabilidad Globalparameters=Configuración global -Chartofaccounts=Cuentas +Chartofaccounts=Plan contable Fiscalyear=Años fiscales -Menuaccount=Contabilidad Cuentas +Menuaccount=Cuentas contables Menuthirdpartyaccount=Cuentas de terceros -MenuTools=Instrumentos -Configuration=Configuración -Export=Exportación +MenuTools=Utilidades ConfigAccountingExpert=Configuración del módulo contable Journaux=Diarios -JournalFinancial=Diarios +JournalFinancial=Diarios financieros Exports=Exportaciones -Modelcsv=Plantilla de Exportación -Selectmodelcsv=Seleccione una plantilla de exportación +Modelcsv=Modelo de exportación +Selectmodelcsv=Seleccione un modelo de exportación Modelcsv_normal=Exportación clásica Modelcsv_CEGID=Exportar a Cegid Expert BackToChartofaccounts=Volver al plan contable Back=Volver -Definechartofaccounts=Definir la contabilidad +Definechartofaccounts=Definir plan contable Selectchartofaccounts=Seleccione un plan contable -Validate=validar +Validate=Validar Addanaccount=Añadir una cuenta contable -ImportAccount=Importar cuentas -AccountAccounting=Cuenta -Ventilation=Contabilización +AccountAccounting=Cuenta contable +Ventilation=Contabilizar ToDispatch=A realizar Dispatched=Realizadas CustomersVentilation=Contabilización ventas SuppliersVentilation=Contabilización compras -TradeMargin=margen de beneficio -Reports=relaciones -ByCustomerInvoice=Por las facturas de los clientes -ByMonth=por mes +TradeMargin=Margen de beneficio +Reports=Informes +ByCustomerInvoice=Por facturas a clientes +ByMonth=Por mes NewAccount=Nueva cuenta contable -Update=Actualización -List=lista -Create=crear -UpdateAccount=Editar una cuenta -UpdateMvts=Modificación de un movimiento +Update=Actualizar +List=Listado +Create=Crear +UpdateAccount=Modificar una cuenta contable +UpdateMvts=Modificar un movimiento WriteBookKeeping=Registrar los asientos en el libro mayor -Bookkeeping=libro mayor -AccountBalanceByMonth=Saldo Mensual +Bookkeeping=Libro Mayor +AccountBalanceByMonth=Saldo mensual -AccountingVentilation=desglose de Contabilidad -AccountingVentilationSupplier=Proveedor de cuentas de ventilación -AccountingVentilationCustomer=Cliente de cuentas de ventilación -Line=línea +AccountingVentilation=Contabilización +AccountingVentilationSupplier=Contabilización compras +AccountingVentilationCustomer=Contabilización ventas +Line=Línea -Ventilate=contabilizar -VentilationAuto=contabilización automática +CAHTF=Total (base imponible) compras a proveedor +InvoiceLines=Líneas de factura para contabilizar +InvoiceLinesDone=Líneas de facturas contabilizadas +IntoAccount=En la cuenta + +Ventilate=Contabilizar +VentilationAuto=Contabilización automática Processing=Tratamiento EndProcessing=Final del tratamiento -AnyLineVentilate=No hay línea para contabilizar -SelectedLines=Las líneas seleccionadas +AnyLineVentilate=No hay líneas para contabilizar +SelectedLines=Líneas seleccionadas Lineofinvoice=Línea de la factura VentilatedinAccount=Contabilizada con éxito en la cuenta contable NotVentilatedinAccount=Cuenta sin contabilización en la contabilidad -ACCOUNTING_SEPARATORCSV=separador CSV +ACCOUNTINGEX_SEPARATORCSV=separador CSV -ACCOUNTING_LIMIT_LIST_VENTILATION=(El máximo recomendado: 50) Número de elementos que se muestran por página para contabilizar -ACCOUNTING_LIST_SORT_VENTILATION_TODO=Páginas de inicio de clasificación de ventilación "desglose" de las pruebas más recientes -ACCOUNTING_LIST_SORT_VENTILATION_DONE=Páginas de inicio de clasificación de ventilación "ventilada" por la evidencia más reciente +ACCOUNTINGEX_LIMIT_LIST_VENTILATION=Número de elementos a contabilizar que se muestran por página (máximo recomendado: 50) +ACCOUNTINGEX_LIST_SORT_VENTILATION_TODO=Ordenar las páginas de contabilización "A contabilizar" por los elementos más recientes +ACCOUNTINGEX_LIST_SORT_VENTILATION_DONE=Ordenar las páginas de contabilización "Contabilizadas" por los elementos más recientes -AccountLength=Cuentas contables longitud mostrada en Dolibarr -AccountLengthDesc=Función para simular una longitud de cuenta contable sustituyendo espacios con el número cero. Esta función sólo afecta a la pantalla, no cambia las cuentas contables registrados en Dolibarr. Para la exportación, esta función se requiere para ser compatible con algunos programas. -ACCOUNTING_LENGTH_GACCOUNT=Longitud de las cuentas generales -ACCOUNTING_LENGTH_AACCOUNT=Duración de subcuentas +AccountLength=Longitud de las cuentas contables mostradas en Dolibarr +AccountLengthDesc=Función para simular una longitud de cuenta contable sustituyendo los espacios por cero. Esta función sólo afecta a la pantalla, no cambia las cuentas contables registradas en Dolibarr. Esta función es necesaria para la exportación, para ser compatible con algunos programas. +ACCOUNTINGEX_LENGTH_GACCOUNT=Longitud de las cuentas generales +ACCOUNTINGEX_LENGTH_AACCOUNT=Longitud de las subcuentas -ACCOUNTING_SELL_JOURNAL=Diario de Ventas -ACCOUNTING_PURCHASE_JOURNAL=Diario de Compras -ACCOUNTING_BANK_JOURNAL=Diario del Banco -ACCOUNTING_CASH_JOURNAL=Diario de Caso -ACCOUNTING_MISCELLANEOUS_JOURNAL=Diario de Operaciones diversas -ACCOUNTING_SOCIAL_JOURNAL=Diario Social +ACCOUNTINGEX_SELL_JOURNAL=Diario de ventas +ACCOUNTINGEX_PURCHASE_JOURNAL=Diario de compras +ACCOUNTINGEX_BANK_JOURNAL=Diario bancario +ACCOUNTINGEX_CASH_JOURNAL=Diario de caja +ACCOUNTINGEX_MISCELLANEOUS_JOURNAL=Diario de operaciones diversas +ACCOUNTINGEX_SOCIAL_JOURNAL=Diario social -ACCOUNTING_ACCOUNT_TRANSFER_CASH=Cuenta de caja -ACCOUNTING_ACCOUNT_SUSPENSE=Cuenta partidas pendientes de aplicación +ACCOUNTINGEX_ACCOUNT_TRANSFER_CASH=Cuenta de caja +ACCOUNTINGEX_ACCOUNT_SUSPENSE=Cuenta operaciones pendientes de asignar -COMPTA_PRODUCT_BUY_ACCOUNT=Cuenta predeterminada de contabilidad para los productos comprados (si no se define en el producto) -COMPTA_PRODUCT_SOLD_ACCOUNT=Cuenta predeterminada de contabilidad para los productos vendidos (si no se define en el producto) -COMPTA_SERVICE_BUY_ACCOUNT=Cuenta predeterminada de contabilidad para los servicios adquiridos (si no está definido en la hoja de servicio) -COMPTA_SERVICE_SOLD_ACCOUNT=Cuenta predeterminada de contabilidad para servicios vendidos (si no se define en la ficha de servicio) +COMPTA_PRODUCT_BUY_ACCOUNT=Cuenta contable predeterminada para los productos comprados (si no se define en el producto) +COMPTA_PRODUCT_SOLD_ACCOUNT=Cuenta contable predeterminada para los productos vendidos (si no se define en el producto) +COMPTA_SERVICE_BUY_ACCOUNT=Cuenta contable predeterminada para los servicios comprados (si no se define en el servicio) +COMPTA_SERVICE_SOLD_ACCOUNT=Cuenta contable predeterminada para los servicios vendidos (si no se define en el servico) Doctype=Tipo de documento -Docdate=fecha -Docref=referencia -Numerocompte=cuenta -Code_tiers=tercero +Docdate=Fecha +Docref=Referencia +Numerocompte=Cuenta +Code_tiers=Tercero Labelcompte=Descripción -Debit=débito -Credit=crédito -Amount=cantidad -Sens=sentido -Codejournal=diario +Debit=Debe +Credit=Crédito +Amount=Cantidad +Sens=Sentido +Codejournal=Diario -DelBookKeeping=Eliminar el libro mayor +DelBookKeeping=Eliminar los registros del Diario Mayor SellsJournal=Diario de ventas PurchasesJournal=Diario de compras DescSellsJournal=Diario de ventas DescPurchasesJournal=Diario de compras -BankJournal=Diario de banco -DescBankJournal=Descripción del diario del Banco -CashJournal=Libro de Caja -DescCashJournal=Descripción Libro de Caja +BankJournal=Diario bancario +DescBankJournal=El diario bancario incluye todos los tipos pagos que no sean de efectivo +CashJournal=Diario de caja +DescCashJournal=El diario de caja incluye el tipo de pago efectivo -CashPayment=Reglas caja +CashPayment=Pago en efectivo -SupplierInvoicePayment=Pago factura de proveedor -CustomerInvoicePayment=Pago Factura a cliente +SupplierInvoicePayment=Pago de factura de proveedor +CustomerInvoicePayment=Cobro de factura a cliente -ThirdPartyAccount=Cuenta tercero +ThirdPartyAccount=Cuenta de tercero -NumMvts=Número de movimiento -ListeMvts=Apuntes del movimiento -ErrorDebitCredit=Débito y Crédito no pueden terner valor al mismo tiempo +NewAccountingMvt=Nuevo movimiento +NumMvts=Número del movimiento +ListeMvts=Listado del movimiento +ErrorDebitCredit=Debe y Haber no pueden contener un valor al mismo tiempo -ReportThirdParty=Lista cuentas de terceros -DescThirdPartyReport=Consult here the list of the thirdparty customers and the suppliers and their accounting accounts +ReportThirdParty=Listado cuentas de terceros +DescThirdPartyReport=Consulte aquí el listado de clientes y proveedores y sus códigos contables -ListAccounts=Lista de cuentas +ListAccounts=Listado de cuentas contables Pcgversion=Versión del plan -Pcgtype=Tipo de cuenta -Pcgsubtype=tipo de subcuenta -Accountparent=Cuenta padre -Active=Activa +Pcgtype=Tipo del plan +Pcgsubtype=Subcuenta +Accountparent=Padre de la cuenta +Active=Estado NewFiscalYear=Nuevo año fiscal -NewMovCompta=Nuevo registro contable -DescVentilCustomer=Consulte aquí la contabilidad anual de sus facturas a clientes +DescVentilCustomer=Consulte aquí la contabilización anual de sus facturas a clientes TotalVente=Total ventas (base imponible) TotalMarge=Total margen ventas DescVentilDoneCustomer=Consulte aquí las líneas de facturas a clientes y sus cuentas contables -DescVentilTodoCustomer=Contabilize sus líneas de facturas a clientes +DescVentilTodoCustomer=Contabilice sus líneas de facturas a clientes con una cuenta contable ChangeAccount=Cambie la cuenta para las líneas seleccionadas a la cuenta: Vide=- DescVentilSupplier=Consulte aquí la contabilidad anual de sus facturas de proveedores @@ -154,14 +156,3 @@ ValidateHistory=Validar automáticamente ErrorAccountancyCodeIsAlreadyUse=Error, no puede eliminar esta cuenta ya que está siendo usada FicheVentilation=Ficha contable - -Accountancy_code_buy=Código compras -Accountancy_code_buy_suggest=Código compras sugerido -Accountancy_code_sell=Código ventas -Accountancy_code_sell_suggest=Código ventas sugerido -CreateMvts=Crear movimiento -customer_invoice=Factura a cliente - -accountingaccount=Cuenta contable -label=Descripción -Import=Importar \ No newline at end of file diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 6d136f38157..7e07827309a 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -45,6 +45,8 @@ ErrorModuleRequireDolibarrVersion=Error, este módulo requiere una versión %s o ErrorDecimalLargerThanAreForbidden=Error, las precisiones superiores a %s no están soportadas. DictionarySetup=Diccionarios Dictionary=Diccionarios +Chartofaccounts=Plan contable +Fiscalyear=Años fiscales ErrorReservedTypeSystemSystemAuto=El uso del tipo 'system' y 'systemauto' está reservado. Puede utilizar 'user' como valor para añadir su propio registro ErrorCodeCantContainZero=El código no puede contener el valor 0 DisableJavascript=Deshabilitar Javascript y funciones Ajax (Recomendado para personas ciegas o navegadores de texto) diff --git a/htdocs/langs/es_ES/agenda.lang b/htdocs/langs/es_ES/agenda.lang index 2bc22e55b67..b3aa4a58375 100644 --- a/htdocs/langs/es_ES/agenda.lang +++ b/htdocs/langs/es_ES/agenda.lang @@ -2,11 +2,11 @@ IdAgenda=ID de evento Actions=Eventos ActionsArea=Área de eventos (acciones y tareas) -Agenda= Agenda -Agendas= Agendas -Calendar= Calendario -Calendars= Calendarios -LocalAgenda=Calendario local +Agenda=Agenda +Agendas=Agendas +Calendar=Calendario +Calendars=Calendarios +LocalAgenda=Calendario interno AffectedTo=Asignada a DoneBy=Realizado por Event=Evento @@ -22,7 +22,7 @@ MenuToDoActions=Eventos incompletos MenuDoneActions=Eventos terminados MenuToDoMyActions=Mis eventos incompletos MenuDoneMyActions=Mis eventos terminados -ListOfEvents=Listado de eventos Dolibarr +ListOfEvents=Listado de eventos (calendario interno) ActionsAskedBy=Eventos registrados por ActionsToDoBy=Eventos asignados a ActionsDoneBy=Eventos realizados por @@ -88,3 +88,4 @@ ExtSiteUrlAgenda=Url de acceso al archivo .ical ExtSiteNoLabel=Sin descripción WorkingTimeRange=Rango temporal WorkingDaysRange=Rango diario +AddEvent=Crear evento diff --git a/htdocs/langs/es_ES/dict.lang b/htdocs/langs/es_ES/dict.lang index 7b440d71211..42c6d967657 100644 --- a/htdocs/langs/es_ES/dict.lang +++ b/htdocs/langs/es_ES/dict.lang @@ -253,7 +253,6 @@ CivilityMR=Señor CivilityMLE=Señorita CivilityMTRE=Don CivilityDR=Doctor - ##### Currencies ##### Currencyeuros=Euros CurrencyAUD=Dólares Aus. @@ -290,10 +289,10 @@ CurrencyXOF=Francos CFA BCEAO CurrencySingXOF=Franco CFA BCEAO CurrencyXPF=Francos CFP CurrencySingXPF=Franco CFP - CurrencyCentSingEUR=céntimo +CurrencyCentINR=paisa +CurrencyCentSingINR=paise CurrencyThousandthSingTND=milésimo - #### Input reasons ##### DemandReasonTypeSRC_INTE=Internet DemandReasonTypeSRC_CAMP_MAIL=Campaña correo @@ -306,7 +305,6 @@ DemandReasonTypeSRC_WOM=Boca a boca DemandReasonTypeSRC_PARTNER=Socio DemandReasonTypeSRC_EMPLOYEE=Empleado DemandReasonTypeSRC_SPONSORING=Patrocinador - #### Paper formats #### PaperFormatEU4A0=Formato 4A0 PaperFormatEU2A0=Formato 2A0 diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index 818b93c87c0..926a356db32 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -133,7 +133,6 @@ ErrorPHPNeedModule=Error, su PHP debe tener instalado el módulo %s para ErrorOpenIDSetupNotComplete=Ha configurado Dolibarr para aceptar la autentificación OpenID, pero la URL del servicio OpenID no se encuentra definida en la constante %s ErrorWarehouseMustDiffers=El almacén de origen y destino deben de ser diferentes ErrorBadFormat=¡El formato es erróneo! -ErrorPaymentDateLowerThanInvoiceDate=La fecha de pago (%s) no puede ser anterior a la fecha (%s) de la factura %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Error, este miembro aún no está enlazado a un tercero. Enlace el miembro a un tercero existente o cree un tercero nuevo antes de crear la suscripción con la factura. ErrorThereIsSomeDeliveries=Error, hay entregas vinculadas a este envío. No se puede eliminar. ErrorCantDeletePaymentReconciliated=No se puede eliminar un pago que ha generado una transacción bancaria que se encuentra conciliada @@ -156,3 +155,4 @@ WarningUsingThisBoxSlowDown=Atención, el uso de este panel provoca serias ralen WarningClickToDialUserSetupNotComplete=La configuración de ClickToDial para su cuenta de usuario no está completa (vea la pestaña ClickToDial en su ficha de usuario) WarningNotRelevant=Operación irrelevante para este conjunto de datos WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Funcionalidad desactivada cuando la configuración de visualización es optimizada para personas ciegas o navegadores de texto. +WarningPaymentDateLowerThanInvoiceDate=La fecha de pago (%s) es anterior a la fecha (%s) de la factura %s. diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 7764545ed0a..d92caea7ab2 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -645,6 +645,7 @@ OptionalFieldsSetup=Configuración de los atributos opcionales URLPhoto=Url de la foto/logo SetLinkToThirdParty=Vincular a otro tercero CreateDraft=Crear borrador +SetToDraft=Volver a borrador ClickToEdit=Clic para editar ObjectDeleted=Objeto %s eliminado ByCountry=Par país diff --git a/htdocs/langs/es_ES/salaries.lang b/htdocs/langs/es_ES/salaries.lang index bc4079feb21..c8e3707d5df 100644 --- a/htdocs/langs/es_ES/salaries.lang +++ b/htdocs/langs/es_ES/salaries.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - users +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Código contable pago de salarios +SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Código contable cargas financieras Salary=Salario Salaries=Salarios Employee=Empleado @@ -6,3 +8,5 @@ NewSalaryPayment=Nuevo pago SalaryPayment=Pago de salario SalariesPayments=Pagos de salarios ShowSalaryPayment=Ver pago +THM=Precio medio por hora +TJM=Precio medio por día diff --git a/htdocs/langs/es_ES/users.lang b/htdocs/langs/es_ES/users.lang index 37851adb724..65b6d8ed0a0 100644 --- a/htdocs/langs/es_ES/users.lang +++ b/htdocs/langs/es_ES/users.lang @@ -119,3 +119,4 @@ HierarchicView=Vista jerárquica UseTypeFieldToChange=Modificar el campo Tipo para cambiar OpenIDURL=Dirección OpenID LoginUsingOpenID=Usar OpenID para iniciar sesión +WeeklyHours=Horas semanales diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 72c7475fd1d..8f66eb5319f 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -122,6 +122,7 @@ CustomerInvoicePayment=Règlement de facture client ThirdPartyAccount=Compte tiers +NewAccountingMvt=Nouveau mouvement NumMvts=Numéro de mouvement ListeMvts=Liste du mouvement ErrorDebitCredit=Debit et Credit ne peuvent avoir une valeur en même temps diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 7eed1bce332..8fa7ed80885 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -45,6 +45,8 @@ ErrorModuleRequireDolibarrVersion=Erreur, ce module requiert une version %s ou s ErrorDecimalLargerThanAreForbidden=Erreur, les précisions supérieures à %s ne sont pas prises en charge. DictionarySetup=Dictionnaires Dictionary=Dictionnaires +Chartofaccounts=Chart of accounts +Fiscalyear=Fiscal years ErrorReservedTypeSystemSystemAuto=Erreur, les valeurs 'system' et 'systemauto' sont réservées. Vous pouvez utiliser la valeur 'user' pour ajouter vos propres enregistrements ErrorCodeCantContainZero=Erreur, le code ne peut contenir la valeur 0 DisableJavascript=Désactive les fonctions Javascript et Ajax (Recommandé pour les personnes aveugles ou navigateurs text). diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index f33ada9956c..43a7a2faf11 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -2,11 +2,11 @@ IdAgenda=ID évènement Actions=Événements ActionsArea=Espace événements (actions et tâches) -Agenda= Agenda -Agendas= Agendas -Calendar= Calendrier -Calendars= Calendriers -LocalAgenda=Calendrier local +Agenda=Agenda +Agendas=Agendas +Calendar=Calendrier +Calendars=Calendriers +LocalAgenda=Calendrier interne AffectedTo=Affecté à DoneBy=Réalisé par Event=Evénement @@ -88,3 +88,4 @@ ExtSiteUrlAgenda=URL d'accès au fichier ical ExtSiteNoLabel=Aucune description WorkingTimeRange=Plage d'heures travaillées WorkingDaysRange=Plage de jours travaillés +AddEvent=Créer événement diff --git a/htdocs/langs/fr_FR/dict.lang b/htdocs/langs/fr_FR/dict.lang index eb8a65ed46c..cb3260e6108 100644 --- a/htdocs/langs/fr_FR/dict.lang +++ b/htdocs/langs/fr_FR/dict.lang @@ -253,7 +253,6 @@ CivilityMR=Monsieur CivilityMLE=Mademoiselle CivilityMTRE=Maître CivilityDR=Docteur - ##### Currencies ##### Currencyeuros=Euros CurrencyAUD=Dollars Aus. @@ -290,10 +289,10 @@ CurrencyXOF=Francs CFA BCEAO CurrencySingXOF=Franc CFA BCEAO CurrencyXPF=Francs CFP CurrencySingXPF=Franc CFP - CurrencyCentSingEUR=centime +CurrencyCentINR=paisa +CurrencyCentSingINR=paise CurrencyThousandthSingTND=millime - #### Input reasons ##### DemandReasonTypeSRC_INTE=Internet DemandReasonTypeSRC_CAMP_MAIL=Campagne Publipostage @@ -306,7 +305,6 @@ DemandReasonTypeSRC_WOM=Bouche à oreille DemandReasonTypeSRC_PARTNER=Partenaire DemandReasonTypeSRC_EMPLOYEE=Employé DemandReasonTypeSRC_SPONSORING=Parrainage/Sponsoring - #### Paper formats #### PaperFormatEU4A0=Format 4A0 PaperFormatEU2A0=Format 2A0 diff --git a/htdocs/langs/fr_FR/donations.lang b/htdocs/langs/fr_FR/donations.lang index 9af7a87a12d..2da59454571 100644 --- a/htdocs/langs/fr_FR/donations.lang +++ b/htdocs/langs/fr_FR/donations.lang @@ -37,4 +37,5 @@ IConfirmDonationReception=Le bénéficiaire reconnait avoir reçu au titre des d FrenchOptions=Options éligibles en France DONATION_ART200=Les dons ou versements reçus sont éligibles à l'article 200 du CGI DONATION_ART238=Les dons ou versements reçus sont éligibles à l'article 238bis du CGI -DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI \ No newline at end of file +DONATION_ART885=Les dons ou versements reçus sont éligibles à l'article 885-0 V bis A du CGI +MinimumAmount=Le montant minimum du don est de %s \ No newline at end of file diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 3cd8609a047..954a83375b9 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -133,7 +133,6 @@ ErrorPHPNeedModule=Erreur, votre PHP doit avoir le module %s installé po ErrorOpenIDSetupNotComplete=Vous avez configuré Dolibarr pour accepter l'authentication OpenID, mais l'URL du service OpenID n'est pas défini dans la constante %s ErrorWarehouseMustDiffers=Les entrepôts source et destination doivent être différents ErrorBadFormat=Mauvais format -ErrorPaymentDateLowerThanInvoiceDate=La date de paiement (%s) ne peut être inférieure à la date de facturaction (%s) de la facture %s. ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst=Erreur, cet adhérent n'est lié à aucun tiers. Lier l'adhérent à un tiers existant ou créer un nouveau tiers pour le lier avant de créer l'adhésion avec facture. ErrorThereIsSomeDeliveries=Erreur, il y a des bordereaux de réception liées à ces expéditions. La suppression est refusée. @@ -154,3 +153,4 @@ WarningUsingThisBoxSlowDown=Attention, l'utilisation de cette boite provoque de WarningClickToDialUserSetupNotComplete=La configuration ClickToDial pour votre compte utilisateur n'est pas complète (voir l'onglet ClickToDial sur votre fiche utilisateur) WarningNotRelevant=Opération non pertinente pour cet ensemble de données WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs=Fonction désactivé quand l'affichage est en mode optimisé pour les personnes aveugles ou les navigateurs textes. +WarningPaymentDateLowerThanInvoiceDate=La date de paiement (%s) est inférieure à la date de facturaction (%s) de la facture %s. diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 7d89d6f833c..08cc727600a 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -645,7 +645,7 @@ OptionalFieldsSetup=Configuration des attributs complémentaires URLPhoto=URL de la photo/logo SetLinkToThirdParty=Lier vers un autre tiers CreateDraft=Créer brouillon -SetToDraft=Repasser en brouillon +SetToDraft=Back to draft ClickToEdit=Cliquer ici pour éditer ObjectDeleted=Objet %s supprimé ByCountry=Par pays diff --git a/htdocs/langs/fr_FR/salaries.lang b/htdocs/langs/fr_FR/salaries.lang index 34b7e1cbb9c..c76f03c8d9f 100644 --- a/htdocs/langs/fr_FR/salaries.lang +++ b/htdocs/langs/fr_FR/salaries.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - users +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Code comptable pour les paiements des salaires +SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Code comptable pour les charges financières Salary=Salaires Salaries=Salaires Employee=Employé @@ -6,3 +8,5 @@ NewSalaryPayment=Nouveau règlement de salaire SalaryPayment=Règlement salaire SalariesPayments=Règlements des salaires ShowSalaryPayment=Afficher règlement de salaire +THM=Tarif horaire moyen +TJM=Tarif journalier moyen diff --git a/htdocs/langs/fr_FR/users.lang b/htdocs/langs/fr_FR/users.lang index 834d63cadd5..447f5b661f8 100644 --- a/htdocs/langs/fr_FR/users.lang +++ b/htdocs/langs/fr_FR/users.lang @@ -119,3 +119,4 @@ HierarchicView=Vue hiérarchique UseTypeFieldToChange=Modifier le champ Type pour changer OpenIDURL=URL OpenID LoginUsingOpenID=Se connecter par OpenID +WeeklyHours=Heures de travail hebdomadaires diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 06505a8fbc6..8bd8632e2e1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1398,7 +1398,7 @@ class Product extends CommonObject return -1; } - $sql = "SELECT rowid, ref, label, description, url, note, customcode, fk_country, price, price_ttc,"; + $sql = "SELECT rowid, ref, ref_ext, label, description, url, note, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, tosell,"; $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,"; $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; @@ -1423,6 +1423,7 @@ class Product extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; + $this->ref_ext = $obj->ref_ext; $this->libelle = $obj->label; // TODO deprecated $this->label = $obj->label; $this->description = $obj->description; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 78d4cc55a4e..9d1c138bc5f 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -186,12 +186,12 @@ class Entrepot extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete", LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_stock"; $sql.= " WHERE fk_entrepot = " . $this->id; - dol_syslog("Entrepot::delete", LOG_DEBUG); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); if ($resql1 && $resql2) @@ -202,8 +202,8 @@ class Entrepot extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql1=$this->db->query($sql); - // Update denormalized fields because we change content of produt_stock - $sql = "UPDATE ".MAIN_DB_PREFIX."product p SET p.stock= (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock ps WHERE ps.fk_product = p.rowid)"; + // Update denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql + $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET stock = (SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql2=$this->db->query($sql); @@ -217,7 +217,7 @@ class Entrepot extends CommonObject { $this->db->rollback(); $this->error=$this->db->lasterror(); - return -1; + return -2; } } else @@ -540,7 +540,7 @@ class Entrepot extends CommonObject $this->description = 'WAREHOUSE SPECIMEN '.dol_print_date($now,'dayhourlog'); $this->statut=1; $this->specimen=1; - + $this->lieu='Location test'; $this->address='21 jump street'; $this->zip='99999'; diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 86e930d8cf1..1155ef6cb40 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -261,7 +261,7 @@ else // Country print '
'; + print ''; + print ''; + print ''; + print ' '; + print ''; + print ' '; + // Développé dans la 3.7 + //print img_search(); + //print img_searchclear(); + print ''; + print ''; + print ''; + print ''.$langs->trans("All").' / '.$langs->trans("None").''; + print '
'; print ''; print '    '; - $liststatus=array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Validated"), '2'=>$langs->trans("Billed")); - print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1); + $liststatus=$interventionstatic->statuts_short; + print $form->selectarray('search_status', $liststatus, GETPOST('search_status'), 1, 0, 0, '', 1); print ''; print '
'.dol_htmlentitiesbr(dol_trunc($objp->description,20)).''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''.dol_htmlentitiesbr(dol_trunc($objp->descriptiondetail,20)).''.dol_print_date($db->jdate($objp->dp),'dayhour')."'.convertSecondToTime($objp->duree).'
'.$langs->trans('Country').''; - if (! empty($object->country_code)) + if (! empty($object->country_code)) { $img=picto_from_langcode($object->country_code); print ($img?$img.' ':''); @@ -339,14 +339,14 @@ else print "id."\">".$langs->trans("Modify").""; else print "".$langs->trans("Modify").""; - + if ($user->rights->stock->supprimer) print "id."\">".$langs->trans("Delete").""; else print "".$langs->trans("Delete").""; } } - + print ""; @@ -375,7 +375,7 @@ else $sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,"; $sql.= " ps.pmp, ps.reel as value"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_stock ps, ".MAIN_DB_PREFIX."product p"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; $sql.= " WHERE ps.fk_product = p.rowid"; $sql.= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) $sql.= " AND ps.fk_entrepot = ".$object->id; diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index a639bd86239..04a9c03aa59 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/liste.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -20,7 +20,7 @@ /** * \file htdocs/product/stock/liste.php * \ingroup stock - * \brief Page liste des stocks + * \brief Page with warehouse and stock value */ require '../../main.inc.php'; @@ -44,18 +44,32 @@ if ($page < 0) $page = 0; $limit = $conf->liste_limit; $offset = $limit * $page; +$year = strftime("%Y",time()); -$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; + +/* + * View + */ + +$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; +$sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $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; if ($sref) { - $sql.= " AND e.label like '%".$db->escape($sref)."%'"; + $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; } if ($sall) { - $sql.= " AND (e.description like '%".$db->escape($sall)."%' OR e.lieu like '%".$db->escape($sall)."%' OR e.address like '%".$db->escape($sall)."%' OR e.town like '%".$db->escape($sall)."%')"; + $sql.= " AND (e.label LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.description LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.lieu LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.address LIKE '%".$db->escape($sall)."%'"; + $sql.= " OR e.town LIKE '%".$db->escape($sall)."%')"; } +$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -69,31 +83,57 @@ if ($result) $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("ListOfWarehouses"),$help_url); - print_barre_liste($langs->trans("ListOfWarehouses"), $page, "liste.php", "", $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num); print ''; print ""; - print_liste_field_titre($langs->trans("Ref"),"liste.php", "e.label","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LocationSummary"),"liste.php", "e.lieu","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"liste.php", "e.statut",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); print "\n"; - if ($num) { + if ($num) + { $entrepot=new Entrepot($db); - - $var=True; + $total = $totalsell = 0; + $var=false; while ($i < min($num,$limit)) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; - print ''; - print ''; - print ''; - print "\n"; - $i++; + print ""; + print ''; + // Location + print ''; + // PMP value + print ''; + // Selling value + print ''; + // Status + print ''; + print "\n"; + + $total += price2num($objp->estimatedvalue,'MU'); + $totalsell += price2num($objp->sellvalue,'MU'); + + $var=!$var; + $i++; } + + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; } $db->free($result); @@ -107,6 +147,6 @@ else } -$db->close(); - llxFooter(); + +$db->close(); diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 40fff978bf9..87fec698274 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -339,7 +339,7 @@ print '
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.''.$entrepot->LibStatut($objp->statut,5).'
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.''; + if (price2num($objp->estimatedvalue,'MT')) print price(price2num($objp->estimatedvalue,'MT'),1); + else print ''; + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($objp->sellvalue,'MT'),1); + else print $langs->trans("Variable"); + print ''.$entrepot->LibStatut($objp->statut,5).'
'.$langs->trans("Total").''.price(price2num($total,'MT'),1,$langs,0,0,-1,$conf->currency).''.price(price2num($totalsell,'MT'),1,$langs,0,0,-1,$conf->currency).' 
'; print ''; print ''; print ''; -print '
'; +print '

'; print '
'; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 17e23fef009..03c779c0991 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -31,12 +31,12 @@ $langs->load("stocks"); // Security check $result=restrictedArea($user,'stock'); -$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; -$snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"]; -$sall=isset($_GET["sall"])?$_GET["sall"]:$_POST["sall"]; +$sref=GETPOST("sref");; +$snom=GETPOST("snom"); +$sall=GETPOST("sall"); -$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; -$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; +$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder"); if (! $sortfield) $sortfield="e.label"; if (! $sortorder) $sortorder="ASC"; $page = $_GET["page"]; @@ -51,8 +51,7 @@ $year = strftime("%Y",time()); * View */ -// Affichage valorisation par entrepot -$sql = "SELECT e.rowid as ref, e.label, e.statut, e.lieu,"; +$sql = "SELECT e.rowid, e.label as ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays,"; $sql.= " SUM(ps.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; @@ -60,7 +59,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; $sql.= " WHERE e.entity = ".$conf->entity; if ($sref) { - $sql.= " AND e.ref LIKE '%".$sref."%'"; + $sql.= " AND e.label LIKE '%".$db->escape($sref)."%'"; } if ($sall) { @@ -70,7 +69,7 @@ if ($sall) $sql.= " OR e.address LIKE '%".$db->escape($sall)."%'"; $sql.= " OR e.town LIKE '%".$db->escape($sall)."%')"; } -$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu"; +$sql.= " GROUP BY e.rowid, e.label, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); @@ -84,15 +83,15 @@ if ($result) $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; llxHeader("",$langs->trans("EnhancedValueOfWarehouses"),$help_url); - print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, "valo.php", "", $sortfield, $sortorder,'',$num); + print_barre_liste($langs->trans("EnhancedValueOfWarehouses"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder,'',$num); print ''; print ""; - print_liste_field_titre($langs->trans("Ref"),"valo.php", "e.label","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LocationSummary"),"valo.php", "e.lieu","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValue"),"valo.php", "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValueSell"),"", "",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"valo.php", "e.statut",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("LocationSummary"), $_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); print "\n"; if ($num) @@ -104,7 +103,7 @@ if ($result) { $objp = $db->fetch_object($result); print ""; - print ''; + print ''; print ''; // PMP value print '\n"; } + $db->free($result); + print "
'.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->label.''.img_object($langs->trans("ShowWarehouse"),'stock').' '.$objp->ref.''.$objp->lieu.''; @@ -133,20 +132,22 @@ if ($result) print "
"; print '
'; $file='entrepot-'.$year.'.png'; - if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file)) + if (file_exists($conf->stock->dir_temp.'/'.$file)) { $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file; print ''; } $file='entrepot-'.($year-1).'.png'; - if (file_exists(DOL_DATA_ROOT.'/entrepot/temp/'.$file)) + if (file_exists($conf->stock->dir_temp.'/'.$file)) { $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_stock&file='.$file; print '
'; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index f4815c936f9..f359f789c3f 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -41,9 +41,10 @@ $mine = GETPOST('mode')=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $object->fetch(0,$ref); + $object->fetch($id,$ref); + $object->fetch_thirdparty(); $id=$object->id; } @@ -140,82 +141,73 @@ $userstatic=new User($db); if ($id > 0 || ! empty($ref)) { - if ( $object->fetch($id,$ref) > 0) + // To verify role of users + //$userAccess = $object->restrictedProjectArea($user,'read'); + $userWrite = $object->restrictedProjectArea($user,'write'); + //$userDelete = $object->restrictedProjectArea($user,'delete'); + //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; + + $head = project_prepare_head($object); + dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); + + + /* + * Projet synthese pour rappel + */ + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Label + print ''; + + // Customer + print ""; + print ''; + + // Visibility + print ''; + + // Statut + print ''; + + // Date start + print ''; + + // Date end + print ''; + + print "
'.$langs->trans('Ref').''; + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) { - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - - // To verify role of users - //$userAccess = $object->restrictedProjectArea($user,'read'); - $userWrite = $object->restrictedProjectArea($user,'write'); - //$userDelete = $object->restrictedProjectArea($user,'delete'); - //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; - - $head = project_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project')); - - - /* - * Projet synthese pour rappel - */ - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Label - print ''; - - // Customer - print ""; - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print "
'.$langs->trans('Ref').''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); - $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans("Label").''.$object->title.'
".$langs->trans("ThirdParty")."'; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); - else print ' '; - print '
'.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
"; - - print ''; - - // Contacts lines (modules that overwrite templates must declare this into descriptor) - $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); - foreach($dirtpls as $reldir) - { - $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); - if ($res) break; - } + $objectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; } - else + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + print '
'.$langs->trans("Label").''.$object->title.'
".$langs->trans("ThirdParty")."'; + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); + else print ' '; + print '
'.$langs->trans("Visibility").''; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'day'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'day'); + print '
"; + + print '
'; + + // Contacts lines (modules that overwrite templates must declare this into descriptor) + $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); + foreach($dirtpls as $reldir) { - print "ErrorRecordNotFound"; + $res=@include dol_buildpath($reldir.'/contacts.tpl.php'); + if ($res) break; } } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index d40682d7ce6..611fc314481 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -46,9 +46,9 @@ if ($user->societe_id > 0) $socid=$user->societe_id; $result=restrictedArea($user,'projet',$id,''); $object = new Project($db); -$object->fetch($id,$ref); -if ($object->id > 0) +if ($id > 0 || ! empty($ref)) { + $object->fetch($id,$ref); $object->fetch_thirdparty(); $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); } @@ -85,8 +85,6 @@ if ($object->id > 0) { $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $object->restrictedProjectArea($user,'write'); @@ -124,7 +122,7 @@ if ($object->id > 0) // Company print ''.$langs->trans("ThirdParty").''; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index abdf6f81b5b..b5a1d089c96 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -61,12 +61,17 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $project = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $project->fetch(0,$ref); + $project->fetch($id,$ref); + $project->fetch_thirdparty(); $projectid=$project->id; -}else { +} +else +{ $project->fetch($projectid); + $project->fetch_thirdparty(); + $projectid=$project->id; } // Security check @@ -87,10 +92,6 @@ $formproject=new FormProjets($db); $userstatic=new User($db); -$project = new Project($db); -$project->fetch($projectid,$ref); -$project->fetch_thirdparty(); - // To verify role of users $userAccess = $project->restrictedProjectArea($user); diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 09b85f38cbe..f44f4efe638 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -49,10 +49,11 @@ $hookmanager->initHooks(array('projectcard')); $object = new Project($db); $extrafields = new ExtraFields($db); -$object->fetch($id,$ref); -if ($object->id > 0) +if ($id > 0 || ! empty($ref)) { + $object->fetch($id,$ref); $object->fetch_thirdparty(); + $id=$object->id; } // Security check @@ -259,8 +260,8 @@ if (empty($reshook)) { $db->commit(); - if (GETPOST('socid','int') > 0) $object->societe->fetch(GETPOST('socid','int')); - else unset($object->societe); + if (GETPOST('socid','int') > 0) $object->thirdparty->fetch(GETPOST('socid','int')); + else unset($object->thirdparty); } } @@ -488,7 +489,6 @@ else * Show or edit */ - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); $res=$object->fetch_optionals($object->id,$extralabels); // To verify role of users @@ -562,7 +562,7 @@ else // Customer print ''.$langs->trans("ThirdParty").''; - $text=$form->select_company($object->societe->id,'socid','',1,1); + $text=$form->select_company($object->thirdparty->id,'socid','',1,1); $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); print ''; @@ -633,7 +633,7 @@ else // Third party print ''.$langs->trans("ThirdParty").''; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); else print' '; print ''; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 79d302addd3..0c06c30ba57 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -38,9 +38,10 @@ $mine = ($mode == 'mine' ? 1 : 0); //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $object->fetch(0,$ref); + $object->fetch($id,$ref); + $object->fetch_thirdparty(); $id=$object->id; } @@ -69,7 +70,6 @@ $formother=new FormOther($db); $userstatic=new User($db); $companystatic=new Societe($db); $task = new Task($db); -$object = new Project($db); $arrayofcss=array('/includes/jsgantt/jsgantt.css'); @@ -86,9 +86,6 @@ llxHeader("",$langs->trans("Tasks"),$help_url,'',0,0,$arrayofjs,$arrayofcss); if ($id > 0 || ! empty($ref)) { - $object->fetch($id,$ref); - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $object->restrictedProjectArea($user,'write'); @@ -123,7 +120,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Label").''.$object->title.''; print ''.$langs->trans("ThirdParty").''; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print ''; print ''; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 9622f4fa480..4e81c2efca3 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -180,9 +180,10 @@ if ( $resql ) if ($num > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { -/* print ''; +/* $langs->load("errors"); + print ''; print ''; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print '';*/ } else diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 493141cbe95..a086f632a36 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -36,9 +36,10 @@ $mine = $_REQUEST['mode']=='mine' ? 1 : 0; //if (! $user->rights->projet->all->lire) $mine=1; // Special for projects $object = new Project($db); -if ($ref) +if ($id > 0 || ! empty($ref)) { - $object->fetch(0,$ref); + $object->fetch($id,$ref); + $object->fetch_thirdparty(); $id=$object->id; } @@ -66,77 +67,71 @@ llxHeader("",$langs->trans("Project"),$help_url); $form = new Form($db); $userstatic=new User($db); -$object = new Project($db); $now=dol_now(); if ($id > 0 || ! empty($ref)) { - if ($object->fetch($id, $ref)) + // To verify role of users + //$userAccess = $object->restrictedProjectArea($user,'read'); + $userWrite = $object->restrictedProjectArea($user,'write'); + //$userDelete = $object->restrictedProjectArea($user,'delete'); + //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; + + $head = project_prepare_head($object); + dol_fiche_head($head, 'notes', $langs->trans('Project'), 0, ($object->public?'projectpub':'project')); + + print ''; + + $linkback = ''.$langs->trans("BackToList").''; + + // Ref + print ''; + + // Label + print ''; + + // Third party + print ''; + + // Visibility + print ''; + + // Statut + print ''; + + // Date start + print ''; + + // Date end + print ''; + + print "
'.$langs->trans("Ref").''; + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) { - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); - - // To verify role of users - //$userAccess = $object->restrictedProjectArea($user,'read'); - $userWrite = $object->restrictedProjectArea($user,'write'); - //$userDelete = $object->restrictedProjectArea($user,'delete'); - //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; - - $head = project_prepare_head($object); - dol_fiche_head($head, 'notes', $langs->trans('Project'), 0, ($object->public?'projectpub':'project')); - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Label - print ''; - - // Third party - print ''; - - // Visibility - print ''; - - // Statut - print ''; - - // Date start - print ''; - - // Date end - print ''; - - print "
'.$langs->trans("Ref").''; - // Define a complementary filter for search of next/prev ref. - if (! $user->rights->projet->all->lire) - { - $projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); - $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; - } - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); - else print' '; - print '
'.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; - print dol_print_date($object->date_start,'day'); - print '
'.$langs->trans("DateEnd").''; - print dol_print_date($object->date_end,'day'); - print '
"; - - print '
'; - - $colwidth=30; - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - - dol_fiche_end();; + $projectsListId = $object->getProjectsAuthorizedForUser($user,$mine,0); + $object->next_prev_filter=" rowid in (".(count($projectsListId)?join(',',array_keys($projectsListId)):'0').")"; } + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); + print '
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); + else print' '; + print '
'.$langs->trans("Visibility").''; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans("DateStart").''; + print dol_print_date($object->date_start,'day'); + print '
'.$langs->trans("DateEnd").''; + print dol_print_date($object->date_end,'day'); + print '
"; + + print '
'; + + $colwidth=30; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + dol_fiche_end();; } llxFooter(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index f72b8c6963d..994779fcac9 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -47,7 +47,7 @@ $object = new Project($db); $taskstatic = new Task($db); $extrafields_project = new ExtraFields($db); $extrafields_task = new ExtraFields($db); -if ($id > 0 || $ref) +if ($id > 0 || ! empty($ref)) { $object->fetch($id,$ref); $id=$object->id; @@ -130,8 +130,8 @@ if ($action == 'createtask' && $user->rights->projet->creer) if ($taskid > 0) { $result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal'); - } - else + } + else { setEventMessage($task->error,'errors'); setEventMessage($task->errors,'errors'); @@ -183,7 +183,7 @@ llxHeader("",$langs->trans("Tasks"),$help_url); if ($id > 0 || ! empty($ref)) { $object->fetch($id, $ref); - if ($object->societe->id > 0) $result=$object->societe->fetch($object->societe->id); + $object->fetch_thirdparty(); $res=$object->fetch_optionals($object->id,$extralabels_projet); @@ -198,7 +198,7 @@ if ($id > 0 || ! empty($ref)) $head=project_prepare_head($object); dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project')); - + $param=($mode=='mine'?'&mode=mine':''); print ''; @@ -221,7 +221,7 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; @@ -259,7 +259,7 @@ if ($id > 0 || ! empty($ref)) } -if ($action == 'create' && $user->rights->projet->creer && (empty($object->societe->id) || $userWrite > 0)) +if ($action == 'create' && $user->rights->projet->creer && (empty($object->thirdparty->id) || $userWrite > 0)) { if ($id > 0 || ! empty($ref)) print '
'; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 1b915ceca19..cdf90a918a3 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -128,9 +128,10 @@ print "\n"; if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { + $langs->load("errors"); print ''; print ''; } else diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 72558da58bb..cfd37436b72 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1840,12 +1840,18 @@ class Societe extends CommonObject $nump = $this->db->num_rows($resql); if ($nump) { + $sepa="("; $sepb=")"; + if ($mode == 'email') + { + $sepa="<"; $sepb=">"; + } $i = 0; while ($i < $nump) { $obj = $this->db->fetch_object($resql); if ($mode == 'email') $property=$obj->email; else if ($mode == 'mobile') $property=$obj->phone_mobile; + else $property=$obj->$mode; // Show all contact. If hidedisabled is 1, showonly contacts with status = 1 if ($obj->statut == 1 || empty($hidedisabled)) @@ -1858,11 +1864,11 @@ class Societe extends CommonObject if (!empty($obj->poste)) { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." <".$property.">"; + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname)).($obj->poste?" - ".$obj->poste:"").(($mode != 'poste' && $property)?" ".$sepa.$property.$sepb:''); } else { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname)).(($mode != 'poste' && $property)?" ".$sepa.$property.$sepb:''); } } $i++; diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index dfc0aac590a..d5d9c45fa36 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -590,4 +590,4 @@ function updateActionComm($authentication,$actioncomm) } // Return the results. -$server->service($HTTP_RAW_POST_DATA); +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index 1b85c677175..3c723947764 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -298,7 +298,5 @@ function getCategory($authentication,$id) return $objectresp; } - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 672f90a7bd1..f42c270fa42 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -712,6 +712,6 @@ function updateContact($authentication,$contact) return $objectresp; } -// Return the results. -$server->service($HTTP_RAW_POST_DATA); +// Return the results. +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index e8c6f166890..8412ed6ab1b 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -541,6 +541,8 @@ function createInvoice($authentication,$invoice) $newline->total_ht=$line['total_net']; $newline->total_tva=$line['total_vat']; $newline->total_ttc=$line['total']; + $newline->date_start=dol_stringtotime($line['date_start']); + $newline->date_end=dol_stringtotime($line['date_end']); $newline->fk_product=$line['product_id']; $newobject->lines[]=$newline; } @@ -587,7 +589,5 @@ function createInvoice($authentication,$invoice) return $objectresp; } - // Return the results. -$server->service((isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:'')); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index c799f0c8169..8916ff011ed 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -798,7 +798,5 @@ function validOrder($authentication,$id='') return $objectresp; } - // Return the results. -$server->service((isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:'')); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 0e3caa512c6..ba948d463ea 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -321,5 +321,4 @@ function getDocument($authentication, $modulepart, $file, $refname='') } // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 3e50060660c..ffe25f8e3e8 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -1019,8 +1019,5 @@ function getProductsForCategory($authentication,$id,$lang='') return $objectresp; } - - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index c6697980a12..fea871ac077 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -457,7 +457,5 @@ function getSupplierInvoicesForThirdParty($authentication,$idthirdparty) return $objectresp; } - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 645e120a101..301511e0115 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -728,4 +728,4 @@ function getListOfThirdParties($authentication,$filterthirdparty) } // Return the results. -$server->service($HTTP_RAW_POST_DATA); +$server->service(file_get_contents("php://input")); diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 96fcde097b2..4fb5cc81e8c 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -753,7 +753,5 @@ function setUserPassword($authentication,$shortuser) { return $objectresp; } - // Return the results. -$server->service($HTTP_RAW_POST_DATA); - +$server->service(file_get_contents("php://input")); diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index d8dda85f2fc..a8a554ca25d 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -123,14 +123,21 @@ class AllTests require_once dirname(__FILE__).'/DiscountTest.php'; $suite->addTestSuite('DiscountTest'); + require_once dirname(__FILE__).'/ContratTest.php'; + $suite->addTestSuite('ContratTest'); + + require_once dirname(__FILE__).'/FichinterTest.php'; + $suite->addTestSuite('FichinterTest'); + + require_once dirname(__FILE__).'/PropalTest.php'; + $suite->addTestSuite('PropalTest'); + require_once dirname(__FILE__).'/CommandeTest.php'; $suite->addTestSuite('CommandeTest'); require_once dirname(__FILE__).'/CommandeFournisseurTest.php'; $suite->addTestSuite('CommandeFournisseurTest'); - require_once dirname(__FILE__).'/ContratTest.php'; - $suite->addTestSuite('ContratTest'); require_once dirname(__FILE__).'/FactureTest.php'; $suite->addTestSuite('FactureTest'); require_once dirname(__FILE__).'/FactureRecTest.php'; @@ -139,8 +146,7 @@ class AllTests $suite->addTestSuite('FactureTestRounding'); require_once dirname(__FILE__).'/FactureFournisseurTest.php'; $suite->addTestSuite('FactureFournisseurTest'); - require_once dirname(__FILE__).'/PropalTest.php'; - $suite->addTestSuite('PropalTest'); + require_once dirname(__FILE__).'/UserTest.php'; $suite->addTestSuite('UserTest'); require_once dirname(__FILE__).'/UserGroupTest.php'; diff --git a/test/phpunit/FichInterTest.php b/test/phpunit/FichInterTest.php new file mode 100644 index 00000000000..96366af85a9 --- /dev/null +++ b/test/phpunit/FichInterTest.php @@ -0,0 +1,244 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file test/phpunit/FichinterTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/fichinter/class/fichinter.class.php'; + +if (empty($user->id)) +{ + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class FichinterTest extends PHPUnit_Framework_TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return ContratTest + */ + function __construct() + { + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testFichinterCreate + * + * @return int + */ + public function testFichinterCreate() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $localobject->initAsSpecimen(); + $result=$localobject->create($user); + + print __METHOD__." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $result; + } + + /** + * testFichinterFetch + * + * @param int $id Id of intervention + * @return int + * + * @depends testFichinterCreate + * The depends says test is run only if previous is ok + */ + public function testFichinterFetch($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $result=$localobject->fetch($id); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + + return $localobject; + } + + /** + * testFichinterValid + * + * @param Fichinter $localobject Intervention + * @return int + * + * @depends testFichinterFetch + * The depends says test is run only if previous is ok + */ + public function testFichinterValid($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=$localobject->setValid($user); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + + $this->assertLessThan($result, 0); + return $localobject; + } + + /** + * testFichinterValid + * + * @param Object $localobject Object intervention + * @return int + * + * @depends testFichinterValid + * The depends says test is run only if previous is ok + */ + public function testFichinterOther($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + $localobject->info($localobject->id); + print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n"; + $this->assertNotEquals($localobject->date_creation, ''); + + return $localobject->id; + } + + /** + * testFichinterDelete + * + * @param int $id Id of intervention + * @return int + * + * @depends testFichinterOther + * The depends says test is run only if previous is ok + */ + public function testFichinterDelete($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Fichinter($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; + } + +}
'.$langs->trans("Label").''.$object->title.'
'.$langs->trans("ThirdParty").''; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print '
'; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print '