diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index d36569902d8..423d71bd35c 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -36,10 +36,10 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); */ class modMyModule extends DolibarrModules { - /** - * \brief Constructor. Define names, constants, directories, boxes, permissions - * \param DB Database handler - */ + /** + * \brief Constructor. Define names, constants, directories, boxes, permissions + * \param DB Database handler + */ function modMyModule($DB) { $this->db = $DB; @@ -111,10 +111,10 @@ class modMyModule extends DolibarrModules // Add here list of php file(s) stored in includes/boxes that contains class to show a box. // Example: - //$this->boxes[$r][1] = "myboxa.php"; - //$r++; - //$this->boxes[$r][1] = "myboxb.php"; - //$r++; + //$this->boxes[$r][1] = "myboxa.php"; + //$r++; + //$this->boxes[$r][1] = "myboxb.php"; + //$r++; // Permissions @@ -145,6 +145,7 @@ class modMyModule extends DolibarrModules // 'url'=>'/mymodule/pagetop.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, + // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both @@ -158,6 +159,7 @@ class modMyModule extends DolibarrModules // 'url'=>'/mymodule/pagelevel1.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, + // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both @@ -171,6 +173,7 @@ class modMyModule extends DolibarrModules // 'url'=>'/mymodule/pagelevel2.php', // 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. // 'position'=>100, + // 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. // 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules // 'target'=>'', // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both @@ -178,58 +181,58 @@ class modMyModule extends DolibarrModules // Exports - $r=1; + $r=1; - // Example: - // $this->export_code[$r]=$this->rights_class.'_'.$r; - // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - // $this->export_permission[$r]=array(array("facture","facture","export")); - // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); + // Example: + // $this->export_code[$r]=$this->rights_class.'_'.$r; + // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + // $this->export_permission[$r]=array(array("facture","facture","export")); + // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePayed",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); // $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'); - // $this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.price'=>"lineprice",'fd.total_ht'=>"linetotalht",'fd.total_tva'=>"linetotaltva",'fd.total_ttc'=>"linetotalttc",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend",'fd.fk_product'=>'productid','p.ref'=>'productref'); - // $this->export_sql_start[$r]='SELECT DISTINCT '; - // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; + // $this->export_alias_array[$r]=array('s.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy','s.code_compta_fournisseur'=>'soc_supplier_accountancy','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.price'=>"lineprice",'fd.total_ht'=>"linetotalht",'fd.total_tva'=>"linetotaltva",'fd.total_ttc'=>"linetotalttc",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend",'fd.fk_product'=>'productid','p.ref'=>'productref'); + // $this->export_sql_start[$r]='SELECT DISTINCT '; + // $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)'; // $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; // $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; - // $r++; - } + // $r++; + } /** - * \brief Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. - * It also creates data directories. + * \brief Function called when module is enabled. + * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. + * It also creates data directories. * \return int 1 if OK, 0 if KO - */ + */ function init() - { - $sql = array(); + { + $sql = array(); $result=$this->load_tables(); - return $this->_init($sql); - } + return $this->_init($sql); + } /** * \brief Function called when module is disabled. - * Remove from database constants, boxes and permissions from Dolibarr database. - * Data directories are not deleted. + * Remove from database constants, boxes and permissions from Dolibarr database. + * Data directories are not deleted. * \return int 1 if OK, 0 if KO - */ + */ function remove() { - $sql = array(); + $sql = array(); - return $this->_remove($sql); - } + return $this->_remove($sql); + } /** - * \brief Create tables and keys required by module - * Files mymodule.sql and mymodule.key.sql with create table and create keys - * commands must be stored in directory /mymodule/sql/ - * This function is called by this->init. - * \return int <=0 if KO, >0 if OK - */ + * \brief Create tables, keys and data required by module + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys + * and create data commands must be stored in directory /mymodule/sql/ + * This function is called by this->init. + * \return int <=0 if KO, >0 if OK + */ function load_tables() { return $this->_load_tables('/mymodule/sql/'); diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 73b03016f65..c7bd0d112b3 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -463,7 +463,7 @@ print '
'; print ''; print ''; print ''; -print $langs->trans("FreeLegalTextOnOrders").'
'; +print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')
'; print ''; print ''; print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 9567c91b9b5..2c819d1885d 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -615,7 +615,7 @@ print ''; print ''; print ''; print ''; -print $langs->trans("FreeLegalTextOnInvoices").'
'; +print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')
'; print ''; print ''; print ''; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 8f71d13d8f6..8415a27535e 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -423,7 +423,7 @@ print ''; print ''; print ''; print ''; -print $langs->trans("FreeLegalTextOnDeliveryReceipts").'
'; +print $langs->trans("FreeLegalTextOnDeliveryReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; print ''; print ''; print ''; diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php index bbd61bdae55..a8e94cdd061 100644 --- a/htdocs/admin/propale.php +++ b/htdocs/admin/propale.php @@ -469,7 +469,7 @@ print ''; print ''; print ''; print ''; -print $langs->trans("FreeLegalTextOnProposal").'
'; +print $langs->trans("FreeLegalTextOnProposal").' ('.$langs->trans("AddCRIfTooLong").')
'; print ''; print ''; print ''; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 02aa3dba228..5282b29d2d7 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -72,7 +72,7 @@ function printBookmarksList ($aDb, $aLangs) while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql)) { $ret.=''; $i++; } diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 232e9b09a63..460300e88bd 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -51,6 +51,7 @@ if (isset($_GET["msg"])) { $mesg=urldecode($_GET["mesg"]); } $year=isset($_GET["year"])?$_GET["year"]:""; $month=isset($_GET["month"])?$_GET["month"]:""; $socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid']; +$mesg=isset($_GET['mesg'])?urldecode($_GET['mesg']):''; // Security check $module='propale'; @@ -505,7 +506,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel']) { // Redirect here // This avoid sending mail twice if going out and then back to page - Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&msg='.urlencode($mesg)); + Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&mesg='.urlencode($mesg)); exit; } } diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index 8da71e87444..5576abf4f49 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -143,7 +143,7 @@ class Account extends CommonObject function get_url($line_id) { $lines = array(); - + $sql = "SELECT url_id, url, label, type"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_url"; $sql.= " WHERE fk_bank = ".$line_id; @@ -276,7 +276,7 @@ class Account extends CommonObject $sql.= "'".$rowid."'"; $sql.= ", '".$categorie."'"; $sql.= ")"; - + $result = $this->db->query($sql); if (! $result) { @@ -370,7 +370,7 @@ class Account extends CommonObject $sql.= ", 'SOLD'"; $sql.= ", 1"; $sql.= ")"; - + $this->db->query($sql); } return $this->id; @@ -441,8 +441,8 @@ class Account extends CommonObject } else { - $this->error=$this->db.' sql='.$sql; - dol_print_error($this->error, LOG_ERR); + $this->error=$this->db->lasterror(); + dol_print_error($this->db); return -1; } } @@ -450,12 +450,12 @@ class Account extends CommonObject /* * \brief Update BBAN (RIB) account fields - * \param user Object utilisateur qui modifie - * \return int <0 si ko, >0 si ok + * \param user Object user making update + * \return int <0 if KO, >0 if OK */ function update_bban($user='') { - global $langs; + global $conf,$langs; // Chargement librairie pour acces fonction controle RIB require_once(DOL_DOCUMENT_ROOT.'/lib/bank.lib.php'); @@ -492,8 +492,8 @@ class Account extends CommonObject } else { - $this->error=$this->db.' sql='.$sql; - dol_print_error($this->error, LOG_ERR); + $this->error=$this->db->lasterror(); + dol_print_error($this->db); return -1; } } @@ -507,7 +507,7 @@ class Account extends CommonObject function fetch($id,$ref='') { global $conf; - + $sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,"; $sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix as iban,"; $sql.= " domiciliation, proprio, adresse_proprio,"; @@ -576,7 +576,7 @@ class Account extends CommonObject function delete() { global $conf; - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE rowid = ".$this->rowid; $sql.= " AND entity = ".$conf->entity; @@ -658,7 +658,7 @@ class Account extends CommonObject $sql = "SELECT COUNT(rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."bank"; $sql.= " WHERE fk_account=".$this->id; - + $resql = $this->db->query($sql); if ($resql) { $obj=$this->db->fetch_object($resql); @@ -770,7 +770,7 @@ class Account extends CommonObject $now=gmmktime(); $this->nbtodo=$this->nbtodolate=0; - + $sql = "SELECT b.rowid, b.datev as datefin"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank_account as ba"; @@ -904,7 +904,7 @@ class AccountLine function fetch($rowid) { global $conf; - + $sql = "SELECT b.datec, b.datev, b.dateo, b.amount, b.label as label, b.fk_account,"; $sql.= " b.fk_user_author, b.fk_user_rappro,"; $sql.= " b.fk_type, b.num_releve, b.num_chq, b.rappro, b.note,"; @@ -1004,9 +1004,9 @@ class AccountLine /** - * \brief Met a jour en base la ligne - * \param user Objet user qui met a jour - * \param notrigger 0=Desactive les triggers + * \brief Update bank account record in database + * \param user Object user making update + * \param notrigger 0=Disable all triggers * \param int <0 if KO, >0 if OK */ function update($user,$notrigger=0) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 6c3eb49f3b6..6fdae434fcd 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -42,9 +42,6 @@ if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT.'/propal.class.php' if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT.'/contrat/contrat.class.php'); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); -if (! $user->rights->facture->lire) -accessforbidden(); - $langs->load('bills'); $langs->load('companies'); $langs->load('products');