diff --git a/ChangeLog b/ChangeLog index 762487b6ac8..d4999c867c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -196,6 +196,9 @@ Dolibarr better: - Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object - Fix: [ bug #1826 ] Supplier payment types are not translated into fourn/facture/paiement.php - Fix: [ bug #1830 ] Salaries payment only allows checking accounts +- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work +- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key +- Fix: Bad SEPA xml file creation ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. @@ -362,6 +365,7 @@ Fix: [ bug #1752 ] Date filter of margins module, filters since 12H instead of 0 Fix: [ bug #1757 ] Sorting breaks product/service statistics Fix: [ bug #1797 ] Tulip supplier invoice module takes creation date instead of invoice date Fix: [ bug #1792 ] Users are not allowed to see margins module index page when no product view permission is enabled +Fix: [ bug #1846 ] Browser IE11 not detected ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 diff --git a/README-FR.md b/README-FR.md index 8d3d7f36aa9..3f1819f6370 100644 --- a/README-FR.md +++ b/README-FR.md @@ -21,8 +21,9 @@ vous devez vous réorienter vers DoliWamp (la version tout-en-un de Dolibarr pour Windows), DoliDeb (la version tout-en-un pour Debian ou Ubuntu) ou DoliRpm (la version tout-en-un de Dolibarr pour Fedora, Redhat, OpenSuse, Mandriva ou Mageia). -Vous pouvez les télécharger à l'adresse: -http://www.dolibarr.org/downloads/ + +Vous pouvez les télécharger depuis la rubrique *download* du portail officiel: +http://www.dolibarr.org/ Si vous avez déjà installé un serveur Web avec PHP et une base de donnée (Mysql), vous pouvez installer Dolibarr avec cette version de la manière suivante: diff --git a/README.md b/README.md index 93b9d275beb..b97c14501ab 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Dolibarr is released under the terms of the GNU General Public License as publis If you have no technical knowledge, and you are looking for an autoinstaller to install Dolibarr ERP/CRM in few clicks, you must download DoliWamp (the all-in-one package of Dolibarr for Windows), DoliDeb (the all-in-one package of Dolibarr for Debian or Ubuntu) or DoliRpm (the all-in-one package of Dolibarr for Fedora, Redhat, Opensuse, Mandriva or Mageia). -You can download this at: [Official website] () +You can download this from the download area of [Official website] () If you already have installed a Web server and a Mysql database, you can install the standard version like this: diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b9d3b9209f9..8125f6ef14d 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -103,9 +103,7 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "bank as b"; $sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; -// To isolate the cash of the other accounts -$sql .= " WHERE ba.courant <> 2"; -$sql .= " AND ba.rowid=".$id_accountancy_journal; +$sql .= " WHERE ba.rowid=".$id_accountancy_journal; if (! empty($conf->multicompany->enabled)) { $sql .= " AND ba.entity = " . $conf->entity; } @@ -218,6 +216,7 @@ if ($result) { $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); if ($resultmid) @@ -237,6 +236,7 @@ if ($result) { { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; + $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); $tabtp[$obj->rowid][$accountancy_account_salary] += $obj->amount; } @@ -421,6 +421,7 @@ if ($action == 'export_csv') foreach ( $tabpay as $key => $val ) { $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); + $companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name']; @@ -438,21 +439,44 @@ if ($action == 'export_csv') } // Third party - foreach ( $tabtp[$key] as $k => $mt ) { - if ($mt) { - print $date . $sep; - print $bank_journal . $sep; - if ($val["lib"] == '(SupplierInvoicePayment)') { - print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; - } else { - print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; + if (is_array ( $tabtp[$key])) + { + foreach ( $tabtp[$key] as $k => $mt ) + { + if ($mt) + { + print $date . $sep; + print $bank_journal . $sep; + if ($val["lib"] == '(SupplierInvoicePayment)') { + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; + } else { + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; + } + print length_accounta(html_entity_decode($k)) . $sep; + print ($mt < 0 ? 'D' : 'C') . $sep; + print ($mt <= 0 ? price(- $mt) : $mt) . $sep; + print $val["type_payment"] . $sep; + print $val["ref"] . $sep; + print "\n"; + } + } + } + else + { + foreach ( $tabbq[$key] as $k => $mt ) + { + if (1) + { + print $date . $sep; + print $bank_journal . $sep; + print $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . $sep; + print $sep; + print ($mt < 0 ? 'D' : 'C') . $sep; + print ($mt <= 0 ? price(- $mt) : $mt) . $sep; + print $val["type_payment"] . $sep; + print $val["ref"] . $sep; + print "\n"; } - print length_accounta(html_entity_decode($k)) . $sep; - print ($mt < 0 ? 'D' : 'C') . $sep; - print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print $val["type_payment"] . $sep; - print $val["ref"] . $sep; - print "\n"; } } } @@ -476,15 +500,35 @@ if ($action == 'export_csv') } // Third party - foreach ( $tabtp[$key] as $k => $mt ) { - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["type_payment"] . '"' . $sep; - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . $companystatic->name . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"'; - print "\n"; + if (is_array ( $tabtp[$key])) + { + foreach ( $tabtp[$key] as $k => $mt ) + { + if ($mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["type_payment"] . '"' . $sep; + print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; + print '"' . $companystatic->name . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"'; + print "\n"; + } + } + } + else + { + foreach ( $tabbq[$key] as $k => $mt ) + { + if (1) + { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . '"' . $sep; + print '"' . $langs->trans("Bank") . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"'; + print "\n"; + } } } } @@ -498,14 +542,54 @@ else llxHeader('', $langs->trans("BankJournal")); $namereport = $langs->trans("BankJournal"); - $namelink = ''; - $periodlink = ''; - $exportlink = ''; - $builddate = time(); - $description = $langs->trans("DescBankJournal") . '
'; + $description = $langs->trans("DescBankJournal"); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); - report_header($namereport, $namelink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); + // Report + $h=0; + $head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal; + $head[$h][1] = $langs->trans("Report"); + $head[$h][2] = 'report'; + + dol_fiche_head($head, $hselected); + + print '
'; + print ''; + + // Title + print ''; + print ''; + print ''; + print ''; + print ''; + + // Period report + print ''; + print ''; + if (! $periodlink) print ''; + print ''; + + // Description + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + + print '
'.$langs->trans("ReportName").''.$namereport.'
'.$langs->trans("ReportPeriod").''; + else print ''; + if ($period) print $period; + if ($periodlink) print ''.$periodlink; + print '
'.$langs->trans("ReportDescription").''.$description.'
'; + + print '
'; + + print ''; + // End report + print ''; print ''; @@ -565,20 +649,36 @@ else } // Third party - foreach ( $tabtp[$key] as $k => $mt ) { - if ($k != 'type') { + if (is_array ( $tabtp[$key])) + { + foreach ( $tabtp[$key] as $k => $mt ) { + if ($k != 'type') { + print ""; + print "" . $date . ""; + print "" . $val["soclib"] . ""; + print "" . length_accounta($k) . ""; + print "" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")"; + print "" . $val["type_payment"] . ""; + print "" . ($mt < 0 ? price(- $mt) : '') . ""; + print "" . ($mt >= 0 ? price($mt) : '') . ""; + print ""; + } + } + } + else + { + foreach ( $tabbq[$key] as $k => $mt ) + { print ""; print "" . $date . ""; - print "" . $val["soclib"] . ""; - print "" . length_accounta($k) . ""; - print "" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")"; - print "" . $val["type_payment"] . ""; + print "" . $reflabel . ""; + print "" . $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . ""; + print "" . $langs->trans('ThirdParty') . ""; print "" . ($mt < 0 ? price(- $mt) : '') . ""; print "" . ($mt >= 0 ? price($mt) : '') . ""; print ""; } } - $var = ! $var; } diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php deleted file mode 100644 index bbd74a8c29c..00000000000 --- a/htdocs/accountancy/journal/cashjournal.php +++ /dev/null @@ -1,533 +0,0 @@ - - * Copyright (C) 2007-2010 Jean Heimburger - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2015 Alexandre Spangaro - * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2014 Olivier Geffroy - * - * 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/accountancy/journal/cashjournal.php - * \ingroup Accounting Expert - * \brief Page with cash journal - */ - -require '../../main.inc.php'; - -// Class -require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; - -// Langs -$langs->load("companies"); -$langs->load("other"); -$langs->load("compta"); -$langs->load("bank"); -$langs->load("accountancy"); - -$date_startmonth = GETPOST('date_startmonth'); -$date_startday = GETPOST('date_startday'); -$date_startyear = GETPOST('date_startyear'); -$date_endmonth = GETPOST('date_endmonth'); -$date_endday = GETPOST('date_endday'); -$date_endyear = GETPOST('date_endyear'); - -// Security check -if ($user->societe_id > 0) - accessforbidden(); - -$action = GETPOST('action'); - -/* - * View - */ - -$year_current = strftime("%Y", dol_now()); -$pastmonth = strftime("%m", dol_now()) - 1; -$pastmonthyear = $year_current; -if ($pastmonth == 0) { - $pastmonth = 12; - $pastmonthyear --; -} - -$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); -$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); - -if (empty($date_start) || empty($date_end)) // We define date_start and date_end -{ - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); - $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); -} - -$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); -$idpays = $p[0]; - -$sql = "SELECT b.rowid , b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, soc.code_compta, ba.courant,"; -$sql .= " soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, ba.account_number, bu1.type as typeop"; -$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b"; -$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'"; -$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid"; - -// Code opération type caisse -$sql .= " WHERE ba.courant = 2"; -if (! empty($conf->multicompany->enabled)) { - $sql .= " AND ba.entity = " . $conf->entity; -} - -if ($date_start && $date_end) - $sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'"; -$sql .= " ORDER BY b.datev"; - -$object = new Account($db); -$paymentstatic = new Paiement($db); -$paymentsupplierstatic = new PaiementFourn($db); -$societestatic = new Societe($db); -$chargestatic = new ChargeSociales($db); -$paymentvatstatic = new TVA($db); - -dol_syslog("accountancy/journal/cashjournal.php:: sql=" . $sql, LOG_DEBUG); -$result = $db->query($sql); -if ($result) { - - $num = $db->num_rows($result); - // les variables - $cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef")); - $cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_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")); - - $tabpay = array (); - $tabbq = array (); - $tabtp = array (); - $tabcompany = array (); - $tabtype = array (); - - $i = 0; - while ( $i < $num ) { - $obj = $db->fetch_object($result); - - // controls - $compta_bank = $obj->account_number; - if ($obj->label == '(SupplierInvoicePayment)') - $compta_soc = (! empty($obj->code_compta_fournisseur) ? $obj->code_compta_fournisseur : $cptfour); - if ($obj->label == '(CustomerInvoicePayment)') - $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $cptcli); - if ($obj->typeop == '(BankTransfert)') - $compta_soc = $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH; - - // variable bookkeeping - - $tabpay[$obj->rowid]["date"] = $obj->do; - $tabpay[$obj->rowid]["ref"] = $obj->label; - $tabpay[$obj->rowid]["fk_bank"] = $obj->rowid; - if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) { - $tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]); - } else { - $tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60); - } - $links = $object->get_url($obj->rowid); - - foreach ( $links as $key => $val ) { - - $tabtype[$obj->rowid] = $links[$key]['type']; - - 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') { - $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') { - - $societestatic->id = $links[$key]['url_id']; - $societestatic->name = $links[$key]['label']; - $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); - $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } else if ($links[$key]['type'] == 'sc') { - - $chargestatic->id = $links[$key]['url_id']; - $chargestatic->ref = $links[$key]['url_id']; - - $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2); - if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { - if ($reg[1] == 'socialcontribution') - $reg[1] = 'SocialContribution'; - $chargestatic->lib = $langs->trans($reg[1]); - } else { - $chargestatic->lib = $links[$key]['label']; - } - $chargestatic->ref = $chargestatic->lib; - $tabpay[$obj->rowid]["soclib"] = $chargestatic->getNomUrl(1, 30); - - $sqlmid = 'SELECT cchgsoc.accountancy_code'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid"; - $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; - } - } 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'] == 'banktransfert') { - $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); - $tabtp[$obj->rowid][$cpttva] += $obj->amount; - } - /*else { - $tabtp [$obj->rowid] [$cptsociale] += $obj->amount; - }*/ - } - $tabbq[$obj->rowid][$compta_bank] += $obj->amount; - - // if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount; - - $i ++; - } -} else { - dol_print_error($db); -} - -/* - * Actions -*/ - -// write bookkeeping -if ($action == 'writeBookKeeping') { - $error = 0; - foreach ( $tabpay as $key => $val ) { - // cash - foreach ( $tabbq[$key] as $k => $mt ) { - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->doc_type = 'cash'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = $val["fk_bank"]; - $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; - $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $compte->label; - $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); - $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; - $bookkeeping->debit = ($mt >= 0 ? $mt : 0); - $bookkeeping->credit = ($mt < 0 ? - $mt : 0); - $bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL; - - if ($tabtype[$key] == 'payment') { - - $sqlmid = 'SELECT fac.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; - $sqlmid .= " WHERE pay.fk_bank=" . $key; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - } else if ($tabtype[$key] == 'payment_supplier') { - - $sqlmid = 'SELECT facf.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; - $sqlmid .= " WHERE payf.fk_bank=" . $key; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - } - - $result = $bookkeeping->create(); - if ($result < 0) { - $error ++; - setEventMessage($object->errors, 'errors'); - } - } - // third party - foreach ( $tabtp[$key] as $k => $mt ) { - - $bookkeeping = new BookKeeping($db); - $bookkeeping->doc_date = $val["date"]; - $bookkeeping->doc_ref = $val["ref"]; - $bookkeeping->doc_type = 'cash'; - $bookkeeping->fk_doc = $key; - $bookkeeping->fk_docdet = $val["fk_bank"]; - $bookkeeping->label_compte = $tabcompany[$key]['name']; - $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); - $bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; - $bookkeeping->debit = ($mt < 0 ? - $mt : 0); - $bookkeeping->credit = ($mt >= 0 ? $mt : 0); - $bookkeeping->code_journal = $conf->global->ACCOUNTING_CASH_JOURNAL; - - if ($tabtype[$key] == 'sc') { - $bookkeeping->code_tiers = ''; - $bookkeeping->numero_compte = $k; - } else if ($tabtype[$key] == 'payment') { - - $sqlmid = 'SELECT fac.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; - $sqlmid .= " WHERE pay.fk_bank=" . $key; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - } else if ($tabtype[$key] == 'payment_supplier') { - - $sqlmid = 'SELECT facf.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfacf ON payfacf.fk_facturefourn=facf.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; - $sqlmid .= " WHERE payf.fk_bank=" . $key; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - } else if ($tabtype[$key] == 'company') { - - $sqlmid = 'SELECT fac.facnumber'; - $sqlmid .= " FROM " . MAIN_DB_PREFIX . "facture fac "; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; - $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; - $sqlmid .= " WHERE pay.fk_bank=" . $key; - dol_syslog("accountancy/journal/cashjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); - $resultmid = $db->query($sqlmid); - if ($resultmid) { - $objmid = $db->fetch_object($resultmid); - $bookkeeping->doc_ref = $objmid->facnumber; - } - $bookkeeping->code_tiers = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - } else { - - $bookkeeping->doc_ref = $k; - $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - } - - $result = $bookkeeping->create(); - if ($result < 0) { - $error ++; - setEventMessage($object->errors, 'errors'); - } - } - } - - if (empty($error)) { - setEventMessage($langs->trans('Success'), 'mesgs'); - } -} -// Export -if ($action == 'export_csv') { - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; - $cash_journal = $conf->global->ACCOUNTING_CASH_JOURNAL; - - header('Content-Type: text/csv'); - header('Content-Disposition:attachment;filename=journal_caisse.csv'); - - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export - { - $sep = ";"; - - foreach ( $tabpay as $key => $val ) { - $date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); - - // Cash - foreach ( $tabbq[$key] as $k => $mt ) { - print $date . $sep; - print $cash_journal . $sep; - print length_accountg(html_entity_decode($k)) . $sep; - print $sep; - print ($mt < 0 ? 'C' : 'D') . $sep; - print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print $val["type_payment"] . $sep; - print $val["ref"] . $sep; - print "\n"; - } - - // Third party - foreach ( $tabtp[$key] as $k => $mt ) { - if ($mt) { - print $date . $sep; - print $cash_journal . $sep; - if ($val["lib"] == '(SupplierInvoicePayment)') { - print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep; - } else { - print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep; - } - print length_accounta(html_entity_decode($k)) . $sep; - print ($mt < 0 ? 'D' : 'C') . $sep; - print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print $val["type_payment"] . $sep; - print $val["ref"] . $sep; - print "\n"; - } - } - } - } else // Model Classic Export - { - foreach ( $tabpay as $key => $val ) { - $date = dol_print_date($db->jdate($val["date"]), 'day'); - - // Cash - foreach ( $tabbq[$key] as $k => $mt ) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . $langs->trans("Cash") . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; - print "\n"; - } - - // Third party - foreach ( $tabtp[$key] as $k => $mt ) { - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . $langs->trans("ThirdParty") . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"'; - print "\n"; - } - } - } - } -} else { - - $form = new Form($db); - - llxHeader('', $langs->trans("CashJournal"), ''); - - $name = $langs->trans("CashJournal"); - $nomlink = ''; - $periodlink = ''; - $exportlink = ''; - $builddate = time(); - $description = $langs->trans("DescCashJournal") . '
'; - $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($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => '')); - - print ''; - - print ''; - - print ' - '; - - /* - * Show result array - */ - print '

'; - - $i = 0; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - - $var = true; - $r = ''; - - foreach ( $tabpay as $key => $val ) { - $date = dol_print_date($db->jdate($val["date"]), 'day'); - - // Cash - foreach ( $tabbq[$key] as $k => $mt ) { - if (1) { - print ""; - print ""; - print ""; - print ""; - print '"; - print '"; - print ""; - } - } - - // third party - foreach ( $tabtp[$key] as $k => $mt ) { - if ($k != 'type') { - print ""; - - print ""; - print ""; - - print ""; - print '"; - print '"; - } - } - - $var = ! $var; - } - - print "
" . $langs->trans("Date") . "" . $langs->trans("Piece") . ' (' . $langs->trans("InvoiceRef") . ")" . $langs->trans("Account") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . "
" . $date . "" . $val["lib"] . "" . length_accountg($k) . "' . ($mt >= 0 ? price($mt) : '') . "' . ($mt < 0 ? price(- $mt) : '') . "
" . $date . "" . $val["soclib"] . "" . length_accounta($k) . "' . ($mt < 0 ? price(- $mt) : '') . "' . ($mt >= 0 ? price($mt) : '') . "
"; - - // End of page - llxFooter(); -} -$db->close(); \ No newline at end of file diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index d8a1a85debf..94f12a61f8b 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -302,6 +302,7 @@ if (empty($reshook)) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; // Check if we need to also synchronize user information $nosyncuser=0; @@ -471,6 +472,7 @@ if (empty($reshook)) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; // Check parameters if (empty($morphy) || $morphy == "-1") { diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 96e13561825..ea39a200c97 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -89,6 +89,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$adht); + if ($ret < 0) $error++; if ($adht->libelle) { @@ -126,6 +127,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$adht); + if ($ret < 0) $error++; $adht->update($user); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 14aeba65c29..695174f3303 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -33,6 +33,7 @@ $langs->load("orders"); $langs->load("propal"); $langs->load("bills"); $langs->load("errors"); +$langs->load("mails"); // Security check if (!$user->admin) @@ -76,7 +77,9 @@ if ($action == 'setvalue' && $user->admin) * View */ -llxHeader(); +$form=new Form($db); + +llxHeader('',$langs->trans("NotificationSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup'); @@ -132,9 +135,19 @@ foreach($listofnotifiedevents as $notifiedevent) print ''.$elementLabel.''; print ''.$notifiedevent['code'].''; print ''.$label.''; + print ''; $param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code']; - print ''; - if (! empty($conf->global->$param) && ! isValidEmail($conf->global->$param)) print ' '.img_warning($langs->trans("ErrorBadEMail")); + $value=GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param; + $s=''; // Do not use type="email" here, we must be able to enter a list of email with , separator. + $arrayemail=explode(',',$value); + $showwarning=0; + foreach($arrayemail as $key=>$valuedet) + { + $valuedet=trim($valuedet); + if (! empty($valuedet) && ! isValidEmail($valuedet)) $showwarning++; + } + if ((! empty($conf->global->$param)) && $showwarning) $s.=' '.img_warning($langs->trans("ErrorBadEMail")); + print $form->textwithpicto($s,$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); print ''; print ''; } diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 6b2c626da39..87ed5fe64c6 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -136,6 +136,8 @@ print "  \n"; print ''."\n"; $var=true; +$found=0; + if (! empty($conf->facture->enabled)) { $var=!$var; @@ -148,6 +150,7 @@ if (! empty($conf->facture->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_BILL",$conf->global->STOCK_CALCULATE_ON_BILL,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->commande->enabled)) @@ -162,6 +165,7 @@ if (! empty($conf->commande->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->expedition->enabled)) @@ -176,7 +180,17 @@ if (! empty($conf->expedition->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT",$conf->global->STOCK_CALCULATE_ON_SHIPMENT,1,$disabled); print ''; print "\n\n\n"; + $found++; } + +if (! $found) +{ + $var=!$var; + print ""; + print ''.$langs->trans("NoModueToManageStockDecrease").''; + print "\n"; +} + print ''; print '
'; @@ -189,6 +203,8 @@ print "  \n"; print ''."\n"; $var=true; +$found=0; + if (! empty($conf->fournisseur->enabled)) { $var=!$var; @@ -201,6 +217,7 @@ if (! empty($conf->fournisseur->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_BILL",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->fournisseur->enabled)) @@ -215,6 +232,7 @@ if (! empty($conf->fournisseur->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER,1,$disabled); print ''; print "\n\n\n"; + $found++; } if (! empty($conf->fournisseur->enabled)) { @@ -228,65 +246,76 @@ if (! empty($conf->fournisseur->enabled)) print $form->selectyesno("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER",$conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER,1,$disabled); print ''; print "\n\n\n"; + $found++; +} + +if (! $found) +{ + $var=!$var; + print ""; + print ''.$langs->trans("NoModueToManageStockIncrease").''; + print "\n"; } print ''; // Optio to force stock to be enough before adding a line into document -print '
'; -print ''; -print ''; -print " \n"; -print " \n"; -print ''."\n"; +if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled) +{ + print '
'; + print '
".$langs->trans("RuleForStockAvailability")." 
'; + print ''; + print " \n"; + print " \n"; + print ''."\n"; -if($conf->invoice->enabled) { - $var = !$var; - print ""; - print ''; - print '\n"; - print "\n"; + if($conf->invoice->enabled) { + $var = !$var; + print ""; + print ''; + print '\n"; + print "\n"; + } + + if($conf->order->enabled) { + $var = !$var; + print ""; + print ''; + print '\n"; + print "\n"; + } + + if($conf->expedition->enabled) { + $var = !$var; + print ""; + print ''; + print '\n"; + print "\n"; + } + print '
".$langs->trans("RuleForStockAvailability")." 
'.$langs->trans("StockMustBeEnoughForInvoice").''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); - print ''; - print '
'; - print "
'.$langs->trans("StockMustBeEnoughForInvoice").''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_INVOICE",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE,1); + print ''; + print '
'; + print "
'.$langs->trans("StockMustBeEnoughForOrder").''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1); + print ''; + print '
'; + print "
'.$langs->trans("StockMustBeEnoughForShipment").''; + print "
"; + print ''; + print ""; + print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1); + print ''; + print '
'; + print "
'; } -if($conf->order->enabled) { - $var = !$var; - print ""; - print ''.$langs->trans("StockMustBeEnoughForOrder").''; - print ''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_ORDER",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER,1); - print ''; - print '
'; - print "\n"; - print "\n"; -} - -if($conf->expedition->enabled) { - $var = !$var; - print ""; - print ''.$langs->trans("StockMustBeEnoughForShipment").''; - print ''; - print "
"; - print ''; - print ""; - print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT,1); - print ''; - print '
'; - print "\n"; - print "\n"; -} -print ''; - - $virtualdiffersfromphysical=0; if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index 79dc0637b46..755a68b338e 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -31,6 +31,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +$langs->load("orders"); if (!$user->admin) accessforbidden(); diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 672c92b9508..8a587d7de32 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -127,6 +127,7 @@ if ($action == 'add' && $user->rights->categorie->creer) if ($parent != "-1") $object->fk_parent = $parent; $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; if (! $object->label) { diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index aa82fdb455d..a105d104036 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -90,7 +90,8 @@ if ($action == 'update' && $user->rights->categorie->creer) if (empty($categorie->error)) { $ret = $extrafields->setOptionalsFromPost($extralabels,$categorie); - + if ($ret < 0) $error++; + if ($categorie->update($user) > 0) { header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$categorie->id.'&type='.$type); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0a4b255884a..c15b1fe4f32 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -274,6 +274,7 @@ if ($action == 'add') // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; if (! $error) { @@ -429,6 +430,7 @@ if ($action == 'update') // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; if (! $error) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c879f50b346..9a9417a4dac 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -184,12 +184,12 @@ class ActionComm extends CommonObject $now=dol_now(); // Check parameters - if (empty($this->userownerid)) + if (empty($this->userownerid)) { $this->errors[]='ErrorPropertyUserowneridNotDefined'; return -1; } - + // Clean parameters $this->label=dol_trunc(trim($this->label),128); $this->location=dol_trunc(trim($this->location),128); @@ -214,7 +214,7 @@ class ActionComm extends CommonObject $userdoneid=$this->userdoneid; // Be sure assigned user is defined as an array of array('id'=>,'mandatory'=>,...). - if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned)) + if (empty($this->userassigned) || count($this->userassigned) == 0 || ! is_array($this->userassigned)) $this->userassigned = array($userownerid=>array('id'=>$userownerid)); if (! $this->type_id || ! $this->type_code) @@ -306,9 +306,9 @@ class ActionComm extends CommonObject { $val=array('id'=>$val); } - + $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; - $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['mandatory']?$val['mandatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")"; + $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['mandatory'])?'0':$val['mandatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")"; $resql = $this->db->query($sql); if (! $resql) @@ -672,7 +672,7 @@ class ActionComm extends CommonObject foreach($this->userassigned as $key => $val) { $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; - $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".($val['manadatory']?$val['manadatory']:'0').", ".($val['transparency']?$val['transparency']:'0').", ".($val['answer_status']?$val['answer_status']:'0').")"; + $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['manadatory'])?'0':$val['manadatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")"; $resql = $this->db->query($sql); if (! $resql) diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index da062176d13..e7bddb8bd7e 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -23,10 +23,11 @@ * \ingroup agenda * \brief File of class to parse ical calendars */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php'; /** - * Class to parse ICal calendars + * Class to read/parse ICal calendars */ class ICal { @@ -107,6 +108,7 @@ class ICal if (!stristr($this->file_text[0],'BEGIN:VCALENDAR')) return 'error not VCALENDAR'; $insidealarm=0; + $tmpkey='';$tmpvalue=''; foreach ($this->file_text as $text) { $text = trim($text); // trim one line @@ -137,7 +139,7 @@ class ICal case "BEGIN:DAYLIGHT": case "BEGIN:VTIMEZONE": case "BEGIN:STANDARD": - $type = $value; // save tu array under value key + $type = $value; // save array under value key break; case "END:VTODO": // end special text - goto VCALENDAR key @@ -159,8 +161,31 @@ class ICal $insidealarm=0; break; - default: // no special string - if (! $insidealarm) $this->add_to_array($type, $key, $value); // add to array + default: // no special string (SUMMARY, DESCRIPTION, ...) + if ($tmpvalue) + { + $tmpvalue .= $text; + if (! preg_match('/=$/',$text)) // No more lines + { + $key=$tmpkey; + $value=quotedPrintDecode(preg_replace('/^ENCODING=QUOTED-PRINTABLE:/i','',$tmpvalue)); + $tmpkey=''; + $tmpvalue=''; + } + } + elseif (preg_match('/^ENCODING=QUOTED-PRINTABLE:/i',$value)) + { + if (preg_match('/=$/',$value)) + { + $tmpkey=$key; + $tmpvalue=$tmpvalue.preg_replace('/=$/',"",$value); // We must wait to have next line to have complete message + } + else + { + $value=quotedPrintDecode(preg_replace('/^ENCODING=QUOTED-PRINTABLE:/i','',$tmpvalue.$value)); + } + } //$value=quotedPrintDecode($tmpvalue.$value); + if (! $insidealarm && ! $tmpkey) $this->add_to_array($type, $key, $value); // add to array break; } } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index d9d17a0ea71..f41dbc50d3a 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -361,6 +361,7 @@ if (! empty($conf->use_javascript_ajax)) foreach ($showextcals as $val) { $htmlname = dol_string_nospecial($val['name']); + $htmlname = dol_string_nospecial($htmlname,'_',array("\.","#")); $s.='