Fix: Bad path for some includes

New: Add more predefined actions
This commit is contained in:
Laurent Destailleur 2010-05-12 11:58:58 +00:00
parent fa8a201d04
commit 2a29f90d14
13 changed files with 79 additions and 55 deletions

View File

@ -25,6 +25,7 @@ For users:
- New: Move permission "see hidden categories" into "see hidden products/services". - New: Move permission "see hidden categories" into "see hidden products/services".
- New: Can delete several files at once in FTP module. - New: Can delete several files at once in FTP module.
- New: Add box "last contracts". - 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: Format number was wrong for ar_AR language.
- Fix: Can change password if has only permission change password. - Fix: Can change password if has only permission change password.
- Fix: Project PDF document show the tasks. - Fix: Project PDF document show the tasks.

View File

@ -171,7 +171,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'sendhtml')
$deliveryreceipt= $_POST["deliveryreceipt"]; $deliveryreceipt= $_POST["deliveryreceipt"];
// Create form object // 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 = new FormMail($db);
$attachedfiles=$formmail->get_attached_files(); $attachedfiles=$formmail->get_attached_files();

View File

@ -823,7 +823,7 @@ else
print_titre($langs->trans("TestMailing")); print_titre($langs->trans("TestMailing"));
// Create l'objet formulaire mail // 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 = new FormMail($db);
$formmail->fromname = $mil->email_from; $formmail->fromname = $mil->email_from;
$formmail->frommail = $mil->email_from; $formmail->frommail = $mil->email_from;

View File

@ -416,15 +416,16 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
$langs->load('mails'); $langs->load('mails');
$propal= new Propal($db); $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); $propalref = dol_sanitizeFileName($propal->ref);
$file = $conf->propale->dir_output . '/' . $propalref . '/' . $propalref . '.pdf'; $file = $conf->propale->dir_output . '/' . $propalref . '/' . $propalref . '.pdf';
if (is_readable($file)) if (is_readable($file))
{ {
$propal->fetch_client();
if ($_POST['sendto']) if ($_POST['sendto'])
{ {
// Le destinataire a ete fourni via le champ libre // Le destinataire a ete fourni via le champ libre
@ -472,7 +473,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
} }
// Create form object // 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 = new FormMail($db);
$attachedfiles=$formmail->get_attached_files(); $attachedfiles=$formmail->get_attached_files();
@ -1963,7 +1964,7 @@ if ($id > 0 || ! empty($ref))
print_titre($langs->trans('SendPropalByMail')); print_titre($langs->trans('SendPropalByMail'));
// Create form object // 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 = new FormMail($db);
$formmail->fromtype = 'user'; $formmail->fromtype = 'user';
$formmail->fromid = $user->id; $formmail->fromid = $user->id;

View File

@ -811,9 +811,9 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
$commande= new Commande($db); $commande= new Commande($db);
$result=$commande->fetch($_POST['orderid']); $result=$commande->fetch($_POST['orderid']);
$result=$commande->fetch_client(); $result=$commande->fetch_thirdparty();
if ($result) if ($result > 0)
{ {
$ref = dol_sanitizeFileName($commande->ref); $ref = dol_sanitizeFileName($commande->ref);
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
@ -867,7 +867,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
} }
// Create form object // 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 = new FormMail($db);
$attachedfiles=$formmail->get_attached_files(); $attachedfiles=$formmail->get_attached_files();

View File

@ -1128,9 +1128,9 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
$fac = new Facture($db,'',$_POST['facid']); $fac = new Facture($db,'',$_POST['facid']);
$result=$fac->fetch($_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); $ref = dol_sanitizeFileName($fac->ref);
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
@ -1197,7 +1197,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
} }
// Create form object // 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 = new FormMail($db);
$attachedfiles=$formmail->get_attached_files(); $attachedfiles=$formmail->get_attached_files();

View File

