diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 3f251e0090b..70f191f3679 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -161,11 +161,11 @@ if ($result) { print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ' '; print ''; print ''; @@ -190,7 +190,7 @@ if ($result) { print '' . $accountstatic->getNomUrl(1) . ''; print '' . $obj->label . ''; - if ($obj->account_parent) + if (! empty($obj->account_parent)) { $accountparent->id = $obj->rowid2; $accountparent->label = $obj->label2; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index eeb94bddf60..04d538b1b31 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -59,12 +59,17 @@ if ($action == 'add') { // Clean code $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right + if (GETPOST('account_category') <= 0) { + $account_parent = ''; + } else { + $account_parent = GETPOST('account_category','int'); + } $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type'); $object->pcg_subtype = GETPOST('pcg_subtype'); $object->account_number = $account_number; - $object->account_parent = GETPOST('account_parent', 'int'); + $object->account_parent = $account_parent; $object->account_category = GETPOST('account_category'); $object->label = GETPOST('label', 'alpha'); $object->active = 1; @@ -96,12 +101,17 @@ if ($action == 'add') { // Clean code $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right - + if (GETPOST('account_category') <= 0) { + $account_parent = ''; + } else { + $account_parent = GETPOST('account_category','int'); + } + $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type'); $object->pcg_subtype = GETPOST('pcg_subtype'); $object->account_number = $account_number; - $object->account_parent = GETPOST('account_parent', 'int'); + $object->account_parent = $account_parent; $object->account_category = GETPOST('account_category'); $object->label = GETPOST('label', 'alpha'); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 3e4b69d6624..5038c93fc82 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro +/* Copyright (C) 2016 Olivier Geffroy + * Copyright (C) 2016 Florian Henry + * Copyright (C) 2016 Alexandre Spangaro * * 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 @@ -19,9 +19,9 @@ */ /** - * \file htdocs/accountancy/bookkeeping/balance.php - * \ingroup Accounting Expert - * \brief Balance of book keeping + * \file htdocs/accountancy/bookkeeping/balance.php + * \ingroup Advanced accountancy + * \brief Balance of book keeping */ require '../../main.inc.php'; @@ -137,7 +137,6 @@ else { /* * List */ - $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); @@ -150,13 +149,12 @@ else { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords); - + + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result); + print '
'; print '
' . "\n"; print '
'; - print '
'; print '
'; @@ -169,6 +167,7 @@ else { print ''; print ''; print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); @@ -176,11 +175,11 @@ else { print "\n"; print ''; - print ''; @@ -203,23 +202,28 @@ else { foreach ( $object->lines as $line ) { $var = ! $var; - + $link = ''; $total_debit += $line->debit; $total_credit += $line->credit; - + $description = $object->get_compte_desc($line->numero_compte); // Search description of the account + if(empty($description)){ + $link = '' . img_edit_add() .''; + } print ""; print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; } print ''; print ''; + print ''; print ''; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 4a0ebbe8988..14bc6c32487 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2015-2016 Florian Henry + * Copyright (C) 2015-2016 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify @@ -1207,6 +1207,48 @@ class BookKeeping extends CommonObject return - 1; } } + + /** + * Description of accounting account + * + * @param string $account Accounting account + * @return string + */ + function get_compte_desc($account = null) + { + global $conf; + $pcgver = $conf->global->CHARTOFACCOUNTS; + + $sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category"; + $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa "; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND aa.account_number = '" . $account . "'"; + $sql .= " AND asy.rowid = " . $pcgver; + $sql .= " AND aa.active = 1"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; + + dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $obj = ''; + if ($this->db->num_rows($resql)) { + $obj = $this->db->fetch_object($resql); + } + + if(empty($obj->category)){ + return $obj->label; + }else{ + return $obj->label.' ('.$obj->category.')'; + + } + } else { + $this->error = "Error " . $this->db->lasterror(); + dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); + + return -1; + } + } + } /** diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 82811598188..62309dc222e 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013-2015 Alexandre Spangaro - * Copyright (C) 2013-2014 Olivier Geffroy + * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -123,7 +123,7 @@ if ($result) { $i = 0; while ( $i < $num ) { $obj = $db->fetch_object($result); - // contrôles + // contrôles $compta_soc = (! empty($obj->code_compta_fournisseur)) ? $obj->code_compta_fournisseur : $cptfour; $compta_prod = $obj->compte; if (empty($compta_prod)) { @@ -164,6 +164,19 @@ if ($action == 'writebookkeeping') { $error = 0; foreach ( $tabfac as $key => $val ) { + + $invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; + $invoicestatic->ref = $val["refsologest"]; + $invoicestatic->refsupplier = $val["refsuppliersologest"]; + $invoicestatic->type = $val["type"]; + $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); + + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + $companystatic->client = $tabcompany[$key]['code_client']; + + foreach ( $tabttc[$key] as $k => $mt ) { // get compte id and label @@ -175,7 +188,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_fournisseur']; - $bookkeeping->label_compte = $tabcompany[$key]['name']; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; @@ -193,6 +206,8 @@ if ($action == 'writebookkeeping') { // Product / Service foreach ( $tabht[$key] as $k => $mt ) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(null, $k); if ($mt) { // get compte id and label $accountingaccount = new AccountingAccount($db); @@ -205,7 +220,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = ''; - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->refsupplier . ' - ' . utf8_decode($accountingaccount->label); $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -236,7 +251,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturefourndet"]; $bookkeeping->code_tiers = ''; - $bookkeeping->label_compte = $langs->trans("VAT"); + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->refsupplier .' - '. $langs->trans("VAT"); $bookkeeping->numero_compte = $k; $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; @@ -248,7 +263,7 @@ if ($action == 'writebookkeeping') { $result = $bookkeeping->create($user); if ($result < 0) { $error ++; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -517,5 +532,4 @@ if ($action == 'export_csv') { // End of page llxFooter(); } - $db->close(); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 670875ec52b..a88d60b8376 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -7,7 +7,7 @@ * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy - * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2014 Raphaël Doursenaud * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,9 +24,9 @@ */ /** - * \file htdocs/accountancy/journal/sellsjournal.php - * \ingroup Advanced accountancy - * \brief Page with sells journal + * \file htdocs/accountancy/journal/sellsjournal.php + * \ingroup Advanced accountancy + * \brief Page with sells journal */ require '../../main.inc.php'; @@ -142,15 +142,14 @@ if ($result) { // Situation invoices handling $line = new FactureLigne($db); - $line->fetch($obj->fdid); // id of line - $prev_progress = 0; + $line->fetch($obj->rowid); + $prev_progress = $line->get_prev_progress(); if ($obj->type == Facture::TYPE_SITUATION) { - // Avoid divide by 0 + // Avoid divide by 0 if ($obj->situation_percent == 0) { $situation_ratio = 0; } else { - $prev_progress = $line->get_prev_progress($obj->rowid); // id of invoice - $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent; + $situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent; } } else { $situation_ratio = 1; @@ -194,6 +193,14 @@ if ($action == 'writebookkeeping') { $error = 0; foreach ( $tabfac as $key => $val ) { + $companystatic->id = $tabcompany[$key]['id']; + $companystatic->name = $tabcompany[$key]['name']; + $companystatic->client = $tabcompany[$key]['code_client']; + +$invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; + + foreach ( $tabttc[$key] as $k => $mt ) { $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -204,7 +211,8 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - $bookkeeping->label_compte = $tabcompany[$key]['name']; + //$bookkeeping->label_compte = $tabcompany[$key]['name']; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0) ? $mt : 0; @@ -234,7 +242,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $accountingaccount->label; + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode($accountingaccount->label); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -264,7 +272,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->fk_docdet = $val["fk_facturedet"]; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $langs->trans("VAT"); + $bookkeeping->label_compte = utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT"); $bookkeeping->montant = $mt; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt < 0) ? $mt : 0; @@ -275,7 +283,7 @@ if ($action == 'writebookkeeping') { $result = $bookkeeping->create($user); if ($result < 0) { $error ++; - setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -305,6 +313,9 @@ if ($action == 'export_csv') { $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; +$invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; + $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); foreach ( $tabttc[$key] as $k => $mt ) { @@ -314,7 +325,8 @@ if ($action == 'export_csv') { print length_accounta(html_entity_decode($k)) . $sep; print ($mt < 0 ? 'C' : 'D') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print utf8_decode($companystatic->name) . $sep; + print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . $sep; + //print utf8_decode($companystatic->name) . $sep; print $val["ref"]; print "\n"; } @@ -329,7 +341,8 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print dol_trunc($accountingaccount_static->label, 32) . $sep; + print utf8_decode(dol_trunc($companystatic->name,16)). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount_static->label)) . $sep; + //print dol_trunc($accountingaccount_static->label, 32) . $sep; print $val["ref"]; print "\n"; } @@ -344,7 +357,8 @@ if ($action == 'export_csv') { print $sep; print ($mt < 0 ? 'D' : 'C') . $sep; print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print $langs->trans("VAT") . $sep; + print utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . $sep; + //print $langs->trans("VAT") . $sep; print $val["ref"]; print "\n"; } @@ -356,6 +370,9 @@ if ($action == 'export_csv') { $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; $companystatic->client = $tabcompany[$key]['code_client']; + + $invoicestatic->id = $key; + $invoicestatic->ref = $val["ref"]; $date = dol_print_date($db->jdate($val["date"]), 'day'); @@ -363,7 +380,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $companystatic->ref_client . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep; //print '"' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; @@ -393,7 +410,7 @@ if ($action == 'export_csv') { print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. $langs->trans("VAT") . '"' . $sep; + print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . '"' . $sep; //print '"' . $langs->trans("VAT") . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"'; @@ -481,7 +498,7 @@ if ($action == 'export_csv') { print ""; + print ""; print ""; print ""; } @@ -498,7 +515,7 @@ if ($action == 'export_csv') { print ""; print ""; //print ""; - print ""; + print ""; print ""; print ""; print ""; @@ -512,7 +529,7 @@ if ($action == 'export_csv') { print ""; print ""; print ""; - print ""; + print ""; //print ""; print ""; print ""; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 048e351044d..8f196de9f13 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013-2014 Philippe Grand * Copyright (C) 2015 Jean-François Ferry * @@ -46,24 +46,6 @@ $action = GETPOST('action','alpha'); * Actions */ -if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') -{ - $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string - - $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} - //Order display of bank account if ($action == 'setbankorder') { @@ -89,58 +71,13 @@ $form=new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup'); - -print ''; -print ''; -print ''; - $head = bank_admin_prepare_head(null); dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), 0, 'account'); -print '
'; + print ''; print $langs->trans('From'); print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, ''); print '
'; - print $langs->trans('To'); + print $langs->trans('to'); print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, ''); print '
' . length_accountg($line->numero_compte) . '' . price($line->debit) . '' . price($line->credit) . '' . price($line->credit - $line->debit) . ''; + print '' . $description . '' . number_format($line->debit, 2, ',', ' ') . '' . number_format($line->credit, 2, ',', ' ') . '' . number_format($line->credit - $line->debit, 2, ',', ' ') . '' . $link; print '
'; print price($total_debit); print '" . length_accounta($k); //print "" . $langs->trans("ThirdParty"); //print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')'; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref_client . ' - ' . $langs->trans("Code_tiers"). "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers"). "" . ($mt >= 0 ? price($mt) : '') . "" . ($mt < 0 ? price(- $mt) : '') . "" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "" . $accountingaccount->label . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
" . $date . "" . $invoicestatic->getNomUrl(1) . "" . length_accountg($k) . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client .' - '. $langs->trans("VAT") . "" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref .' - '. $langs->trans("VAT") . "" . $langs->trans("VAT") . "" . ($mt < 0 ? price(- $mt) : '') . "" . ($mt >= 0 ? price($mt) : '') . "
'; -print ''; -print ''; -print ''; -print ''; -print "\n"; $var=true; $var=! $var; -print '\n"; -print '
'.$langs->trans("Parameters").'  
'; -print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; -$variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) -{ - print ''; -} -else -{ - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details'); - print $doleditor->Create(); -} -print '
'; -print ''; -print "
'; -print "
"; - -/* -$var=!$var; -print ""; -print ''; -print ""; -print ''; -print $langs->trans("WatermarkOnDraftChequeReceipt").'
'; -print ''; -print ''; -print ''; -print "\n"; -print ''; -*/ - - //Show bank account order print load_fiche_titre($langs->trans("BankOrderShow")); @@ -202,8 +139,6 @@ print ''."\n"; dol_fiche_end(); -print ''; - llxFooter(); $db->close(); diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php new file mode 100644 index 00000000000..f319692f27d --- /dev/null +++ b/htdocs/admin/chequereceipts.php @@ -0,0 +1,287 @@ + + * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2013-2014 Philippe Grand + * Copyright (C) 2015 Jean-François Ferry + * + * 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 . + */ + + +/** + * \file htdocs/admin/bank.php + * \ingroup bank + * \brief Page to setup the bank module + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; + +$langs->load("admin"); +$langs->load("companies"); +$langs->load("bills"); +$langs->load("other"); +$langs->load("banks"); + +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); + + +if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipts_mint.php'; + + + +/* + * Actions + */ + +if ($action == 'updateMask') +{ + $maskconstchequereceipts=GETPOST('maskconstchequereceipts','alpha'); + $maskchequereceipts=GETPOST('maskchequereceipts','alpha'); + if ($maskconstchequereceipts) $res = dolibarr_set_const($db,$maskconstchequereceipts,$maskchequereceipts,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +if ($action == 'setmod') +{ + dolibarr_set_const($db, "CHEQUERECEIPTS_ADDON",$value,'chaine',0,'',$conf->entity); +} + +if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') +{ + $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT'); // No alpha here, we want exact string + + $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + +/* + * view + */ + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); +llxHeader("",$langs->trans("BankSetupModule")); + +$form=new Form($db); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup'); + +$head = bank_admin_prepare_head(null); +dol_fiche_head($head, 'checkreceipts', $langs->trans("BankSetupModule"), 0, 'account'); + +/* + * Numbering module + */ + +print load_fiche_titre($langs->trans("ChequeReceiptsNumberingModule"), '', ''); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''."\n"; + +clearstatcache(); + +foreach ($dirmodels as $reldir) +{ + $dir = dol_buildpath($reldir."core/modules/cheque/"); + if (is_dir($dir)) + { + $handle = opendir($dir); + if (is_resource($handle)) + { + $var=true; + + while (($file = readdir($handle))!==false) + { + if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')) + { + $filebis = $file; + $name = substr($file, 4, dol_strlen($file) -16); + $classname = preg_replace('/\.php$/','',$file); + // For compatibility + if (! is_file($dir.$filebis)) + { + $filebis = $file."/".$file.".modules.php"; + $classname = "mod_chequereceipt_".$file; + } + // Check if there is a filter on country + preg_match('/\-(.*)_(.*)$/',$classname,$reg); + if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue; + + $classname = preg_replace('/\-.*$/','',$classname); + if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php') + { + // Charging the numbering class + require_once $dir.$filebis; + + $module = new $classname($db); + + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + + if ($module->isEnabled()) + { + $var = !$var; + print ''; + + // Show example of numbering module + print ''."\n"; + + print ''; + + $chequereceipts=new RemiseCheque($db); + $chequereceipts->initAsSpecimen(); + + // Example + $htmltooltip=''; + $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval=$module->getNextValue($mysoc,$chequereceipts); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip.=$langs->trans("NextValue").': '; + if ($nextval) { + if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured') + $nextval = $langs->trans($nextval); + $htmltooltip.=$nextval.'
'; + } else { + $htmltooltip.=$langs->trans($module->error).'
'; + } + } + + print ''; + + print "\n"; + + } + } + } + } + closedir($handle); + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + + print $module->info(); + + print ''; + $tmp=$module->getExample(); + if (preg_match('/^Error/',$tmp)) print '
'.$langs->trans($tmp).'
'; + elseif ($tmp=='NotConfigured') print $langs->trans($tmp); + else print $tmp; + print '
'; + if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) + { + print img_picto($langs->trans("Activated"),'switch_on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + + if ($conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) // If module is the one used, we show existing errors + { + if (! empty($module->error)) dol_htmloutput_mesg($module->error,'','error',1); + } + + print '
'; + +print '
'; + + +/* + * Other options + * + */ +print load_fiche_titre($langs->trans("OtherOptions"),'',''); + +print '
'; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; + +$var=! $var; + +print '\n"; +print '
'.$langs->trans("Parameters").'  
'; +print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; +$variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; +if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) +{ + print ''; +} +else +{ + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details'); + print $doleditor->Create(); +} +print '
'; +print ''; +print "
'; +print "
"; + +print ''."\n"; + +dol_fiche_end(); + +print '
'; + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index f839ff3e49d..74f4863365a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new $tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; $tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1"; -$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.ranges, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; +$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1"; $tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; @@ -300,7 +300,7 @@ $tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country"; $tabfieldvalue[29]= "code,label,percent,position"; $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfieldvalue[31]= "pcg_version,country,label"; -$tabfieldvalue[32]= "code,label,range,position,country"; +$tabfieldvalue[32]= "code,label,range_account,position,country"; $tabfieldvalue[33]= "code,label"; $tabfieldvalue[34]= "code,label"; @@ -337,7 +337,7 @@ $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country"; $tabfieldinsert[29]= "code,label,percent,position"; $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfieldinsert[31]= "pcg_version,fk_pays,label"; -$tabfieldinsert[32]= "code,label,range,position,fk_country"; +$tabfieldinsert[32]= "code,label,range_account,position,fk_country"; $tabfieldinsert[33]= "code,label"; $tabfieldinsert[34]= "code,label"; @@ -998,7 +998,7 @@ if ($id) if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='range') { $valuetoshow=$langs->trans("Range"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } if ($id == 2) // Special cas for state page { @@ -1166,7 +1166,7 @@ if ($id) if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); } if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } - if ($fieldlist[$field]=='range') { $valuetoshow=$langs->trans("Range"); } + if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); } // Affiche nom du champ if ($showfield) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 87e2fea156c..8e4e05037a8 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; /** * Classe de gestion des factures recurrentes/Modeles */ -class FactureRec extends Facture +class FactureRec extends CommonInvoice { public $element='facturerec'; public $table_element='facture_rec'; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index fba7a9044fa..54af3f872cd 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2015 Alexandre Spangaro * @@ -44,7 +44,7 @@ $action=GETPOST('action', 'alpha'); $confirm=GETPOST('confirm', 'alpha'); // Security check -$fieldname = (! empty($ref)?'number':'rowid'); +$fieldname = (! empty($ref)?'ref':'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'cheque', $id, 'bordereau_cheque','','',$fieldname); @@ -112,9 +112,9 @@ if ($action == 'setref' && $user->rights->banque->cheque) $result = $object->fetch(GETPOST('id','int')); if ($result > 0) { - $number=GETPOST('number'); + $ref=GETPOST('ref'); - $result=$object->set_number($user,$number); + $result=$object->set_number($user,$ref); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -280,7 +280,7 @@ else if ($action == 'remove_file' && $user->rights->banque->cheque) $langs->load("other"); - $file=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . GETPOST('file'); + $file=$dir.get_exdir($object->ref,0,1,0,$object,'cheque') . GETPOST('file'); $ret=dol_delete_file($file,0,0,0,$object); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); @@ -576,13 +576,13 @@ else print '
'; print ''; print ''; - print ''; + print ''; print ''; print '
'; } else { - print $form->showrefnav($object,'ref',$linkback, 1, 'number'); + print $form->showrefnav($object,'ref',$linkback, 1, 'ref'); } print ''; @@ -796,7 +796,7 @@ if ($action != 'new') if ($object->statut == 1) { $filename=dol_sanitizeFileName($object->ref); - $filedir=$dir.get_exdir($object->number,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref); + $filedir=$dir.get_exdir($object->ref,0,1,0,$object,'cheque') . dol_sanitizeFileName($object->ref); $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index bad8b58cd5f..6ab43a277c0 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011-2015 Juanjo Menent + * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2015 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -47,7 +47,7 @@ class RemiseCheque extends CommonObject public $account_label; public $author_id; public $nbcheque; - public $number; + public $ref; /** * Constructor @@ -72,14 +72,14 @@ class RemiseCheque extends CommonObject { global $conf; - $sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.number, bc.statut, bc.nbcheque, bc.ref_ext"; + $sql = "SELECT bc.rowid, bc.datec, bc.fk_user_author, bc.fk_bank_account, bc.amount, bc.ref, bc.statut, bc.nbcheque, bc.ref_ext"; $sql.= ", bc.date_bordereau as date_bordereau"; $sql.= ", ba.label as account_label"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid"; $sql.= " WHERE bc.entity = ".$conf->entity; if ($id) $sql.= " AND bc.rowid = ".$id; - if ($ref) $sql.= " AND bc.number = '".$this->db->escape($ref)."'"; + if ($ref) $sql.= " AND bc.ref = '".$this->db->escape($ref)."'"; dol_syslog("RemiseCheque::fetch", LOG_DEBUG); $resql = $this->db->query($sql); @@ -99,13 +99,12 @@ class RemiseCheque extends CommonObject if ($this->statut == 0) { - $this->number = "(PROV".$this->id.")"; + $this->ref = "(PROV".$this->id.")"; } else { - $this->number = $obj->number; + $this->ref = $obj->ref; } - $this->ref = $this->number; } $this->db->free($resql); @@ -124,7 +123,7 @@ class RemiseCheque extends CommonObject * * @param User $user User making creation * @param int $account_id Bank account for cheque receipt - * @param int $limit Limit number of cheque to this + * @param int $limit Limit ref of cheque to this * @param array $toRemise array with cheques to remise * @return int <0 if KO, >0 if OK */ @@ -146,7 +145,7 @@ class RemiseCheque extends CommonObject $sql.= ", fk_bank_account"; $sql.= ", statut"; $sql.= ", amount"; - $sql.= ", number"; + $sql.= ", ref"; $sql.= ", entity"; $sql.= ", nbcheque"; $sql.= ", ref_ext"; @@ -177,7 +176,7 @@ class RemiseCheque extends CommonObject if ($this->id > 0 && $this->errno == 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " SET number='(PROV".$this->id.")'"; + $sql.= " SET ref='(PROV".$this->id.")'"; $sql.= " WHERE rowid='".$this->id."';"; dol_syslog("RemiseCheque::Create", LOG_DEBUG); @@ -345,13 +344,13 @@ class RemiseCheque extends CommonObject $this->errno = 0; $this->db->begin(); - - $numref=$this->getNextNumber(); + + $numref = $this->getNextNumRef(); if ($this->errno == 0 && $numref) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " SET statut = 1, number = '".$numref."'"; + $sql.= " SET statut = 1, ref = '".$numref."'"; $sql.= " WHERE rowid = ".$this->id; $sql.= " AND entity = ".$conf->entity; $sql.= " AND statut = 0"; @@ -364,7 +363,7 @@ class RemiseCheque extends CommonObject if ($num == 1) { - $this->number = $numref; + $this->ref = $numref; $this->statut = 1; } else @@ -394,46 +393,92 @@ class RemiseCheque extends CommonObject } } - /** - * Old module for cheque receipt numbering + * Return next reference of cheque receipts not already used (or last reference) + * according to numbering module defined into constant FACTURE_ADDON * - * @return int Next number of cheque + * @param string $mode 'next' for next value or 'last' for last value + * @return string free ref or last ref */ - function getNextNumber() + function getNextNumRef($mode='next') { - global $conf; + global $conf, $db, $langs, $mysoc; + $langs->load("bills"); - $num=0; + // Clean parameters (if not defined or using deprecated value) + if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint'; + else if ($conf->global->CHEQUERECEIPTS_ADDON=='thyme') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_thyme'; + else if ($conf->global->CHEQUERECEIPTS_ADDON=='mint') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint'; - // We use +0 to convert varchar to number for mysql, use ::integer for postgres. - // We must found a generic solution (Use a $db->toint function ?) - $sql = "SELECT "; - if ($this->db->type == 'pgsql') $sql.="MAX(number::integer)"; - else $sql.="MAX(number+0)"; - $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " WHERE entity = ".$conf->entity; - $sql.= " AND number not like '(%'"; - - dol_syslog("Remisecheque::getNextNumber", LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) + if (! empty($conf->global->CHEQUERECEIPTS_ADDON)) { - $row = $this->db->fetch_row($resql); - $num = $row[0]; - $this->db->free($resql); + $mybool=false; + + $file = $conf->global->CHEQUERECEIPTS_ADDON.".php"; + $classname = $conf->global->CHEQUERECEIPTS_ADDON; + + // Include file with class + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + + foreach ($dirmodels as $reldir) { + + $dir = dol_buildpath($reldir."core/modules/cheque/"); + + // Load file with numbering class (if found) + if (is_file($dir.$file) && is_readable($dir.$file)) + { + $mybool |= include_once $dir . $file; + } + } + + // For compatibility + if (! $mybool) + { + $file = $conf->global->CHEQUERECEIPTS_ADDON.".php"; + $classname = "mod_chequereceipt_".$conf->global->CHEQUERECEIPTS_ADDON; + $classname = preg_replace('/\-.*$/','',$classname); + // Include file with class + foreach ($conf->file->dol_document_root as $dirroot) + { + $dir = $dirroot."/core/modules/cheque/"; + + // Load file with numbering class (if found) + if (is_file($dir.$file) && is_readable($dir.$file)) { + $mybool |= include_once $dir . $file; + } + } + } + + if (! $mybool) + { + dol_print_error('',"Failed to include file ".$file); + return ''; + } + + $obj = new $classname(); + $numref = ""; + $numref = $obj->getNextValue($mysoc,$this); + + /** + * $numref can be empty in case we ask for the last value because if there is no invoice created with the + * set up mask. + */ + if ($mode != 'last' && !$numref) { + dol_print_error($db,"ChequeReceipts::getNextNumRef ".$obj->error); + return ""; + } + + return $numref; } else { - $this->errno = -1034; - dol_syslog("Remisecheque::Validate Erreur SELECT ($this->errno)", LOG_ERR); + $langs->load("errors"); + print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete"); + return ""; } - - $num++; - - return $num; } + /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -540,7 +585,7 @@ class RemiseCheque extends CommonObject } } $docmodel->nbcheque = $this->nbcheque; - $docmodel->number = $this->number; + $docmodel->ref = $this->ref; $docmodel->amount = $this->amount; $docmodel->date = $this->date_bordereau; @@ -552,7 +597,7 @@ class RemiseCheque extends CommonObject // We save charset_output to restore it because write_file can change it if needed for // output format that does not support UTF8. $sav_charseSupprimert_output=$outputlangs->charset_output; - $result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->number, $outputlangs); + $result=$docmodel->write_file($this, $conf->banque->dir_output.'/bordereau', $this->ref, $outputlangs); if ($result > 0) { //$outputlangs->charset_output=$sav_charset_output; @@ -838,18 +883,18 @@ class RemiseCheque extends CommonObject } /** - * Set the number of bordereau + * Set the ref of bordereau * * @param User $user Object user - * @param int $number number of bordereau + * @param int $ref ref of bordereau * @return int <0 if KO, >0 if OK */ - function set_number($user, $number) + function set_number($user, $ref) { if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; - $sql.= " SET number = '".$number."'" ; + $sql.= " SET ref = '".$ref."'" ; $sql.= " WHERE rowid = ".$this->id; dol_syslog("RemiseCheque::set_number", LOG_DEBUG); @@ -870,6 +915,29 @@ class RemiseCheque extends CommonObject } } + /** + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines + * @return void + */ + function initAsSpecimen($option='') + { + global $user,$langs,$conf; + + $now=dol_now(); + $arraynow=dol_getdate($now); + $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); + + // Initialize parameters + $this->id=0; + $this->ref = 'SPECIMEN'; + $this->specimen=1; + $this->date_bordereau = $nownotime; + } + /** * Return clicable name (with picto eventually) * diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index ebe9f6e8461..887868fb594 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2011 Laurent Destailleur * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2016 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 @@ -94,7 +95,7 @@ print '
'; $max=10; -$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.number as ref"; +$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref"; $sql.= ", bc.statut, bc.nbcheque"; $sql.= ", ba.label, ba.rowid as bid"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc"; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 5b4929ae42b..372f9e2340a 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2007-2009 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2016 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 @@ -77,7 +78,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both llxHeader('',$langs->trans("ChequesReceipts")); -$sql = "SELECT bc.rowid, bc.number as ref, bc.date_bordereau as dp,"; +$sql = "SELECT bc.rowid, bc.ref as ref, bc.date_bordereau as dp,"; $sql.= " bc.nbcheque, bc.amount, bc.statut,"; $sql.= " ba.rowid as bid, ba.label"; $sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc,"; @@ -86,7 +87,7 @@ $sql.= " WHERE bc.fk_bank_account = ba.rowid"; $sql.= " AND bc.entity = ".$conf->entity; // Search criteria -if ($search_ref) $sql.=" AND bc.number=".$search_ref; +if ($search_ref) $sql.=" AND bc.ref=".$search_ref; if ($search_account > 0) $sql.=" AND bc.fk_bank_account=".$search_account; if ($search_amount) $sql.=" AND bc.amount='".$db->escape(price2num(trim($search_amount)))."'"; if ($month > 0) @@ -134,7 +135,7 @@ if ($resql) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index df6e0007023..11d05c60a49 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -321,7 +321,7 @@ if ($resql) print ''; } } - else print $langs->trans("NoSalesRepresentativeAffected"); + //else print $langs->trans("NoSalesRepresentativeAffected"); } else { diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 37edb6a7239..684a25887e8 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -64,7 +64,7 @@ class FormAccounting if (! empty($mysoc->country_id)) { - $sql = "SELECT c.rowid, c.label as type, c.ranges"; + $sql = "SELECT c.rowid, c.label as type, c.range_account"; $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql.= " WHERE c.active = 1"; $sql.= " AND c.fk_country = ".$mysoc->country_id; @@ -72,7 +72,7 @@ class FormAccounting } else { - $sql = "SELECT c.rowid, c.label as type, c.ranges"; + $sql = "SELECT c.rowid, c.label as type, c.range_account"; $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co"; $sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid"; $sql.= " AND co.code = '".$mysoc->country_code."'"; @@ -96,7 +96,7 @@ class FormAccounting print '
'; + + $tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); + $tooltip.=$langs->trans("GenericMaskCodes2"); + $tooltip.=$langs->trans("GenericMaskCodes3"); + $tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CheckReceiptShort"),$langs->transnoentities("CheckReceiptShort")); + $tooltip.=$langs->trans("GenericMaskCodes5"); + + // Parametrage du prefix + $texte.= ''; + $texte.= ''; + + $texte.= ''; + + $texte.= ''; + + $texte.= '
'.$langs->trans("Mask").':'.$form->textwithpicto('',$tooltip,1,1).' 
'; + $texte.= ''; + + return $texte; + } + + /** + * Renvoi un exemple de numerotation + * + * @return string Example + */ + function getExample() + { + global $conf,$langs,$mysoc; + + $old_code_client=$mysoc->code_client; + $mysoc->code_client='CCCCCCCCCC'; + $numExample = $this->getNextValue($mysoc,''); + $mysoc->code_client=$old_code_client; + + if (! $numExample) + { + $numExample = $langs->trans('NotConfigured'); + } + return $numExample; + } + + /** + * Return next free value + * + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string Value if KO, <0 if KO + */ + function getNextValue($objsoc,$object) + { + global $db,$conf; + + require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; + + // We get cursor rule + $mask=$conf->global->CHEQUERECEIPTS_THYME_MASK; + + if (! $mask) + { + $this->error='NotConfigured'; + return 0; + } + + $numFinal=get_next_value($db,$mask,'bordereau_cheque','ref','',$objsoc,$object->date_bordereau); + + return $numFinal; + } + + + /** + * Return next free value + * + * @param Societe $objsoc Object third party + * @param string $objforref Object for number to search + * @return string Next free value + */ + function chequereceipt_get_num($objsoc,$objforref) + { + return $this->getNextValue($objsoc,$objforref); + } + +} + diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index 041a7daf7e6..9e67e363e5a 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -30,10 +30,92 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent +/** + * \class ModeleNumRefChequeReceipts + * \brief Cheque Receipts numbering references mother class + */ +abstract class ModeleNumRefChequeReceipts +{ + var $error=''; + + /** + * Return if a module can be used or not + * + * @return boolean true if module can be used + */ + function isEnabled() + { + return true; + } + + /** + * Return the default description of numbering module + * + * @return string Texte descripif + */ + function info() + { + global $langs; + $langs->load("bills"); + return $langs->trans("NoDescription"); + } + + /** + * Return numbering example + * + * @return string Example + */ + function getExample() + { + global $langs; + $langs->load("bills"); + return $langs->trans("NoExample"); + } + + /** + * Test if the existing numbers in the database do not cause conflicts that would prevent this numbering run. + * + * @return boolean false si conflit, true si ok + */ + function canBeActivated() + { + return true; + } + + /** + * Returns the next value + * + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string Valeur + */ + function getNextValue($objsoc,$object) + { + global $langs; + return $langs->trans("NotAvailable"); + } + + /** + * Returns the module numbering version + * + * @return string Value + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'development') return $langs->trans("VersionDevelopment"); + if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); + if ($this->version == 'dolibarr') return DOL_VERSION; + if ($this->version) return $this->version; + return $langs->trans("NotAvailable"); + } +} /** * \class ModeleChequeReceipts - * \brief Classe mere des modeles de facture + * \brief Classe mere des modeles de */ abstract class ModeleChequeReceipts extends CommonDocGenerator { diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index b1ce4554459..dfdc17b81ce 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -484,6 +484,22 @@ class doc_generic_project_odt extends ModelePDFProjects dol_mkdir($conf->projet->dir_temp); + // If PROJECTLEADER contact defined on project, we use it + $usecontact=false; + $arrayidcontact=$object->getIdContact('external','PROJECTLEADER'); + if (count($arrayidcontact) > 0) + { + $usecontact=true; + $result=$object->fetch_contact($arrayidcontact[0]); + } + + // Recipient name + if (! empty($usecontact)) + { + // if we have a PROJECTLEADER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } + $socobject=$object->thirdparty; // Make substitution @@ -529,8 +545,12 @@ class doc_generic_project_odt extends ModelePDFProjects $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); $array_objet=$this->get_substitutionarray_object($object,$outputlangs); $array_other=$this->get_substitutionarray_other($outputlangs); + // retrieve contact information for use in project as contact_xxx tags + $array_project_contact = array(); + if ($usecontact) + $array_project_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); - $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other); + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_project_contact); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 8bb7e654b2f..ae1b29a5c48 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -111,7 +111,7 @@ else if (! empty($conf->user->enabled) && $user->rights->user->user->lire) { $langs->load("users"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/user/list.php', DOL_URL_ROOT.'/user/list.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user')); + $searchform.=printSearchForm(DOL_URL_ROOT.'/user/index.php', DOL_URL_ROOT.'/user/index.php', $langs->trans("Users"), 'user', 'sall', 'M', 'searchleftuser', img_object('','user')); } } diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index 7c61fdb525c..240381db887 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -335,7 +335,7 @@ CREATE TABLE llx_c_accounting_category ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, code varchar(16) NOT NULL, label varchar(255) NOT NULL, - ranges varchar(255) NOT NULL, + range_account varchar(255) NOT NULL, position integer DEFAULT 0, fk_country integer DEFAULT NULL, -- This category is dedicated to a country active integer DEFAULT 1 diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql index e8927cdfda5..d74c1b75105 100644 --- a/htdocs/install/mysql/tables/llx_accounting_account.sql +++ b/htdocs/install/mysql/tables/llx_accounting_account.sql @@ -29,7 +29,7 @@ create table llx_accounting_account pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, account_number varchar(32) NOT NULL, - account_parent varchar(32), + account_parent integer, -- Hierarchic parent label varchar(255) NOT NULL, fk_accounting_category integer DEFAULT 0, fk_user_author integer DEFAULT NULL, diff --git a/htdocs/install/mysql/tables/llx_bordereau_cheque.key.sql b/htdocs/install/mysql/tables/llx_bordereau_cheque.key.sql index 1f4de0539cc..750b2b60bfc 100644 --- a/htdocs/install/mysql/tables/llx_bordereau_cheque.key.sql +++ b/htdocs/install/mysql/tables/llx_bordereau_cheque.key.sql @@ -17,4 +17,4 @@ -- =========================================================================== -ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (number, entity); +ALTER TABLE llx_bordereau_cheque ADD UNIQUE INDEX uk_bordereau_cheque (ref, entity); diff --git a/htdocs/install/mysql/tables/llx_bordereau_cheque.sql b/htdocs/install/mysql/tables/llx_bordereau_cheque.sql index cbaea000c33..7950d205bc8 100644 --- a/htdocs/install/mysql/tables/llx_bordereau_cheque.sql +++ b/htdocs/install/mysql/tables/llx_bordereau_cheque.sql @@ -24,10 +24,10 @@ create table llx_bordereau_cheque ( rowid integer AUTO_INCREMENT PRIMARY KEY, - number varchar(16) NOT NULL, -- ref - ref_ext varchar(255), -- ref_ext + ref varchar(30) NOT NULL, -- ref + ref_ext varchar(255), -- ref_ext datec datetime NOT NULL, - date_bordereau date, -- A quoi sert cette date ? + date_bordereau date, amount double(24,8) NOT NULL, nbcheque smallint NOT NULL, fk_bank_account integer, diff --git a/htdocs/install/mysql/tables/llx_c_accounting_category.sql b/htdocs/install/mysql/tables/llx_c_accounting_category.sql index dcb8d25a84a..773f283c932 100644 --- a/htdocs/install/mysql/tables/llx_c_accounting_category.sql +++ b/htdocs/install/mysql/tables/llx_c_accounting_category.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_c_accounting_category ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, code varchar(16) NOT NULL, label varchar(255) NOT NULL, - ranges varchar(255) NOT NULL, + range_account varchar(255) NOT NULL, position integer DEFAULT 0, fk_country integer DEFAULT NULL, -- This category is dedicated to a country active integer DEFAULT 1 diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b9808115485..9f3998c6a01 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1610,6 +1610,8 @@ BankOrderGlobal=General BankOrderGlobalDesc=General display order BankOrderES=Spanish BankOrderESDesc=Spanish display order +ChequeReceiptsNumberingModule=Cheque Receipts Numbering module + ##### Multicompany ##### MultiCompanySetup=Multi-company module setup ##### Suppliers ##### diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ab85f4a9ce6..ea156b340d5 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -588,7 +588,7 @@ class Task extends CommonObject $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2"; $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; } - $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " WHERE p.entity IN (".getEntity('project',1).")"; $sql.= " AND t.fk_projet = p.rowid"; } elseif ($mode == 1) @@ -609,7 +609,7 @@ class Task extends CommonObject { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; } - $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " WHERE p.entity IN (".getEntity('project',1).")"; } else return 'BadValueForParameterMode'; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index ebfad425cf8..3ef4f777124 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -47,7 +47,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; -$result = restrictedArea($user, 'projet', $id); +$result = restrictedArea($user, 'projet', $id,'projet&project'); /* diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 0911798ec76..d75c503445c 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -43,7 +43,7 @@ $mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0); // Security check $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; -$result=restrictedArea($user,'projet',$id,''); +$result=restrictedArea($user,'projet',$id,'projet&project'); $object = new Project($db); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 955c1c6dd7b..672a6f80ced 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -92,7 +92,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; -$result = restrictedArea($user, 'projet', $projectid); +$result = restrictedArea($user, 'projet', $projectid, 'projet&project'); /* diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 091059d76e3..822489b643a 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -44,7 +44,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; -$result = restrictedArea($user, 'projet', $id); +$result = restrictedArea($user, 'projet', $id,'projet&project'); $langs->load("users"); $langs->load("projects"); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 45c4cffd65b..47423491930 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -42,7 +42,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu // Security check $socid=0; if ($user->societe_id > 0) $socid=$user->societe_id; -$result = restrictedArea($user, 'projet', $id); +$result = restrictedArea($user, 'projet', $id,'projet&project'); $permissionnote=$user->rights->projet->creer; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 434b8e79886..f1400cb4643 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -61,7 +61,7 @@ $extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->tab // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; -$result = restrictedArea($user, 'projet', $id); +$result = restrictedArea($user, 'projet', $id,'projet&project'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('projecttaskcard','globalcard')); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 0faf21c1cc2..f3f58c17119 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -492,6 +492,13 @@ if ($id > 0 || ! empty($ref)) } } +if (is_object($hookmanager)) +{ + $hookmanager->initHooks(array('contacttpl')); + $parameters=array(); + $reshook=$hookmanager->executeHooks('formContactTpl',$parameters,$object,$action); +} + llxFooter(); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 832d42aacd2..29e2acc1403 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3880,6 +3880,9 @@ li.ui-li-divider .ui-link { a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-inner:hover { text-decoration: none !important; } +.ui-body-c { + background: #fff; +} .ui-btn-inner { min-width: .4em;