diff --git a/ChangeLog b/ChangeLog index 71b895b3645e383fa8a5f9aeb4a5954137c9b510..24e222025558d357c5d74c73bb1a05959651b5ab 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,19 +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 @@ -73,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 @@ -138,6 +140,7 @@ 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. ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 8ba0a69acb3ac479b64b07d86a98bc2abc99a9ce..3cba3ce99cd4650739ffca3ff9c01b9957de9831 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/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index de3bbf5c1db0c84b5c3890a03fe837a287c26392..b0e5096699b7a117b890249dd2d4472d50e01e29 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 '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>'; + print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" />'; print '</form>'; - print '<a href="./card.php?action=create" class="butAction">' . $langs->trans("NewAccountingMvt") . '</a>'; + print '<a href="./card.php?action=create" class="butAction">' . $langs->trans("NewAccountingMvt") . '</a></div>'; print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index f2d5a586b372e49b2a8b6bbd22a00168439aa640..82c3a09e20a7b48e927925b933cf7c33c70a8805 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") . '<br>'; $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 '<input type="button" class="button" style="float: right;" value="Export CSV" onclick="launch_export();" />'; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index bd95e5a67e4829014d8c9a1bf6494949eee12d6c..9c5ffd03234e5e16848486956dd7141fb3b4703a 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 '</tr>' . "\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 "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">'; - $form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist); + $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); print '</td></tr>'; + } + if ($socid > 0) + { // Ligne info remises tiers print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">'; if ($soc->remise_percent) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index d73a4c068e11ac70c2907ecacca80145fdff3675..f05f516e18869663c5e5a061cb2addc0b9075b97 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 ++; @@ -1481,7 +1481,7 @@ if ($action == 'create' && $user->rights->commande->creer) { */ if ($socid > 0) { print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">'; - $form->select_contacts($soc->id, $setcontact, 'contactidp', 1, $srccontactslist); + $form->select_contacts($soc->id, $setcontact, 'contactid', 1, $srccontactslist); print '</td></tr>'; // Ligne info remises tiers diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index 196ae560cbedf0849ae4c3ae1618138ddc14e80e..c87b4ea033fe6171205014988c754619ad3ee9f5 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -77,7 +77,7 @@ class DeplacementStats extends Stats */ function getNbByYear() { - $sql = "SELECT YEAR(datef) as dm, count(*)"; + $sql = "SELECT YEAR(dated) as dm, count(*)"; $sql.= " FROM ".$this->from; $sql.= " GROUP BY dm DESC"; $sql.= " WHERE ".$this->where; diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index 7751a1138c8604adc93a0bc4eb2fc7138b4e07a8..993eda5a0f7685bc369b12528cc1d6cd35012ff9 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> - * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> + * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * * 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 @@ -209,38 +209,42 @@ class Don extends CommonObject */ function check($minimum=0) { + global $langs; + $langs->load('main'); + $langs->load('companies'); + $err = 0; if (dol_strlen(trim($this->societe)) == 0) { if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) { - $error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe."; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Company').'/'.$langs->trans('Firstname').'-'.$langs->trans('Lastname')); $err++; } } if (dol_strlen(trim($this->address)) == 0) { - $error_string[$err] = "L'adresse saisie est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Address')); $err++; } if (dol_strlen(trim($this->zip)) == 0) { - $error_string[$err] = "Le code postal saisi est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Zip')); $err++; } if (dol_strlen(trim($this->town)) == 0) { - $error_string[$err] = "La ville saisie est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Town')); $err++; } if (dol_strlen(trim($this->email)) == 0) { - $error_string[$err] = "L'email saisi est invalide"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('EMail')); $err++; } @@ -252,7 +256,7 @@ class Don extends CommonObject { if (!isset($map[substr($this->amount, $i, 1)] )) { - $error_string[$err] = "Le montant du don contient un/des caractere(s) invalide(s)"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $err++; $amount_invalid = 1; break; @@ -263,14 +267,14 @@ class Don extends CommonObject { if ($this->amount == 0) { - $error_string[$err] = "Le montant du don est null"; + $error_string[$err] = $langs->trans('ErrorFieldRequired',$langs->trans('Amount')); $err++; } else { if ($this->amount < $minimum && $minimum > 0) { - $error_string[$err] = "Le montant minimum du don est de $minimum"; + $error_string[$err] = $langs->trans('MinimumAmount',$langs->trans('$minimum')); $err++; } } diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 88fa6ebad27f78d202bc13c4a8eb79bb9846d0b0..4db7935e69cd1b208aa7bed0b12a4ea172addfe1 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -372,6 +372,17 @@ $search_montant_ht = GETPOST("search_montant_ht"); $search_montant_ttc = GETPOST("search_montant_ttc"); $late = GETPOST("late"); +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x")) +{ + $search_ref=''; + $search_refcustomer=''; + $search_societe=''; + $search_paymentmode=''; + $search_montant_ht=''; + $search_montant_ttc=''; +} + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); @@ -571,6 +582,7 @@ if ($resql) print '<td class="liste_titre"> </td>'; print '<td class="liste_titre" align="right">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; + print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '</td>'; if (empty($mode)) { diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3532125ed8e5147d8afc29449b1a063431a08d91..f5dbd8186cd87e1ef49fcf1c3fc5a4f4b495b828 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -327,6 +327,7 @@ if ($resql) print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>'; print '<td class="liste_titre" align="right"> </td>'; print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; + print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print "</td></tr>\n"; if ($num > 0) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 1cfc507e4dfc7c93404274951b449581d775ed79..ec3fdb23027ae67f69f6954c478d985c3b91486d 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -109,8 +109,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/compta/paiement/cheque/liste.php b/htdocs/compta/paiement/cheque/liste.php index 474b4531295add605bb120a42bc8982f46995b34..cafe8493b7195867ce2304f90476014eb7fb37b8 100644 --- a/htdocs/compta/paiement/cheque/liste.php +++ b/htdocs/compta/paiement/cheque/liste.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * * 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 @@ -20,12 +21,14 @@ /** * \file htdocs/compta/paiement/cheque/liste.php * \ingroup compta - * \brief Page liste des bordereau de remise de cheque + * \brief Page list of cheque deposits */ require('../../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("banks"); $langs->load("categories"); @@ -44,12 +47,16 @@ $pageprev = $page - 1; $pagenext = $page + 1; $limit = $conf->liste_limit; if (! $sortorder) $sortorder="DESC"; -if (! $sortfield) $sortfield="bc.number"; +if (! $sortfield) $sortfield="dp"; +$year=GETPOST("year"); +$month=GETPOST("month"); + +$form=new Form($db); +$formother = new FormOther($db); $checkdepositstatic=new RemiseCheque($db); $accountstatic=new Account($db); - /* * View */ @@ -63,10 +70,25 @@ $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " WHERE bc.fk_bank_account = ba.rowid"; $sql.= " AND bc.entity = ".$conf->entity; -if (GETPOST('search_montant')) + +// Search criteria +if (GETPOST("search_ref")) $sql.=" AND bc.number=".GETPOST("search_ref",'int'); +if (GETPOST("search_account") > 0) $sql.=" AND bc.fk_bank_account=".GETPOST("search_account",'int'); +if (GETPOST("search_amount")) $sql.=" AND bc.amount=".price2num(GETPOST("search_amount")); +if ($month > 0) +{ + if ($year > 0 && empty($day)) + $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; + else if ($year > 0 && ! empty($day)) + $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; + else + $sql.= " AND date_format(bc.date_bordereau, '%m') = '".$month."'"; +} +else if ($year > 0) { - $sql.=" AND bc.amount=".price2num(GETPOST('search_montant')); + $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } + $sql.= " ORDER BY $sortfield $sortorder"; $sql.= $db->plimit($limit+1, $offset); //print "$sql"; @@ -79,27 +101,35 @@ if ($resql) $i = 0; $params=''; - print_barre_liste($langs->trans("MenuChequeDeposits"), $page, 'liste.php', $params, $sortfield, $sortorder, '', $num); + print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num); - print '<form method="get" action="liste.php">'; + print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; print '<table class="liste" width="100%">'; print '<tr class="liste_titre">'; - print_liste_field_titre($langs->trans("Ref"),"liste.php","bc.number","",$params,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$params,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$params,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NbOfCheques"),"liste.php","bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),"liste.php","bc.amount","",$params,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),"liste.php","bc.statut","",$params,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$params,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$params,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$params,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$params,'align="right"',$sortfield,$sortorder); print "</tr>\n"; // Lignes des champs de filtre print '<tr class="liste_titre">'; - print '<td class="liste_titre"> </td>'; - print '<td class="liste_titre"> </td>'; - print '<td class="liste_titre"> </td>'; + print '<td class="liste_titre" align="left">'; + print '<input class="fat" type="text" size="4" name="search_ref" value="'.GETPOST('search_ref').'">'; + print '</td>'; + print '<td class="liste_titre" align="center">'; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">'; + print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">'; + $formother->select_year($year?$year:-1,'year',1, 20, 5); + print '</td>'; + print '<td>'; + $form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1); + print '</td>'; print '<td class="liste_titre"> </td>'; print '<td class="liste_titre" align="right">'; - print '<input class="fat" type="text" size="6" name="search_montant" value="'.GETPOST('search_montant').'">'; + print '<input class="fat" type="text" size="6" name="search_amount" value="'.GETPOST('search_amount').'">'; print '</td>'; print '<td class="liste_titre" align="right">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; @@ -124,16 +154,16 @@ if ($resql) // Date print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day').'</td>'; - // Banque + // Bank print '<td>'; if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/account.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>'; else print ' '; print '</td>'; - // Nb of cheques + // Number of cheques print '<td align="right">'.$objp->nbcheque.'</td>'; - // Montant + // Amount print '<td align="right">'.price($objp->amount).'</td>'; // Statut diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 97e2db221c38c72253d46b7583febc420de02be1..d55930ef80ff443af94e6893affe60232ab57a8b 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * * 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 @@ -33,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("bills"); +$langs->load("donation"); +$langs->load("salaries"); $date_startmonth=GETPOST('date_startmonth'); $date_startday=GETPOST('date_startday'); @@ -555,7 +558,7 @@ if (! empty($date_start) && ! empty($date_end)) $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; $sql.= " ORDER BY u.firstname"; -dol_syslog("get payment salaries sql=".$sql); +dol_syslog("get payment salaries"); $result=$db->query($sql); $subtotal_ht = 0; $subtotal_ttc = 0; @@ -598,6 +601,64 @@ else { dol_print_error($db); } + +/* + * Dunning +*/ + +print '<tr><td colspan="4">'.$langs->trans("Donation").'</td></tr>'; +$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " AND fk_statut=2"; +if (! empty($date_start) && ! empty($date_end)) + $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; +$sql.= " GROUP BY p.societe, p.firstname, p.lastname"; +$sql.= " ORDER BY p.societe, p.firstname, p.lastname"; + +dol_syslog("get dunning"); +$result=$db->query($sql); +$subtotal_ht = 0; +$subtotal_ttc = 0; +if ($result) +{ + $num = $db->num_rows($result); + $var=true; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $total_ht += $obj->amount; + $total_ttc += $obj->amount; + $subtotal_ht -= $obj->amount; + $subtotal_ttc -= $obj->amount; + + $var = !$var; + print "<tr ".$bc[$var]."><td> </td>"; + + print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/compta/dons/liste.php?search_company=".$obj->nom."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->nom. " ".$obj->firstname." ".$obj->lastname."</a></td>\n"; + + if ($modecompta == 'CREANCES-DETTES') print '<td align="right">'.price($obj->amount).'</td>'; + print '<td align="right">'.price($obj->amount).'</td>'; + print '</tr>'; + $i++; + } + } + else + { + $var = !$var; + print "<tr ".$bc[$var]."><td> </td>"; + print '<td colspan="3">'.$langs->trans("None").'</td>'; + print '</tr>'; + } +} +else +{ + dol_print_error($db); +} print '<tr class="liste_total">'; if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" align="right">'.price(-$subtotal_ht).'</td>'; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 74224c024b027af0661dc5e439b03d3df178aebf..05c3a93e0117e8066abeed9eab69ba07cee26d21 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * * 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 @@ -480,7 +481,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " WHERE p.entity = ".$conf->entity; $sql.= " GROUP BY p.label, dm"; -dol_syslog("get social salaries payments sql=".$sql); +dol_syslog("get social salaries payments"); $result=$db->query($sql); if ($result) { @@ -508,6 +509,45 @@ else dol_print_error($db); } +/* + * get dunning paiement +*/ +$subtotal_ht = 0; +$subtotal_ttc = 0; +$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; +$sql.= " FROM ".MAIN_DB_PREFIX."don as p"; +$sql.= " WHERE p.entity = ".$conf->entity; +$sql.= " AND fk_statut=2"; +$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; + +dol_syslog("get social salaries payments"); +$result=$db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $var=false; + $i = 0; + if ($num) + { + while ($i < $num) + { + $obj = $db->fetch_object($result); + + if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; + $encaiss[$obj->dm] += $obj->amount; + + if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; + $encaiss_ttc[$obj->dm] += $obj->amount; + + $i++; + } + } +} +else +{ + dol_print_error($db); +} + /* * Show result array */ diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 882e0780ed4d3cc0459ab72bddd6e596e11e9be9..256e9b074e456823e1ac23212f34493aa0f02a15 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -27,8 +27,7 @@ /** - * \class CommonDocGenerator - * \brief Parent class for documents generators + * Parent class for documents generators */ abstract class CommonDocGenerator { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7dfe2b3e7d3792dcd5bfb1d66e91a3b78c1a1e74..5cf872eb3d80abc4ea8711c2dca19954e3d9a5cc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3344,7 +3344,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 13edeb168fa26300461b6c4796444a94f76db184..6f70ba716737f555d439ffff198abde5e40ac5ee 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -685,7 +685,7 @@ class FormMail * @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 - * @para Translate $outputlangs Output lang object + * @param Translate $outputlangs Output lang object * @return array array('topic'=>,'content'=>,..) */ private function getEMailTemplate($db, $type_template, $user, $outputlangs) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2e2bf34a75df933c26a4928d326e9593eb73fe12..20b030a9226bb55f32f8fe299fa596550ec08fba 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 '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup @@ -2252,6 +2253,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 = '<input type="image" class="liste_titre" name="button_search" src="'.$img.'" '; + $input.= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >'; + + 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 = '<input type="image" class="liste_titre" name="button_removefilter" src="'.$img.'" '; + $input.= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >'; + + return $input; +} /** * Show information for admin users diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2b145ffc83039b3a1f3e0b4c14509a51a290af12..19611dd9404e6e8eb00dcebee3dfec1fb4e15973 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -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)$'); + $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 e44b0dd413cf0a1e274b1594e1fdc152af541b7d..7a8f2302c12d5fd3b72136ffb0801ff8a2fd49fb 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 "</table>"; + + if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) { + //Add the year filter input + print '<table width="100%">'; + print '<tr>'; + print '<td>'.$langs->trans("Year").'</td>'; + print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'; + print '<td style="text-align:right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.$project_year_filter.'"/>'; + print '</form>'; + print "</tr>\n"; + print '</table>'; + } } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index aff002e95853a799638e55b7d31e5e8253da9757..1d7aa1a5a9a4dc7915d1222eed053466008d870a 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') diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php index 100198478e0be1bdcf7d5edfc1945db315b58688..657cf00b514c11eb1963d8857cf0e2bc93716e7d 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, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num); @@ -103,14 +116,44 @@ if ($resql) print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"e.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", "", $param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDeliveryPlanned"),$_SERVER["PHP_SELF"],"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"),$_SERVER["PHP_SELF"],"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"),"ship2bill.php","e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print "</tr>\n"; + + // Lignes des champs de filtre + print '<tr class="liste_titre">'; + print '<td class="liste_titre">'; + print '<input class="flat" size="10" type="text" name="search_ref_exp" value="'.$search_ref_exp.'">'; + print '</td>'; + print '<td class="liste_titre" align="left">'; + print '<input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">'; + print '</td>'; + print '<td class="liste_titre"> </td>'; + if($conf->livraison_bon->enabled) { + print '<td class="liste_titre">'; + print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"'; + print '</td>'; + print '<td class="liste_titre"> </td>'; } - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"e.fk_statut","",$param,'align="right"',$sortfield,$sortorder); + print '<td class="liste_titre" align="right">'; + // Développé dans la 3.7 + //print img_search(); + //print img_searchclear(); + print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; + print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; + print '</td>'; + print '<td class="liste_titre" align="center">'; + print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>'; + print '</td>'; + print "</tr>\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 c60d2c9eac418478c4c1e320f1f142db0a4a1735..6aaf29c7ac225b0a716848d999d920a52d261810 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * @@ -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 889e584d99ad028d55968468faf488c64127f536..edd5372471e38df3042dd740b8fc8faaefddd224 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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a></div>'; + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("InterventionClassifyBilled").'</a></div>'; } else { - print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifyunbilled">'.$langs->trans("ClassifyUnBilled").'</a></div>'; + print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifyunbilled">'.$langs->trans("InterventionClassifyUnBilled").'</a></div>'; } } } diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f7eb1e49986ec0ada43e314a065ab4580e5d6460..4dfb8489c9c4c62042008ccd1e0de87615181c20 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); @@ -139,8 +138,8 @@ if ($result) print '<td class="liste_titre"> </td>'; } print '<td class="liste_titre" align="right">'; - $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 '<input class="liste_titre" align="right" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '</td>'; print "</tr>\n"; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 2859620445e5106378a61709fa14236d159ebd11..c9969543d20dfcc7c1e67f5167354f188e63209a 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 e6b8e526bf2445671427f3c457c1c1c19e7b329f..635154768bb55ffa04cc0178c959cce8a03931a1 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 @@ -20,6 +20,9 @@ +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) ALTER TABLE llx_c_typent ADD COLUMN fk_country integer NULL AFTER libelle; diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 87769ab9558aa54bbcddcb16964731e587dfa640..868acf7fff016c3df1ad27b5e01201994b42cc1a 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_fichinter.sql b/htdocs/install/mysql/tables/llx_fichinter.sql index b2397b2d2c325adc2f8067a2242d56fb0667a790..242710a09938ecc62823558c3743002c2fcb23c3 100644 --- a/htdocs/install/mysql/tables/llx_fichinter.sql +++ b/htdocs/install/mysql/tables/llx_fichinter.sql @@ -24,6 +24,7 @@ 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 diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 6745b56daf1a4d368d82e3dc6cac9fb7a453fa4e..0c1ad62eab210d104b14031c13954bcd2970f581 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -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 728661dfa0443f33597e8258c0adb2a25d30eedc..66ddea95a5c694d8044c40b7da05319d0b77a530 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 89404614db5265a40b513b82587e071b9d60abb8..ed8354b9e8dd35dcc2b9af6d7799d400f863ae50 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 <b>%s</b> 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 266ce059d8b8198d055e76ae5d7b02adf13ab111..17641a0ab3e499b2f66a4b4ddd80c46d478ff702 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 afcb8456a5decaf5b9bf8681e722cb3f9c4366cf..624e2c02291b1a3af66713e85656c6f204e6bc70 100644 --- a/htdocs/langs/es_ES/accountancy.lang +++ b/htdocs/langs/es_ES/accountancy.lang @@ -120,6 +120,7 @@ CustomerInvoicePayment=Pago Factura a cliente ThirdPartyAccount=Cuenta tercero +NewAccountingMvt=Nueva movimiento NumMvts=Número de movimiento ListeMvts=Apuntes del movimiento ErrorDebitCredit=Débito y Crédito no pueden terner valor al mismo tiempo diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index 818b93c87c0dba181e79e36e10488d09aa674751..926a356db32681fc7379401d9db481254a5b855e 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 <b>%s</b> 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/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 72c7475fd1d1c220ed10261c9198751a4a715175..8f66eb5319f78d09ce64cc004fbaf052122c08f7 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/donations.lang b/htdocs/langs/fr_FR/donations.lang index 9af7a87a12d6d0eebb7940e201a650428a4346ce..2da59454571f352f44adc630850a3877761a83e0 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 3cd8609a04756b4fba1f40d1fcedd6eecd818110..954a83375b9931f2af0bd6557a13c3e888676b6c 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 <b>%s</b> 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/product/class/product.class.php b/htdocs/product/class/product.class.php index 06505a8fbc6d95b848272e57ead3647f5699f9f2..8bd8632e2e182000f01fde9ed19bb33e71ca1737 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/projet/contact.php b/htdocs/projet/contact.php index f4815c936f98f159866544a802d40b57545a0fea..f359f789c3feef5ae60a440cfa830864330b366d 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 '<table class="border" width="100%">'; + + $linkback = '<a href="'.DOL_URL_ROOT.'/projet/liste.php">'.$langs->trans("BackToList").'</a>'; + + // Ref + print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'; + // 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 '<table class="border" width="100%">'; - - $linkback = '<a href="'.DOL_URL_ROOT.'/projet/liste.php">'.$langs->trans("BackToList").'</a>'; - - // Ref - print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'; - // 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 '</td></tr>'; - - // Label - print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; - - // Customer - print "<tr><td>".$langs->trans("ThirdParty")."</td>"; - print '<td colspan="3">'; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); - else print ' '; - print '</td></tr>'; - - // Visibility - print '<tr><td>'.$langs->trans("Visibility").'</td><td>'; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '</td></tr>'; - - // Statut - print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; - - // Date start - print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; - print dol_print_date($object->date_start,'day'); - print '</td></tr>'; - - // Date end - print '<tr><td>'.$langs->trans("DateEnd").'</td><td>'; - print dol_print_date($object->date_end,'day'); - print '</td></tr>'; - - print "</table>"; - - print '</div>'; - - // 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 '</td></tr>'; + + // Label + print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; + + // Customer + print "<tr><td>".$langs->trans("ThirdParty")."</td>"; + print '<td colspan="3">'; + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); + else print ' '; + print '</td></tr>'; + + // Visibility + print '<tr><td>'.$langs->trans("Visibility").'</td><td>'; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '</td></tr>'; + + // Statut + print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; + + // Date start + print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; + print dol_print_date($object->date_start,'day'); + print '</td></tr>'; + + // Date end + print '<tr><td>'.$langs->trans("DateEnd").'</td><td>'; + print dol_print_date($object->date_end,'day'); + print '</td></tr>'; + + print "</table>"; + + print '</div>'; + + // 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 d40682d7ce684355c18723cf4768d83d0162a57a..611fc314481b0c35a5f9108770dc474aa31524c5 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 '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print '</td></tr>'; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index abdf6f81b5b047e8fc28ea44aff0c89053a8138c..b5a1d089c9629804d19a74b17501d4c46ebb30c5 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 b87a89181c5938f6e448b319b04fa7d99bbf6fa0..1fe3d91346d4563c0effc96b67ede61b5a2842f4 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 '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - $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 '</td></tr>'; @@ -633,7 +633,7 @@ else // Third party print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); else print' '; print '</td></tr>'; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 79d302addd38ee221eaf0f86d9e8d75964a7d280..0c06c30ba5702aa8095618ca58a5a8a17aa8ce12 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 '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print '</td>'; print '</tr>'; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 9622f4fa480a401a1747a7c2154ca08b0a94e015..4e81c2efca32d7ce4b7b264ed3c70c4b5ccb7b5a 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 '<tr '.$bc[0].'>'; +/* $langs->load("errors"); + print '<tr '.$bc[0].'>'; print '<td colspan="9">'; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print '</td></tr>';*/ } else diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 493141cbe955f55af977f625cf754cb1835a9082..a086f632a3643eb43cbe6702923dc8f771fb1525 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)) - { - 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; + // 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')); + $head = project_prepare_head($object); + dol_fiche_head($head, 'notes', $langs->trans('Project'), 0, ($object->public?'projectpub':'project')); - print '<table class="border" width="100%">'; + print '<table class="border" width="100%">'; - $linkback = '<a href="'.DOL_URL_ROOT.'/projet/liste.php">'.$langs->trans("BackToList").'</a>'; + $linkback = '<a href="'.DOL_URL_ROOT.'/projet/liste.php">'.$langs->trans("BackToList").'</a>'; - // Ref - print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'; - // 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 '</td></tr>'; + // Ref + print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>'; + // 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 '</td></tr>'; - // Label - print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; + // Label + print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; - // Third party - print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - if ($object->societe->id > 0) print $object->societe->getNomUrl(1); - else print' '; - print '</td></tr>'; + // Third party + print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; + if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1); + else print' '; + print '</td></tr>'; - // Visibility - print '<tr><td>'.$langs->trans("Visibility").'</td><td>'; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '</td></tr>'; + // Visibility + print '<tr><td>'.$langs->trans("Visibility").'</td><td>'; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '</td></tr>'; - // Statut - print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; + // Statut + print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>'; - // Date start - print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; - print dol_print_date($object->date_start,'day'); - print '</td></tr>'; + // Date start + print '<tr><td>'.$langs->trans("DateStart").'</td><td>'; + print dol_print_date($object->date_start,'day'); + print '</td></tr>'; - // Date end - print '<tr><td>'.$langs->trans("DateEnd").'</td><td>'; - print dol_print_date($object->date_end,'day'); - print '</td></tr>'; + // Date end + print '<tr><td>'.$langs->trans("DateEnd").'</td><td>'; + print dol_print_date($object->date_end,'day'); + print '</td></tr>'; - print "</table>"; + print "</table>"; - print '<br>'; + print '<br>'; - $colwidth=30; - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + $colwidth=30; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - dol_fiche_end();; - } + dol_fiche_end();; } llxFooter(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index f72b8c6963d4a0bea1f0c6cdaa842a3eab08c61b..994779fcac96629647a4c11391f9f952cbb99f34 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 '<table class="border" width="100%">'; @@ -221,7 +221,7 @@ if ($id > 0 || ! empty($ref)) print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; - if (! empty($object->societe->id)) print $object->societe->getNomUrl(1); + if (! empty($object->thirdparty->id)) print $object->thirdparty->getNomUrl(1); else print ' '; print '</td>'; print '</tr>'; @@ -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 '<br>'; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 1b915ceca19cdbbc7efd7c753ea5c66a030820fa..cdf90a918a31cb3266fe18eef3a787ab6e29e235 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -128,9 +128,10 @@ print "</tr>\n"; if (count($tasksarray) > (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)) { + $langs->load("errors"); print '<tr '.$bc[0].'>'; print '<td colspan="9">'; - print $langs->trans("TooManyDataPleaseUseMoreFilters"); + print $langs->trans("WarningTooManyDataPleaseUseMoreFilters"); print '</td></tr>'; } else