@ -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 * \return int <0 if KO, >0 if OK
*/ */
function fetch_client() function fetch_thirdparty()
{ {
global $conf; global $conf;
@ -429,6 +429,15 @@ class CommonObject
return $result; 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 * \brief Charge le projet d'id $this->fk_project dans this->projet
* \return int <0 if KO, >=0 if OK * \return int <0 if KO, >=0 if OK

View File

@ -551,11 +551,11 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
{ {
$langs->load('mails'); $langs->load('mails');
$commande= new Commande($db); $commande= new CommandeFournisseur($db);
$result=$commande->fetch($_POST['orderid']); $result=$commande->fetch($_POST['orderid']);
$result=$commande->fetch_client(); $result=$commande->fetch_thirdparty();
if ($result) if ($result > 0)
{ {
$ref = dol_sanitizeFileName($commande->ref); $ref = dol_sanitizeFileName($commande->ref);
$file = $conf->fournisseur->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf'; $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 ($_POST['action'] == 'send')
{ {
if (strlen($_POST['subject'])) $subject=$_POST['subject']; if (strlen($_POST['subject'])) $subject=$_POST['subject'];
else $subject = $langs->transnoentities('Order').' '.$commande->ref; else $subject = $langs->transnoentities('CustomerOrder').' '.$commande->ref;
$actiontypecode='AC_COM'; $actiontypecode='AC_SUP_ORD';
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; $actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message) if ($message)
{ {
@ -609,7 +609,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
} }
// Create form object // 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 = new FormMail($db);
$attachedfiles=$formmail->get_attached_files(); $attachedfiles=$formmail->get_attached_files();
@ -643,7 +643,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db); $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; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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 * \file htdocs/includes/triggers/interface_all_Demo.class.php
\ingroup core * \ingroup core
\brief Fichier de demo de personalisation des actions du workflow * \brief Fichier de demo de personalisation des actions du workflow
\remarks Son propre fichier d'actions peut etre cree par recopie de celui-ci: * \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 * - Le nom du fichier doit etre: interface_modMymodule_Mytrigger.class.php
ou: interface_all_Mytrigger.class.php * ou: interface_all_Mytrigger.class.php
- Le fichier doit rester stocke dans includes/triggers * - Le fichier doit rester stocke dans includes/triggers
- Le nom de la classe doit etre InterfaceMytrigger * - Le nom de la classe doit etre InterfaceMytrigger
- Le nom de la methode constructeur doit etre InterfaceMytrigger * - Le nom de la methode constructeur doit etre InterfaceMytrigger
- Le nom de la propriete name doit etre Mytrigger * - Le nom de la propriete name doit etre Mytrigger
\version $Id$ * \version $Id$
*/ */
/** /**
\class InterfaceDemo * \class InterfaceDemo
\brief Classe des fonctions triggers des actions personalisees du workflow * \brief Classe des fonctions triggers des actions personalisees du workflow
*/ */
class InterfaceDemo class InterfaceDemo
{ {
var $db; var $db;
@ -213,6 +212,10 @@ class InterfaceDemo
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); 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 // Proposals
elseif ($action == 'PROPAL_CREATE') elseif ($action == 'PROPAL_CREATE')

View File

@ -33,11 +33,13 @@
-- --
delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,50); 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 ( 1, 'AC_TEL', 'system', 'Phone call' ,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 ( 2, 'AC_FAX', 'system', 'Fax send' ,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 ( 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', 'Envoi Email' ,NULL); 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 ( 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 ( 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', 'Envoi Facture' ,'invoice'); 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 (50, 'AC_OTH', 'system', 'Autre' ,NULL); 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);

View File

@ -200,3 +200,7 @@ 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); 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'; 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');

View File

@ -67,11 +67,13 @@ ActionUserAsk=Recorded by
ErrorStatusCantBeZeroIfStarted=If field '<b>Date done</b>' is filled, action is started (or finished), so field '<b>Status</b>' can't be 0%%. ErrorStatusCantBeZeroIfStarted=If field '<b>Date done</b>' is filled, action is started (or finished), so field '<b>Status</b>' can't be 0%%.
ActionAC_TEL=Phone call ActionAC_TEL=Phone call
ActionAC_FAX=Send fax ActionAC_FAX=Send fax
ActionAC_PROP=Send proposal ActionAC_PROP=Send proposal by mail
ActionAC_EMAIL=Send Email ActionAC_EMAIL=Send Email
ActionAC_RDV=Meetings ActionAC_RDV=Meetings
ActionAC_FAC=Send billing ActionAC_FAC=Send customer invoice by mail
ActionAC_REL=Send billing (reminder) ActionAC_REL=Send customer invoice by mail (reminder)
ActionAC_CLO=Close ActionAC_CLO=Close
ActionAC_EMAILING=Send mass email 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

View File

@ -70,11 +70,13 @@ ActionAC_FAX=Envoi fax
ActionAC_PROP=Envoi proposition par mail ActionAC_PROP=Envoi proposition par mail
ActionAC_EMAIL=Envoi e-mail ActionAC_EMAIL=Envoi e-mail
ActionAC_RDV=Rendez-vous ActionAC_RDV=Rendez-vous
ActionAC_FAC=Envoi facture par mail ActionAC_FAC=Envoi facture client par mail
ActionAC_REL=Relance facture par mail ActionAC_REL=Relance facture client par mail
ActionAC_CLO=Clôture ActionAC_CLO=Clôture
ActionAC_EMAILING=Envoi mailing masse 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 Stats=Statistiques de vente
CAOrder=Chiffre d'affaire (Commandes validées) CAOrder=Chiffre d'affaire (Commandes validées)
FromTo=du %s au %s FromTo=du %s au %s