From 733d2be39c1d45acfc7bbf3b7e3ffe81e05e7310 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 2 Feb 2015 11:13:11 +0100 Subject: [PATCH 01/19] readd index.html file --- htdocs/contrat/class/index.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/contrat/class/index.html diff --git a/htdocs/contrat/class/index.html b/htdocs/contrat/class/index.html new file mode 100644 index 00000000000..e69de29bb2d From 2f59a63e5ad6f063e3a18c77e3c2c4b79f40bde9 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 2 Feb 2015 18:03:18 +0100 Subject: [PATCH 02/19] Fix bug on contract create form propal and fix extrafield must be control before create object --- htdocs/contrat/card.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index b2b99a9dde3..248a9a46115 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -73,7 +73,7 @@ $object = new Contrat($db); $extrafields = new ExtraFields($db); // Load object -if ($id > 0 || ! empty($ref)) { +if ($id > 0 || ! empty($ref) && $action!='add') { $ret = $object->fetch($id, $ref); if ($ret > 0) $ret = $object->fetch_thirdparty(); @@ -203,6 +203,13 @@ if ($action == 'add' && $user->rights->contrat->creer) $error++; } + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + $action = 'create'; + } + if (! $error) { $object->socid = $socid; @@ -352,10 +359,6 @@ if ($action == 'add' && $user->rights->contrat->creer) } else { - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - $result = $object->create($user); if ($result > 0) { From 7f5e4aa135da4b33b1571eaa91b7cff98617d5a5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 11 Feb 2015 11:44:49 +0100 Subject: [PATCH 03/19] FIX : bug #1840 Email template modules in HTML are not render correctly --- htdocs/core/class/doleditor.class.php | 10 ++++++---- htdocs/core/class/html.formmail.class.php | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 6dc726b084e..0433d7799c4 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -43,6 +43,7 @@ class DolEditor var $height; var $width; var $readonly; + var $allowed_content; /** @@ -62,8 +63,9 @@ class DolEditor * @param int $rows Size of rows for textarea tool * @param int $cols Size of cols for textarea tool (textarea number of cols or %) * @param int $readonly 0=Read/Edit, 1=Read only + * @param int $allowed_content 0=filter input text, 1=render as it is */ - function __construct($htmlname,$content,$width='',$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextendededitor=true,$rows=0,$cols=0,$readonly=0) + function __construct($htmlname,$content,$width='',$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextendededitor=true,$rows=0,$cols=0,$readonly=0,$allowed_content=0) { global $conf,$langs; @@ -132,6 +134,7 @@ class DolEditor $this->cols = (preg_match('/%/',$cols)?$cols:max(40,$cols)); // If $cols is a percent, we keep it, otherwise, we take max $this->height = $height; $this->width = $width; + $this->allowed_content = $allowed_content; } } @@ -163,16 +166,14 @@ class DolEditor $out.= ''; - if ($this->tool == 'ckeditor') { if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR','1'); //$skin='kama'; $skin='moono'; // default with cdeditor 4 - + $htmlencode_force=preg_match('/_encoded$/',$this->toolbarname)?'true':'false'; - $out.= '' . "\n"; + foreach ($showextcals as $val) { - $htmlname = dol_string_nospecial($val['name']); - $htmlname = dol_string_nospecial($htmlname,'_',array("\.","#")); - $s.='' . "\n"; - $s.='
' . $val ['name'] . '  
'; + $htmlname = md5($val['name']); + + $s.='
' . $val ['name'] . '  
'; } } $s.='
'.$langs->trans("AgendaShowBirthdayEvents").'  
'; @@ -1174,7 +1179,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $numicals[dol_string_nospecial($event->icalname)]++; } $color=$event->icalcolor; - $cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unmovable'); + $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unmovable'); } else if ($event->type_code == 'BIRTHDAY') { From c9b3cab22b23b2765043d99afc7b766b69778427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Thu, 5 Mar 2015 10:22:22 +0100 Subject: [PATCH 10/19] Mytasks is not clickable --- htdocs/comm/action/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index a5b83217c80..5ba3a4d9b0b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -348,7 +348,6 @@ if (! empty($conf->use_javascript_ajax)) $s=''; $s.='' . "\n"; From 0d801be6a1563f1c6b39683ab901b2ea69dce3b0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 6 Mar 2015 06:12:47 +0100 Subject: [PATCH 11/19] NEW: (Dev) DolGraph allow extended class to override $_stringtoshow --- htdocs/core/class/dolgraph.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index c400dc151d3..5451d7457ce 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -65,7 +65,7 @@ class DolGraph var $bgcolorgrid=array(255,255,255); // array(R,G,B) var $datacolor; // array(array(R,G,B),...) - private $_stringtoshow; // To store string to output graph into HTML page + protected $_stringtoshow; // To store string to output graph into HTML page /** From 9a7346f8895e54ef6e4727c87837b4726522b2bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Fri, 6 Mar 2015 12:09:23 +0100 Subject: [PATCH 12/19] Update ChangeLog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index e861f04ae86..0664bda856d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ English Dolibarr ChangeLog - Fix: [ bug #1827 ] Tax reports gives incorrect amounts when using external modules that create lines with special codes - Fix: [ bug #1822 ] SQL error in clientfourn.php report with PostgreSQL - Fix: [ bug #1832 ] SQL error when adding a product with no price defined to an object +- Fix: [ bug #1833 ] user permissions in contact/note.php not working - 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 From 9d320e4268132df3a3accadf196524699f649b3a Mon Sep 17 00:00:00 2001 From: "Estephe L." Date: Sun, 8 Mar 2015 23:29:09 +0100 Subject: [PATCH 13/19] Fix Anchor link for quick access when editing. This is a quick fix to make anchor link works well when editing a proposal, order or invoice ... --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 948a61bae2c..c31d8da9277 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -27,7 +27,7 @@ global->MAIN_VIEW_LINE_NUMBER)) { ?> -
+
info_bits & 2) == 2) { ?> info_bits & 2) == 2) { ?> - id.'#'.$line->id; ?>"> + id.'#line_'.$line->id; ?>"> From f8dfa618595106bdc7b3a0bb0b185ee99735896b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Mon, 9 Mar 2015 16:20:51 +0100 Subject: [PATCH 14/19] FIXED #1901: Inverted supplier order/invoice buttons in project referring objects --- htdocs/projet/element.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index f0e5efa7254..5a499007fae 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -360,11 +360,11 @@ foreach ($listofreferent as $key => $value) { if ($key == 'order_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->creer) { - print ''.$langs->trans("AddSupplierInvoice").''; + print ''.$langs->trans("AddSupplierOrder").''; } if ($key == 'invoice_supplier' && ! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->creer) { - print ''.$langs->trans("AddSupplierOrder").''; + print ''.$langs->trans("AddSupplierInvoice").''; } } } From d847f9581e2c1057bd09275b221797b3d4cb8f44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Mar 2015 11:31:23 +0100 Subject: [PATCH 15/19] Fix generation of RUM number. Show it on card to help debug. --- .../class/bonprelevement.class.php | 25 +++++++++++++++---- .../class/companybankaccount.class.php | 8 +++++- htdocs/societe/rib.php | 16 ++++++++++-- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 2c07baba5a0..eb0344d7010 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1300,7 +1300,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum); $this->total = $this->total + $obj->somme; $i++; } @@ -1502,6 +1502,20 @@ class BonPrelevement extends CommonObject } + /** + * Build RUM number for a customer bank account + * + * @param string $row_code_client Customer code (soc.code_client) + * @param int $row_datec Creation date of bank account (rib.datec) + * @param string $row_drum Id of customer bank account (rib.rowid) + * @return string RUM number + */ + static function buildRumNumber($row_code_client, $row_datec, $row_drum) + { + $pre = ($row_datec > 1359673200) ? 'Rum' : '++R'; + return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); + } + /** * Write recipient of request (customer) * @@ -1520,7 +1534,7 @@ class BonPrelevement extends CommonObject * @param string $row_iban rib.iban_prefix AS iban, * @param string $row_bic rib.bic AS bic, * @param string $row_datec rib.datec, - * @param string $row_drum rib.rowid AS drum + * @param string $row_drum rib.rowid used to generate rum * @return string Return string with SEPA part DrctDbtTxInf */ function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) @@ -1530,10 +1544,11 @@ class BonPrelevement extends CommonObject // Define value for RUM // Example: RUMCustomerCode-CustomerBankAccountId-01424448606 (note: Date is date of creation of CustomerBankAccountId) - $Date_Rum = strtotime($row_datec); + $Rum = $this->buildRumNumber($row_code_client, $row_datec, $row_drum); + + // Define date of RUM signature $DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d'); - $pre = ($date_Rum > 1359673200) ? 'Rum' : '++R'; - $Rum = $pre.$row_code_client.$row_drum.'-0'.date('U', $Date_Rum); + $XML_DEBITOR =''; $XML_DEBITOR .=' '.$CrLf; $XML_DEBITOR .=' '.$CrLf; diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 37e646d6b88..255ab6a05a6 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -49,6 +49,10 @@ class CompanyBankAccount extends Account var $owner_address; var $default_rib; + var $datec; + var $datem; + + /** * Constructor * @@ -174,7 +178,7 @@ class CompanyBankAccount extends Account { if (empty($id) && empty($socid)) return -1; - $sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio, owner_address, default_rib, label"; + $sql = "SELECT rowid, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio, owner_address, default_rib, label, datec, tms as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."societe_rib"; if ($id) $sql.= " WHERE rowid = ".$id; if ($socid) $sql.= " WHERE fk_soc = ".$socid." AND default_rib = 1"; @@ -200,6 +204,8 @@ class CompanyBankAccount extends Account $this->owner_address = $obj->owner_address; $this->label = $obj->label; $this->default_rib = $obj->default_rib; + $this->datec = $this->db->jdate($obj->datec); + $this->datem = $this->db->jdate($obj->datem); } $this->db->free($resql); diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index ab14d757f6f..5af9d2a7df2 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -29,6 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; $langs->load("companies"); $langs->load("commercial"); @@ -191,6 +192,7 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes') */ $form = new Form($db); +$prelevement = new BonPrelevement($db); llxHeader(); @@ -320,11 +322,11 @@ if ($socid && $action != 'edit' && $action != "create") print "
"; - + /* * List of bank accounts */ - + print_titre($langs->trans("AllRIB")); $rib_list = $soc->get_all_rib(); @@ -339,6 +341,10 @@ if ($socid && $action != 'edit' && $action != "create") print_liste_field_titre($langs->trans("RIB")); print_liste_field_titre($langs->trans("IBAN")); print_liste_field_titre($langs->trans("BIC")); + if (! empty($conf->prelevement->enabled)) + { + print 'RUM'; + } print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"'); print ''; print ''; @@ -356,6 +362,12 @@ if ($socid && $action != 'edit' && $action != "create") print ''.$rib->iban.''; // BIC print ''.$rib->bic.''; + + if (! empty($conf->prelevement->enabled)) + { + print ''.$prelevement->buildRumNumber($soc->code_client, $rib->datec, $rib->id).''; + } + // Default print ''; if (!$rib->default_rib) { From 978dc8170dfff1a03138e7dd476a4a2c06c7a490 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 10 Mar 2015 14:56:58 +0100 Subject: [PATCH 16/19] Fix : display proposal date on proposal list --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ba0a49f2772..21d774e36bb 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -388,7 +388,7 @@ if ($result) // Date proposal print ''; - print dol_print_date($db->jdate($obj->dp), 'day'); + print dol_print_date($db->jdate($objp->dp), 'day'); print "\n"; // Date end validity From 05a2a6af00f1c2a2934574d8d961fe3e27b41a7e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Tue, 10 Mar 2015 15:53:02 +0100 Subject: [PATCH 17/19] FIX : [bug #1900] Unable to remove a salary with enough permissions --- htdocs/compta/salaries/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/salaries/fiche.php b/htdocs/compta/salaries/fiche.php index 34a2b9b4435..dac250eabc7 100644 --- a/htdocs/compta/salaries/fiche.php +++ b/htdocs/compta/salaries/fiche.php @@ -365,7 +365,7 @@ if ($id) print "
\n"; if ($salpayment->rappro == 0) { - if (! empty($user->rights->tax->charges->supprimer)) + if (! empty($user->rights->salaries->delete)) { print ''.$langs->trans("Delete").''; } From 0df2b4cc26cc8c76d7f5338e3a611a11a9cec037 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Mar 2015 16:14:46 +0100 Subject: [PATCH 18/19] Fix check parameters --- htdocs/societe/class/societe.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a18aedfcc1b..dc6503646b4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1158,12 +1158,21 @@ class Societe extends CommonObject * @param boolean $case Case sensitive (true/false) * @param boolean $similar Add test if string inside name into database, or name into database inside string. Do not use this: Not compatible with other database. * @param string $clause Clause for filters - * @return array Array of thirdparties object + * @return array|int <0 if KO, array of thirdparties object if OK */ function searchByName($name, $type='0', $filters = array(), $exact = false, $case = false, $similar = false, $clause = 'AND') { $thirdparties = array(); + dol_syslog("searchByName name=".$name." type=".$type." exact=".$exact); + + // Check parameter + if (empty($name)) + { + $this->errors[]='ErrorBadValueForParameter'; + return -1; + } + // Generation requete recherche $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $sql.= " WHERE entity IN (".getEntity('category',1).")"; @@ -1242,7 +1251,7 @@ class Societe extends CommonObject } else { - $this->error=$this->db->error().' sql='.$sql; + $this->error=$this->db->lasterror(); return -1; } } From 154865f545466e212e8f85f4aa34ab3ae66cb2e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Mar 2015 16:37:39 +0100 Subject: [PATCH 19/19] Fix return error when it is not --- htdocs/societe/class/societe.class.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index dc6503646b4..181c9f3ec8d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -953,7 +953,7 @@ class Societe extends CommonObject * @param string $idprof2 Prof id 2 of third party (Warning, this can return several records) * @param string $idprof3 Prof id 3 of third party (Warning, this can return several records) * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) - * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof. + * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='') { @@ -1008,7 +1008,7 @@ class Societe extends CommonObject { $this->error='Fetch several records found for ref='.$ref; dol_syslog($this->error, LOG_ERR); - $result = -1; + $result = -2; } if ($num) { @@ -1128,17 +1128,15 @@ class Societe extends CommonObject $this->fetch_optionals($this->id,$extralabels); } else - { - $this->error='Fetch no third party found for id='.$rowid; - dol_syslog($this->error, LOG_ERR); - $result = -2; + { + $result = 0; } $this->db->free($resql); } else - { - $this->error=$this->db->error(); + { + $this->error=$this->db->lasterror(); $result = -3; }