From 2a29f90d14380f22031c664662e7a47c124fb102 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2010 11:58:58 +0000 Subject: [PATCH] Fix: Bad path for some includes New: Add more predefined actions --- ChangeLog | 3 +- htdocs/admin/mails.php | 2 +- htdocs/comm/mailing/fiche.php | 2 +- htdocs/comm/propal.php | 11 +++--- htdocs/commande/fiche.php | 6 +-- htdocs/compta/facture.php | 6 +-- htdocs/core/class/commonobject.class.php | 13 ++++++- htdocs/fourn/commande/fiche.php | 14 +++---- .../interface_all_Demo.class.php-NORUN | 37 ++++++++++--------- .../install/mysql/data/llx_c_actioncomm.sql | 16 ++++---- .../install/mysql/migration/2.8.0-2.9.0.sql | 6 ++- htdocs/langs/en_US/commercial.lang | 10 +++-- htdocs/langs/fr_FR/commercial.lang | 8 ++-- 13 files changed, 79 insertions(+), 55 deletions(-) diff --git a/ChangeLog b/ChangeLog index be86445d9e4..aa7d379f5e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,13 +25,14 @@ For users: - New: Move permission "see hidden categories" into "see hidden products/services". - New: Can delete several files at once in FTP module. - New: Add box "last contracts". +- New: Works even if Web hosting provider has disabled glob function. - Fix: Format number was wrong for ar_AR language. - Fix: Can change password if has only permission change password. - Fix: Project PDF document show the tasks. - Fix: bug #29278 : SMTP fails with IP - Fix: Default language on login page. - Fix: Complete support of euros sign (even in PDF). - + For developers: - More comments in code. - Uniformize some code. diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index a6b4eb4cfa2..611496bb6f2 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -171,7 +171,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml') $deliveryreceipt= $_POST["deliveryreceipt"]; // Create form object - include_once('../core/class/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $attachedfiles=$formmail->get_attached_files(); diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index f93e282be10..ad5e5870443 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -823,7 +823,7 @@ else print_titre($langs->trans("TestMailing")); // Create l'objet formulaire mail - include_once("../../core/class/html.formmail.class.php"); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->fromname = $mil->email_from; $formmail->frommail = $mil->email_from; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b48aedf053c..2c813366a8b 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -416,15 +416,16 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] $langs->load('mails'); $propal= new Propal($db); - if ( $propal->fetch($_POST['propalid']) ) + $result=$propal->fetch($_POST['propalid']); + $result=$propal->fetch_thirdparty(); + + if ($result > 0) { $propalref = dol_sanitizeFileName($propal->ref); $file = $conf->propale->dir_output . '/' . $propalref . '/' . $propalref . '.pdf'; if (is_readable($file)) { - $propal->fetch_client(); - if ($_POST['sendto']) { // Le destinataire a ete fourni via le champ libre @@ -472,7 +473,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] } // Create form object - include_once('../core/class/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $attachedfiles=$formmail->get_attached_files(); @@ -1963,7 +1964,7 @@ if ($id > 0 || ! empty($ref)) print_titre($langs->trans('SendPropalByMail')); // Create form object - include_once('../core/class/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index e729d1cec2e..d854ba11901 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -811,9 +811,9 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] $commande= new Commande($db); $result=$commande->fetch($_POST['orderid']); - $result=$commande->fetch_client(); + $result=$commande->fetch_thirdparty(); - if ($result) + if ($result > 0) { $ref = dol_sanitizeFileName($commande->ref); $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; @@ -867,7 +867,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] } // Create form object - include_once('../core/class/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $attachedfiles=$formmail->get_attached_files(); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 66be466a92b..fe89643116e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1128,9 +1128,9 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a $fac = new Facture($db,'',$_POST['facid']); $result=$fac->fetch($_POST['facid']); - $result=$fac->fetch_client(); + $result=$fac->fetch_thirdparty(); - if ($result) + if ($result > 0) { $ref = dol_sanitizeFileName($fac->ref); $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; @@ -1197,7 +1197,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a } // Create form object - include_once('../core/class/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $attachedfiles=$formmail->get_attached_files(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c3b2c215233..3db82ce3f7c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -410,10 +410,10 @@ class CommonObject } /** - * \brief Charge le tiers d'id $this->socid dans this->client + * \brief Load the third party of object from id $this->socid into this->client * \return int <0 if KO, >0 if OK */ - function fetch_client() + function fetch_thirdparty() { global $conf; @@ -429,6 +429,15 @@ class CommonObject return $result; } + /** + * @deprecated Replaced by fetch_thirdparty + * Kept for backward compatibility + */ + function fetch_client() + { + return $this->fetch_thirdparty(); + } + /** * \brief Charge le projet d'id $this->fk_project dans this->projet * \return int <0 if KO, >=0 if OK diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 4b5501e2d37..f1fd51f76a3 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -551,11 +551,11 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] { $langs->load('mails'); - $commande= new Commande($db); + $commande= new CommandeFournisseur($db); $result=$commande->fetch($_POST['orderid']); - $result=$commande->fetch_client(); + $result=$commande->fetch_thirdparty(); - if ($result) + if ($result > 0) { $ref = dol_sanitizeFileName($commande->ref); $file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; @@ -596,8 +596,8 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] if ($_POST['action'] == 'send') { if (strlen($_POST['subject'])) $subject=$_POST['subject']; - else $subject = $langs->transnoentities('Order').' '.$commande->ref; - $actiontypecode='AC_COM'; + else $subject = $langs->transnoentities('CustomerOrder').' '.$commande->ref; + $actiontypecode='AC_SUP_ORD'; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; if ($message) { @@ -609,7 +609,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] } // Create form object - include_once('../core/class/html.formmail.class.php'); + include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); $formmail = new FormMail($db); $attachedfiles=$formmail->get_attached_files(); @@ -643,7 +643,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); $interface=new Interfaces($db); - $result=$interface->run_triggers('ORDER_SENTBYMAIL',$commande,$user,$langs,$conf); + $result=$interface->run_triggers('ORDER_SUPPLIER_SENTBYMAIL',$commande,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers diff --git a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN index 5fbbeb28be9..effdfeaae65 100644 --- a/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN +++ b/htdocs/includes/triggers/interface_all_Demo.class.php-NORUN @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2010 Laurent Destailleur * * 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 @@ -17,25 +17,24 @@ */ /** - \file htdocs/includes/triggers/interface_all_Demo.class.php - \ingroup core - \brief Fichier de demo de personalisation des actions du workflow - \remarks Son propre fichier d'actions peut etre cree par recopie de celui-ci: - - Le nom du fichier doit etre: interface_modMymodule_Mytrigger.class.php - ou: interface_all_Mytrigger.class.php - - Le fichier doit rester stocke dans includes/triggers - - Le nom de la classe doit etre InterfaceMytrigger - - Le nom de la methode constructeur doit etre InterfaceMytrigger - - Le nom de la propriete name doit etre Mytrigger - \version $Id$ -*/ + * \file htdocs/includes/triggers/interface_all_Demo.class.php + * \ingroup core + * \brief Fichier de demo de personalisation des actions du workflow + * \remarks Son propre fichier d'actions peut etre cree par recopie de celui-ci: + * - Le nom du fichier doit etre: interface_modMymodule_Mytrigger.class.php + * ou: interface_all_Mytrigger.class.php + * - Le fichier doit rester stocke dans includes/triggers + * - Le nom de la classe doit etre InterfaceMytrigger + * - Le nom de la methode constructeur doit etre InterfaceMytrigger + * - Le nom de la propriete name doit etre Mytrigger + * \version $Id$ + */ /** - \class InterfaceDemo - \brief Classe des fonctions triggers des actions personalisees du workflow -*/ - + * \class InterfaceDemo + * \brief Classe des fonctions triggers des actions personalisees du workflow + */ class InterfaceDemo { var $db; @@ -213,6 +212,10 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } // Proposals elseif ($action == 'PROPAL_CREATE') diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index 82a1fe418ce..b50dfa813a2 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -33,11 +33,13 @@ -- delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,50); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 1, 'AC_TEL', 'system', 'Appel Téléphonique' ,NULL); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 2, 'AC_FAX', 'system', 'Envoi Fax' ,NULL); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 3, 'AC_PROP', 'system', 'Envoi Proposition' ,'propal'); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 4, 'AC_EMAIL','system', 'Envoi Email' ,NULL); +insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 1, 'AC_TEL', 'system', 'Phone call' ,NULL); +insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 2, 'AC_FAX', 'system', 'Fax send' ,NULL); +insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 3, 'AC_PROP', 'system', 'Send commercial proposal by email' ,'propal'); +insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 4, 'AC_EMAIL','system', 'Send Email' ,NULL); insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 5, 'AC_RDV', 'system', 'Rendez-vous' ,NULL); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 8, 'AC_COM', 'system', 'Envoi Commande' ,'order'); -insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 9, 'AC_FAC', 'system', 'Envoi Facture' ,'invoice'); -insert into llx_c_actioncomm (id, code, type, libelle, module) values (50, 'AC_OTH', 'system', 'Autre' ,NULL); +insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 8, 'AC_COM', 'system', 'Send customer order by email' ,'order'); +insert into llx_c_actioncomm (id, code, type, libelle, module) values ( 9, 'AC_FAC', 'system', 'Send customer invoice by email' ,'invoice'); +insert into llx_c_actioncomm (id, code, type, libelle, module) values (30, 'AC_SUP_ORD', 'system', 'Send supplier invoice by email' ,'supplier_order'); +insert into llx_c_actioncomm (id, code, type, libelle, module) values (31, 'AC_SUP_INV', 'system', 'Send supplier invoice by email' ,'supplier_invoice'); +insert into llx_c_actioncomm (id, code, type, libelle, module) values (50, 'AC_OTH', 'system', 'Other' ,NULL); diff --git a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql index 8f90e304a75..dcf196655e3 100755 --- a/htdocs/install/mysql/migration/2.8.0-2.9.0.sql +++ b/htdocs/install/mysql/migration/2.8.0-2.9.0.sql @@ -199,4 +199,8 @@ ALTER TABLE llx_menu DROP INDEX idx_menu_uk_menu; ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, position, url, entity); -UPDATE llx_const SET name = 'MAIN_MODULE_PRODUCT' WHERE name = 'MAIN_MODULE_PRODUIT'; \ No newline at end of file +UPDATE llx_const SET name = 'MAIN_MODULE_PRODUCT' WHERE name = 'MAIN_MODULE_PRODUIT'; + +-- Add more predefined action codes -- +insert into llx_c_actioncomm (id, code, type, libelle, module) values (30, 'AC_SUP_ORD', 'system', 'Send supplier invoice by email' ,'supplier_order'); +insert into llx_c_actioncomm (id, code, type, libelle, module) values (31, 'AC_SUP_INV', 'system', 'Send supplier invoice by email' ,'supplier_invoice'); diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 3ec4d757a1b..69690932042 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -67,11 +67,13 @@ ActionUserAsk=Recorded by ErrorStatusCantBeZeroIfStarted=If field 'Date done' is filled, action is started (or finished), so field 'Status' can't be 0%%. ActionAC_TEL=Phone call ActionAC_FAX=Send fax -ActionAC_PROP=Send proposal +ActionAC_PROP=Send proposal by mail ActionAC_EMAIL=Send Email ActionAC_RDV=Meetings -ActionAC_FAC=Send billing -ActionAC_REL=Send billing (reminder) +ActionAC_FAC=Send customer invoice by mail +ActionAC_REL=Send customer invoice by mail (reminder) ActionAC_CLO=Close ActionAC_EMAILING=Send mass email -ActionAC_COM=Send order by mail +ActionAC_COM=Send customer order by mail +ActionAC_SUP_ORD=Send supplier order by mail +ActionAC_SUP_INV=Send supplier invoice by mail diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang index bf2945d5854..02691e018da 100644 --- a/htdocs/langs/fr_FR/commercial.lang +++ b/htdocs/langs/fr_FR/commercial.lang @@ -70,11 +70,13 @@ ActionAC_FAX=Envoi fax ActionAC_PROP=Envoi proposition par mail ActionAC_EMAIL=Envoi e-mail ActionAC_RDV=Rendez-vous -ActionAC_FAC=Envoi facture par mail -ActionAC_REL=Relance facture par mail +ActionAC_FAC=Envoi facture client par mail +ActionAC_REL=Relance facture client par mail ActionAC_CLO=Clôture ActionAC_EMAILING=Envoi mailing masse -ActionAC_COM=Envoi commande par mail +ActionAC_COM=Envoi commande client par mail +ActionAC_SUP_ORD=Envoi commande fournisseur par mail +ActionAC_SUP_INV=Envoi facture fournisseur par mail Stats=Statistiques de vente CAOrder=Chiffre d'affaire (Commandes validées) FromTo=du %s au %s