From 1375e20fe22eba7a64d9af75ea541d7cff67fa68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Sep 2014 09:45:29 +0200 Subject: [PATCH 1/7] Fix: doxygen --- .../class/accountancyaccount.class.php | 95 ------------------- .../class/accountingaccount.class.php | 67 +++++++------ 2 files changed, 39 insertions(+), 123 deletions(-) delete mode 100644 htdocs/accountancy/class/accountancyaccount.class.php diff --git a/htdocs/accountancy/class/accountancyaccount.class.php b/htdocs/accountancy/class/accountancyaccount.class.php deleted file mode 100644 index 229bc79ba41..00000000000 --- a/htdocs/accountancy/class/accountancyaccount.class.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * 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/class/accountancyaccount.class.php - * \ingroup accounting - * \brief Fichier de la classe des comptes comptables - */ - - -/** - * \class AccountancyAccount - * \brief Classe permettant la gestion des comptes - */ -class AccountancyAccount -{ - var $db; - var $error; - - var $rowid; - var $fk_pcg_version; - var $pcg_type; - var $pcg_subtype; - var $label; - var $account_number; - var $account_parent; - - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - } - - - /** - * Insert account into database - * - * @param User $user User making add - * @return int <0 if KO, Id line added if OK - */ - function create($user) - { - $now=dol_now(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."accountingaccount"; - $sql.= " (date_creation, fk_user_author, numero,intitule)"; - $sql.= " VALUES ('".$this->db->idate($now)."',".$user->id.",'".$this->numero."','".$this->intitule."')"; - - $resql = $this->db->query($sql); - if ($resql) - { - $id = $this->db->last_insert_id(MAIN_DB_PREFIX."accountingaccount"); - - if ($id > 0) - { - $this->id = $id; - $result = $this->id; - } - else - { - $result = -2; - $this->error="AccountancyAccount::Create Erreur $result"; - dol_syslog($this->error, LOG_ERR); - } - } - else - { - $result = -1; - $this->error="AccountancyAccount::Create Erreur $result"; - dol_syslog($this->error, LOG_ERR); - } - - return $result; - } - -} diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 4c54e609caf..f39dde7cb81 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -43,21 +43,24 @@ class AccountingAccount var $active; /** - * \brief Constructeur de la classe - * \param DB handler acces base de donnees - * \param id id compte (0 par defaut) + * Constructor + * + * @param DoliDB $db Database handle */ - function __construct($db, $rowid = '') { + function __construct($db) + { $this->db = $db; - - if ($rowid != '') - return $this->fetch($rowid); } /** - * \brief Load record in memory + * Load record in memory + * + * @param int $rowid Id + * @param string $account_number Account number + * @return int <0 if KO, >0 if OK */ - function fetch($rowid = null, $account_number = null) { + function fetch($rowid = null, $account_number = null) + { if ($rowid || $account_number) { $sql = "SELECT * FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE "; if ($rowid) { @@ -93,10 +96,14 @@ class AccountingAccount } /** - * \brief insert line in accountingaccount - * \param user utilisateur qui effectue l'insertion + * Insert line in accountingaccount + * + * @param User $user Use making action + * @param int $notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ - function create($user, $notrigger = 0) { + function create($user, $notrigger = 0) + { global $conf, $langs; $error = 0; @@ -192,10 +199,11 @@ class AccountingAccount /** * Update record * - * @param User $user update - * @return int if KO, >0 if OK + * @param User $user Use making update + * @return int <0 if KO, >0 if OK */ - function update($user) { + function update($user) + { global $langs; $this->db->begin(); @@ -227,10 +235,10 @@ class AccountingAccount /** * Check usage of accounting code * - * @param User $user update - * @return int if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ - function checkUsage() { + function checkUsage() + { global $langs; $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; @@ -259,11 +267,12 @@ class AccountingAccount /** * Delete object in database * - * @param User $user that deletes - * @param int $notrigger triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK + * @param User $user User that deletes + * @param int $notrigger 0=triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger = 0) { + function delete($user, $notrigger = 0) + { global $conf, $langs; $error = 0; @@ -356,10 +365,11 @@ class AccountingAccount /** * Account desactivate * - * @param User $user update - * @return int if KO, >0 if OK + * @param int $id Id + * @return int <0 if KO, >0 if OK */ - function account_desactivate($id) { + function account_desactivate($id) + { global $langs; $result = $this->checkUsage(); @@ -390,10 +400,11 @@ class AccountingAccount /** * Account activate * - * @param User $user update - * @return int if KO, >0 if OK + * @param int $id Id + * @return int <0 if KO, >0 if OK */ - function account_activate($id) { + function account_activate($id) + { global $langs; $this->db->begin(); From ca322942aec803e9facdcf8b3c427bd4a0dd034e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Sep 2014 09:49:50 +0200 Subject: [PATCH 2/7] I remove the extend into commonobjectline to common object. For the moment, if we need a method for line already into object, i prefer to see method duplicated. --- htdocs/core/class/commonobjectline.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 3ba7cbf52ca..675e1cf0794 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -26,7 +26,7 @@ * Parent class for class inheritance lines of business objects * This class is useless for the moment so no inherit are done on it */ -abstract class CommonObjectLine extends CommonObject +abstract class CommonObjectLine { /** * Call trigger based on this instance From be0c7ba28f9d4da498f31a93e2918391e57c561e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Sep 2014 09:55:06 +0200 Subject: [PATCH 3/7] Fix: Bad title --- htdocs/core/lib/fichinter.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 7242a8e3bab..b8d2e87fdff 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -127,7 +127,7 @@ function fichinter_admin_prepare_head() $h++; $head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php'; - $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributesdet'; $h++; From be3f4587540cb09d7d7b54f40aba7ac73ebf6e46 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Sep 2014 11:30:13 +0200 Subject: [PATCH 4/7] Fix: Pb with pgsql --- dev/skeletons/build_class_from_table.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 6acbc1feb35..0b2e96daaac 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -254,11 +254,11 @@ foreach($property as $key => $prop) $varprop.="\t\t\$sql.= \" "; if ($prop['istime']) { - $varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate('; + $varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate('; $varprop.="\$this->".$prop['field'].""; - $varprop.='))."'; + $varprop.=')."\'")."'; if ($i < count($property)) $varprop.=","; - $varprop.="\";"; + $varprop.='";'; } elseif ($prop['ischar']) { From 1eaf61542603032bbeabecb776c2507adcedfca3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Sep 2014 14:32:59 +0200 Subject: [PATCH 5/7] Fix: no br after title --- htdocs/compta/bank/index.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index c9b70e94257..fdac94091eb 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2014 Laurent Destailleur * Copytight (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -51,7 +51,6 @@ $link=''; if ($statut == '') $link=''.$langs->trans("IncludeClosedAccount").''; if ($statut == 'all') $link=''.$langs->trans("OnlyOpenedAccount").''; print_fiche_titre($langs->trans("AccountsArea"),$link); -print '
'; // On charge tableau des comptes financiers (ouverts par defaut) From 7021f4fb018aa647b53c05497cd8e621bb1494d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Sep 2014 16:09:14 +0200 Subject: [PATCH 6/7] Fix: Message show when dir is out of sync with database cache was wrong. --- htdocs/core/ajax/ajaxdirpreview.php | 2 +- htdocs/core/ajax/ajaxdirtree.php | 3 ++- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/ecm/class/ecmdirectory.class.php | 14 +++++++------- htdocs/ecm/tpl/enablefiletreeajax.tpl.php | 5 ++++- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 63641d00ab8..997e27adb20 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -207,7 +207,6 @@ if ($type == 'directory') if ($section === '0') { $filearray=array(); - $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; } else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); @@ -216,6 +215,7 @@ if ($type == 'directory') $param.='§ion='.$section; $textifempty = $langs->trans('NoFileFound'); } + else if ($section === '0') $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")); $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url); diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index b4ceaeaced1..ae70d1a418a 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -145,7 +145,8 @@ if (file_exists($fullpathselecteddir)) { if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test) { - $val['fullrelativename']=$file; $val['id']=0; + $val['fullrelativename']=$file; + $val['id']=0; $val['label']=$file; $val['description']=''; $nboffilesinsubdir=$langs->trans("Unknown"); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7ffe021fe92..05a1e40b756 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -759,7 +759,7 @@ class FormFile if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - $var=true; + $var=false; foreach($filearray as $key => $file) // filearray must be only files here { if ($file['name'] != '.' diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 52c698c240f..aae1e275d8f 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -154,7 +154,7 @@ class EcmDirectory // extends CommonObject // Call trigger $result=$this->call_trigger('MYECMDIR_CREATE',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers if (! $error) @@ -219,7 +219,7 @@ class EcmDirectory // extends CommonObject { // Call trigger $result=$this->call_trigger('MYECMDIR_MODIFY',$user); - if ($result < 0) { $error++; } + if ($result < 0) { $error++; } // End call triggers } @@ -356,10 +356,10 @@ class EcmDirectory // extends CommonObject { $this->db->rollback(); return -2; - } + } // End call triggers } - + if ($mode != 'databaseonly') { $file = $conf->ecm->dir_output . "/" . $relativepath; @@ -511,7 +511,7 @@ class EcmDirectory // extends CommonObject /** - * Reconstruit l'arborescence des categories sous la forme d'un tableau + * Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: * id Id de la categorie * id_mere Id de la categorie mere @@ -693,7 +693,7 @@ class EcmDirectory // extends CommonObject return -1; } } - + /** * Call trigger based on this instance * @@ -725,6 +725,6 @@ class EcmDirectory // extends CommonObject return $result; } - + } diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 301fa5f955b..b348cb03c72 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -42,7 +42,7 @@ $(document).ready(function() { }, // Called if we click on a dir (not a file) function(elem) { - id=elem.attr('id').substr(12); + id=elem.attr('id').substr(12); // We get id that is 'fmdirlia_id_xxx' (id we want is xxx) jQuery("#formuserfile_section_dir").val(elem.attr('rel')); jQuery("#formuserfile_section_id").val(id); jQuery('#formuserfile').show(); @@ -65,6 +65,9 @@ $(document).ready(function() { function loadandshowpreview(filedirname,section) { //alert('filedirname='+filedirname); + //console.log(filedirname); + //console.log(section); + $('#ecmfileview').empty(); var url = '?action=preview&module=ecm§ion='+section+'&file='+urlencode(filedirname); From b1b69336ae6e196c924bc94d51b0e348564f91be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Sep 2014 18:48:42 +0200 Subject: [PATCH 7/7] New: Add proposals into referer page of thirdparty --- ChangeLog | 1 + htdocs/societe/consumption.php | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6a076df6cfc..34ac811e0b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: Add proposals into referer page of thirdparty. - New: On contact list can set filter on both active and not active (no more exclusive select). - New: Each user can include its own external ics calendar into dolibarr agenda view. - New: Intervention documents are now available in ECM module. diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 776ea1fd355..91453c877a7 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -131,8 +131,9 @@ if ($object->client) $obj = $db->fetch_object($resql); $nbFactsClient = $obj->nb; $thirdTypeArray['customer']=$langs->trans("customer"); - if($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->trans('Invoices'); if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->trans('Orders'); + if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->trans('Proposals'); + if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->trans('Invoices'); } if ($object->fournisseur) @@ -177,6 +178,19 @@ if ($type_element == 'invoice') $doc_number='f.facnumber'; $thirdTypeSelect='customer'; } +if ($type_element == 'propal') +{ + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + $documentstatic=new Propal($db); + $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as datePrint, '; + $tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d"; + $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; + $where.= " AND d.fk_propal = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; + $datePrint = 'c.datep'; + $doc_number='c.ref'; + $thirdTypeSelect='customer'; +} if ($type_element == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';