Merge branch 'FHenry-develop' into develop
This commit is contained in:
commit
93611e6e5b
@ -65,6 +65,8 @@ For users:
|
|||||||
- Fix: Add actions events not implemented.
|
- Fix: Add actions events not implemented.
|
||||||
- Fix: Price min of composition is not supplier price min by quantity.
|
- Fix: Price min of composition is not supplier price min by quantity.
|
||||||
- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers.
|
- Fix: [ bug #1356 ] Bank accountancy number is limited to 8 numbers.
|
||||||
|
- Fix: [ bug #1439 ] impossible to remove a a translation (multilanguage-feature)
|
||||||
|
- New: If multilangue is enabled, mail (from propal, invoice, etc...) message is pre-defaulted in Customer language
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
- New: Predefined product and free product use same form.
|
- New: Predefined product and free product use same form.
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@uers.sourceforge.net>
|
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@uers.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -26,6 +27,7 @@
|
|||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/mailings/modules_mailings.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmailing.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
@ -54,6 +56,7 @@ $action=GETPOST("action");
|
|||||||
$search_lastname=GETPOST("search_lastname");
|
$search_lastname=GETPOST("search_lastname");
|
||||||
$search_firstname=GETPOST("search_firstname");
|
$search_firstname=GETPOST("search_firstname");
|
||||||
$search_email=GETPOST("search_email");
|
$search_email=GETPOST("search_email");
|
||||||
|
$search_dest_status=GETPOST('search_dest_status');
|
||||||
|
|
||||||
// Search modules dirs
|
// Search modules dirs
|
||||||
$modulesdir = dolGetModulesDirs('/mailings');
|
$modulesdir = dolGetModulesDirs('/mailings');
|
||||||
@ -170,6 +173,7 @@ if ($_POST["button_removefilter"])
|
|||||||
llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
|
llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing');
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formmailing = new FormMailing($db);
|
||||||
|
|
||||||
if ($object->fetch($id) >= 0)
|
if ($object->fetch($id) >= 0)
|
||||||
{
|
{
|
||||||
@ -222,7 +226,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
$allowaddtarget=($object->statut == 0 || $object->statut == 1);
|
$allowaddtarget=($object->statut == 0);
|
||||||
|
|
||||||
// Show email selectors
|
// Show email selectors
|
||||||
if ($allowaddtarget && $user->rights->mailing->creer)
|
if ($allowaddtarget && $user->rights->mailing->creer)
|
||||||
@ -359,6 +363,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
|
||||||
if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'";
|
||||||
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
|
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
|
||||||
|
if (!empty($search_dest_status)) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
|
||||||
$sql .= $db->order($sortfield,$sortorder);
|
$sql .= $db->order($sortfield,$sortorder);
|
||||||
$sql .= $db->plimit($conf->liste_limit+1, $offset);
|
$sql .= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
|
|
||||||
@ -378,7 +383,9 @@ if ($object->fetch($id) >= 0)
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
|
|
||||||
|
if ($allowaddtarget) {
|
||||||
$cleartext='<br></div><div>'.$langs->trans("ToClearAllRecipientsClickHere").': '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
|
$cleartext='<br></div><div>'.$langs->trans("ToClearAllRecipientsClickHere").': '.'<input type="submit" name="clearlist" class="button" value="'.$langs->trans("TargetsReset").'">';
|
||||||
|
}
|
||||||
|
|
||||||
print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,'');
|
print_barre_liste($langs->trans("MailSelectedRecipients").$cleartext,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,"",$num,$object->nbemail,'');
|
||||||
|
|
||||||
@ -401,7 +408,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
|
||||||
|
|
||||||
// Date sendinf
|
// Date sending
|
||||||
if ($object->statut < 2)
|
if ($object->statut < 2)
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre"> </td>';
|
print '<td class="liste_titre"> </td>';
|
||||||
@ -414,6 +421,11 @@ if ($object->fetch($id) >= 0)
|
|||||||
// Statut
|
// Statut
|
||||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
|
||||||
|
|
||||||
|
//Search Icon
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Ligne des champs de filtres
|
// Ligne des champs de filtres
|
||||||
@ -435,7 +447,20 @@ if ($object->fetch($id) >= 0)
|
|||||||
print ' ';
|
print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Source
|
// Source
|
||||||
print '<td class="liste_titre" align="right" colspan="3">';
|
print '<td class="liste_titre">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Date sending
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
//Statut
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print $formmailing->selectDestinariesStatus($search_dest_status,'search_dest_status',1);
|
||||||
|
print '</td>';
|
||||||
|
//Search Icon
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||||
@ -497,7 +522,7 @@ if ($object->fetch($id) >= 0)
|
|||||||
{
|
{
|
||||||
print '<td align="center"> </td>';
|
print '<td align="center"> </td>';
|
||||||
print '<td align="right" class="nowrap">'.$langs->trans("MailingStatusNotSent");
|
print '<td align="right" class="nowrap">'.$langs->trans("MailingStatusNotSent");
|
||||||
if ($user->rights->mailing->creer) {
|
if ($user->rights->mailing->creer && $allowaddtarget) {
|
||||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -506,12 +531,12 @@ if ($object->fetch($id) >= 0)
|
|||||||
{
|
{
|
||||||
print '<td align="center">'.$obj->date_envoi.'</td>';
|
print '<td align="center">'.$obj->date_envoi.'</td>';
|
||||||
print '<td align="right" class="nowrap">';
|
print '<td align="right" class="nowrap">';
|
||||||
if ($obj->statut==-1) print $langs->trans("MailingStatusError").' '.img_error();
|
print $object::libStatutDest($obj->statut,2);
|
||||||
if ($obj->statut==1) print $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
|
||||||
if ($obj->statut==2) print $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
|
||||||
if ($obj->statut==3) print $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut5');
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sreach Icon
|
||||||
|
print '<td></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -60,6 +60,9 @@ class Mailing extends CommonObject
|
|||||||
|
|
||||||
var $extraparams=array();
|
var $extraparams=array();
|
||||||
|
|
||||||
|
public $statut_dest=array();
|
||||||
|
public $statuts=array();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -75,6 +78,12 @@ class Mailing extends CommonObject
|
|||||||
$this->statuts[1] = 'MailingStatusValidated';
|
$this->statuts[1] = 'MailingStatusValidated';
|
||||||
$this->statuts[2] = 'MailingStatusSentPartialy';
|
$this->statuts[2] = 'MailingStatusSentPartialy';
|
||||||
$this->statuts[3] = 'MailingStatusSentCompletely';
|
$this->statuts[3] = 'MailingStatusSentCompletely';
|
||||||
|
|
||||||
|
$this->statut_dest[-1] = 'MailingStatusError';
|
||||||
|
$this->statut_dest[1] = 'MailingStatusSent';
|
||||||
|
$this->statut_dest[2] = 'MailingStatusRead';
|
||||||
|
$this->statut_dest[3] = 'MailingStatusNotContact';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -512,5 +521,60 @@ class Mailing extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi le libelle d'un statut donne
|
||||||
|
*
|
||||||
|
* @param int $statut Id statut
|
||||||
|
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||||
|
* @return string Label
|
||||||
|
*/
|
||||||
|
static public function libStatutDest($statut,$mode=0)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load('mails');
|
||||||
|
|
||||||
|
if ($mode == 0)
|
||||||
|
{
|
||||||
|
return $langs->trans($this->statut_dest[$statut]);
|
||||||
|
}
|
||||||
|
if ($mode == 1)
|
||||||
|
{
|
||||||
|
return $langs->trans($this->statut_dest[$statut]);
|
||||||
|
}
|
||||||
|
if ($mode == 2)
|
||||||
|
{
|
||||||
|
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||||
|
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||||
|
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||||
|
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||||
|
}
|
||||||
|
if ($mode == 3)
|
||||||
|
{
|
||||||
|
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||||
|
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||||
|
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||||
|
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||||
|
}
|
||||||
|
if ($mode == 4)
|
||||||
|
{
|
||||||
|
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||||
|
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||||
|
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||||
|
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||||
|
}
|
||||||
|
if ($mode == 5)
|
||||||
|
{
|
||||||
|
if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error();
|
||||||
|
if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut4');
|
||||||
|
if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut6');
|
||||||
|
if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut8');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -840,7 +840,7 @@ else
|
|||||||
{
|
{
|
||||||
print "\n\n<div class=\"tabsAction\">\n";
|
print "\n\n<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if (($object->statut == 0 || $object->statut == 1) && $user->rights->mailing->creer)
|
if (($object->statut == 0) && $user->rights->mailing->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("EditMailing").'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'">'.$langs->trans("EditMailing").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1983,8 +1983,6 @@ if ($action == 'create') {
|
|||||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/'));
|
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/'));
|
||||||
$file = $fileparams ['fullname'];
|
$file = $fileparams ['fullname'];
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file)) {
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
@ -1992,6 +1990,11 @@ if ($action == 'create') {
|
|||||||
$newlang = $_REQUEST['lang_id'];
|
$newlang = $_REQUEST['lang_id'];
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
$newlang = $object->client->default_lang;
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file)) {
|
||||||
|
|
||||||
if (! empty($newlang)) {
|
if (! empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
@ -2012,6 +2015,7 @@ if ($action == 'create') {
|
|||||||
// Create form object
|
// Create form object
|
||||||
include_once DOL_DOCUMENT_ROOT . '/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
@ -2379,8 +2379,6 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
|||||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
|
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
|
||||||
$file = $fileparams ['fullname'];
|
$file = $fileparams ['fullname'];
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file)) {
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
@ -2388,6 +2386,10 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
|||||||
$newlang = $_REQUEST['lang_id'];
|
$newlang = $_REQUEST['lang_id'];
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
$newlang = $object->client->default_lang;
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file)) {
|
||||||
|
|
||||||
if (! empty($newlang)) {
|
if (! empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
@ -2408,6 +2410,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT . '/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
@ -3616,8 +3616,6 @@ if ($action == 'create')
|
|||||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/'));
|
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/'));
|
||||||
$file = $fileparams ['fullname'];
|
$file = $fileparams ['fullname'];
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file)) {
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
@ -3625,6 +3623,10 @@ if ($action == 'create')
|
|||||||
$newlang = $_REQUEST['lang_id'];
|
$newlang = $_REQUEST['lang_id'];
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
$newlang = $object->client->default_lang;
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file)) {
|
||||||
|
|
||||||
if (! empty($newlang)) {
|
if (! empty($newlang)) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
@ -3645,6 +3647,7 @@ if ($action == 'create')
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT . '/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
@ -555,16 +555,28 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$defaultmessage="";
|
$defaultmessage="";
|
||||||
|
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
|
$newlang = $this->param['langsmodels'];
|
||||||
|
|
||||||
|
if (! empty($newlang)) {
|
||||||
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO A partir du type, proposer liste de messages dans table llx_c_email_template
|
// TODO A partir du type, proposer liste de messages dans table llx_c_email_template
|
||||||
if ($this->param["models"]=='facture_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoice"); }
|
if ($this->param["models"]=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); }
|
||||||
elseif ($this->param["models"]=='facture_relance') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
elseif ($this->param["models"]=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
||||||
elseif ($this->param["models"]=='propal_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendProposal"); }
|
elseif ($this->param["models"]=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); }
|
||||||
elseif ($this->param["models"]=='order_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendOrder"); }
|
elseif ($this->param["models"]=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); }
|
||||||
elseif ($this->param["models"]=='order_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
elseif ($this->param["models"]=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
||||||
elseif ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
elseif ($this->param["models"]=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
||||||
elseif ($this->param["models"]=='shipping_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendShipping"); }
|
elseif ($this->param["models"]=='shipping_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendShipping"); }
|
||||||
elseif ($this->param["models"]=='fichinter_send') { $defaultmessage=$langs->transnoentities("PredefinedMailContentSendFichInter"); }
|
elseif ($this->param["models"]=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); }
|
||||||
elseif ($this->param["models"]=='thirdparty') { $defaultmessage=$langs->transnoentities("PredefinedMailContentThirdparty"); }
|
elseif ($this->param["models"]=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); }
|
||||||
elseif (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; }
|
elseif (! is_numeric($this->withbody)) { $defaultmessage=$this->withbody; }
|
||||||
|
|
||||||
// Complete substitution array
|
// Complete substitution array
|
||||||
|
|||||||
84
htdocs/core/class/html.formmailing.class.php
Normal file
84
htdocs/core/class/html.formmailing.class.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2014 Florian Henry florian.henry@open-concept.pro
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/class/html.formmailing.class.php
|
||||||
|
* \ingroup core
|
||||||
|
* \brief File of predefined functions for HTML forms for mailing module
|
||||||
|
*/
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to offer components to list and upload files
|
||||||
|
*/
|
||||||
|
class FormMailing extends Form
|
||||||
|
{
|
||||||
|
public $db;
|
||||||
|
public $error;
|
||||||
|
public $errors=array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output a select with destinaries status
|
||||||
|
*
|
||||||
|
* @param string $selectedid the selected id
|
||||||
|
* @param string $htmlname name of controm
|
||||||
|
* @param number $show_empty show empty option
|
||||||
|
* @return string HTML select
|
||||||
|
*/
|
||||||
|
public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) {
|
||||||
|
|
||||||
|
global $langs;
|
||||||
|
$langs->load("mails");
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
|
||||||
|
$mailing = new Mailing($this->db);
|
||||||
|
|
||||||
|
|
||||||
|
$array = $mailing->statut_dest;
|
||||||
|
//Cannot use form->selectarray because empty value is defaulted to -1 in this method and we use here status -1...
|
||||||
|
|
||||||
|
$out = '<select name="'.$htmlname.'" class="flat">';
|
||||||
|
|
||||||
|
if ($show_empty) {
|
||||||
|
$out .= '<option value=""></option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($mailing->statut_dest as $id=>$status) {
|
||||||
|
if ($selectedid==$id) {
|
||||||
|
$selected=" selected=selected ";
|
||||||
|
}else {
|
||||||
|
$selected="";
|
||||||
|
}
|
||||||
|
$out .= '<option '.$selected.' value="'.$id.'">'.$langs->trans($status).'</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$out .= '</select>';
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -149,7 +149,7 @@ class mailing_pomme extends MailingTargets
|
|||||||
|
|
||||||
// La requete doit retourner: id, email, fk_contact, lastname, firstname
|
// La requete doit retourner: id, email, fk_contact, lastname, firstname
|
||||||
$sql = "SELECT u.rowid as id, u.email as email, null as fk_contact,";
|
$sql = "SELECT u.rowid as id, u.email as email, null as fk_contact,";
|
||||||
$sql.= " u.lastname as lastname, u.firstname as firstname, u.civilite as civility_id, u.login, u.office_phone";
|
$sql.= " u.lastname, u.firstname as firstname, u.civilite as civility_id, u.login, u.office_phone";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test
|
$sql.= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test
|
||||||
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
$sql.= " AND u.entity IN (0,".$conf->entity.")";
|
||||||
|
|||||||
@ -1574,14 +1574,17 @@ else if ($id || $ref)
|
|||||||
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/'));
|
$fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref,'/'));
|
||||||
$file=$fileparams['fullname'];
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file))
|
|
||||||
{
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
$newlang = $_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
if (! empty($newlang))
|
if (! empty($newlang))
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
@ -1604,6 +1607,7 @@ else if ($id || $ref)
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
@ -1624,14 +1624,17 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
$fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||||
$file=$fileparams['fullname'];
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file))
|
|
||||||
{
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
$newlang = $_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
if (! empty($newlang))
|
if (! empty($newlang))
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
@ -1654,6 +1657,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
// Create form object
|
// Create form object
|
||||||
include_once DOL_DOCUMENT_ROOT.'/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
@ -1988,14 +1988,17 @@ elseif (! empty($object->id))
|
|||||||
$fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
$fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||||
$file=$fileparams['fullname'];
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file))
|
|
||||||
{
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
$newlang = $_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
if (! empty($newlang))
|
if (! empty($newlang))
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
@ -2019,6 +2022,7 @@ elseif (! empty($object->id))
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
@ -2240,14 +2240,17 @@ else
|
|||||||
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/'));
|
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($ref,'/'));
|
||||||
$file=$fileparams['fullname'];
|
$file=$fileparams['fullname'];
|
||||||
|
|
||||||
// Build document if it not exists
|
|
||||||
if (! $file || ! is_readable($file))
|
|
||||||
{
|
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
$newlang = $_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
|
// Build document if it not exists
|
||||||
|
if (! $file || ! is_readable($file))
|
||||||
|
{
|
||||||
if (! empty($newlang))
|
if (! empty($newlang))
|
||||||
{
|
{
|
||||||
$outputlangs = new Translate("",$conf);
|
$outputlangs = new Translate("",$conf);
|
||||||
@ -2270,6 +2273,7 @@ else
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
@ -1201,4 +1201,3 @@ ALTER TABLE llx_c_type_resource ADD UNIQUE INDEX uk_c_type_resource_id (label, c
|
|||||||
-- Fix: Missing instruction not correctly done into 3.5
|
-- Fix: Missing instruction not correctly done into 3.5
|
||||||
-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_mode_reglement DROP NOT NULL;
|
-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_mode_reglement DROP NOT NULL;
|
||||||
-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_cond_reglement DROP NOT NULL;
|
-- VPGSQL8.2 ALTER TABLE llx_facture_fourn ALTER fk_cond_reglement DROP NOT NULL;
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013-2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
|
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -939,7 +940,7 @@ class Product extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Delete a language for this product
|
* Delete a language for this product
|
||||||
*
|
*
|
||||||
* @param string $langtodelete Language to delete
|
* @param string $langtodelete Language code to delete
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delMultiLangs($langtodelete)
|
function delMultiLangs($langtodelete)
|
||||||
@ -947,7 +948,7 @@ class Product extends CommonObject
|
|||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_lang";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_lang";
|
||||||
$sql.= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
|
$sql.= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
|
||||||
|
|
||||||
dol_syslog("Delete translation sql=".$sql);
|
dol_syslog(get_class($this).'::delMultiLangs sql='.$sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
@ -955,7 +956,8 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error="Error: ".$this->db->error()." - ".$sql;
|
$this->error=$this->db->lasterror();
|
||||||
|
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net>
|
* Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -62,7 +63,7 @@ if ($action == 'delete' && GETPOST('langtodelete','alpha'))
|
|||||||
$product->delMultiLangs(GETPOST('langtodelete','alpha'));
|
$product->delMultiLangs(GETPOST('langtodelete','alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation de l'ajout
|
// Add translation
|
||||||
if ($action == 'vadd' &&
|
if ($action == 'vadd' &&
|
||||||
$cancel != $langs->trans("Cancel") &&
|
$cancel != $langs->trans("Cancel") &&
|
||||||
($user->rights->produit->creer || $user->rights->service->creer))
|
($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
@ -93,11 +94,11 @@ $cancel != $langs->trans("Cancel") &&
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action = 'add';
|
$action = 'add';
|
||||||
$mesg = '<div class="error">'.$product->error.'</div>';
|
setEventMessage($product->error,'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validation de l'edition
|
// Edit translation
|
||||||
if ($action == 'vedit' &&
|
if ($action == 'vedit' &&
|
||||||
$cancel != $langs->trans("Cancel") &&
|
$cancel != $langs->trans("Cancel") &&
|
||||||
($user->rights->produit->creer || $user->rights->service->creer))
|
($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
@ -129,7 +130,28 @@ $cancel != $langs->trans("Cancel") &&
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
$mesg = '<div class="error">'.$product->error.'</div>';
|
setEventMessage($product->error,'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete translation
|
||||||
|
if ($action == 'vdelete' &&
|
||||||
|
$cancel != $langs->trans("Cancel") &&
|
||||||
|
($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
|
{
|
||||||
|
$product = new Product($db);
|
||||||
|
$product->fetch($id);
|
||||||
|
$langtodelete=GETPOST('langdel','alpha');
|
||||||
|
|
||||||
|
|
||||||
|
if ( $product->delMultiLangs($langtodelete) > 0 )
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$action = 'edit';
|
||||||
|
setEventMessage($product->error,'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,10 +173,6 @@ $titre=$langs->trans("CardProduct".$product->type);
|
|||||||
$picto=($product->type==1?'service':'product');
|
$picto=($product->type==1?'service':'product');
|
||||||
dol_fiche_head($head, 'translation', $titre, 0, $picto);
|
dol_fiche_head($head, 'translation', $titre, 0, $picto);
|
||||||
|
|
||||||
if (! empty($mesg)) {
|
|
||||||
dol_htmloutput_mesg($mesg);
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Reference
|
// Reference
|
||||||
@ -194,7 +212,7 @@ if ($action == 'edit')
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</tr>';
|
print '<tr height="30px"><td colspan="2" align="right"><a class="butAction" href="'.DOL_URL_ROOT.'/product/traduction.php?action=vdelete&id='.$product->id.'&langdel='.$key.'">'.$langs->trans("Delete").'</a></td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1896,9 +1896,18 @@ else
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans($titreform));
|
print_titre($langs->trans($titreform));
|
||||||
|
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang = '';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||||
|
$newlang = $_REQUEST['lang_id'];
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||||
|
$newlang = $object->client->default_lang;
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/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->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
$formmail->fromname = $user->getFullName($langs);
|
$formmail->fromname = $user->getFullName($langs);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user