Merge remote-tracking branch 'Upstream/develop' into 5.0-credit_note

This commit is contained in:
aspangaro 2016-10-03 20:42:34 +02:00
commit 99271ca550
44 changed files with 419 additions and 223 deletions

View File

@ -120,6 +120,13 @@ if ($object->id > 0)
print '</table>';
print '<br>';
$object->info($id);
print dol_print_object_info($object, 1);
print '</div>';
dol_fiche_end();

View File

@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$langs->load("companies");
$langs->load("bills");
@ -51,6 +52,7 @@ $cancel=GETPOST('cancel','alpha');
$backtopage=GETPOST('backtopage','alpha');
$confirm=GETPOST('confirm','alpha');
$rowid=GETPOST('rowid','int');
$id=GETPOST('id')?GETPOST('id','int'):$rowid;
$typeid=GETPOST('typeid','int');
$userid=GETPOST('userid','int');
$socid=GETPOST('socid','int');
@ -71,7 +73,7 @@ $extrafields = new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($rowid);
$object->getCanvas($id);
$canvas = $object->canvas?$object->canvas:GETPOST("canvas");
$objcanvas=null;
if (! empty($canvas))
@ -82,12 +84,12 @@ if (! empty($canvas))
}
// Security check
$result=restrictedArea($user, 'adherent', $rowid, '', '', 'fk_soc', 'rowid', $objcanvas);
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas);
if ($rowid > 0)
if ($id > 0)
{
// Load member
$result = $object->fetch($rowid);
$result = $object->fetch($id);
// Define variables to know what current user can do on users
$canadduser=($user->admin || $user->rights->user->user->creer);
@ -105,7 +107,7 @@ if ($rowid > 0)
// Define variables to determine what the current user can do on the members
$canaddmember=$user->rights->adherent->creer;
// Define variables to determine what the current user can do on the properties of a member
if ($rowid)
if ($id)
{
$caneditfieldmember=$user->rights->adherent->creer;
}
@ -114,12 +116,14 @@ if ($rowid)
$hookmanager->initHooks(array('membercard','globalcard'));
/*
* Actions
*/
if ($cancel) $action='';
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -343,15 +347,15 @@ if (empty($reshook))
$object->setCategories($categories);
// Logo/Photo save
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'member').'/photos';
$dir= $conf->adherent->dir_output . '/' . get_exdir(0,0,0,1,$object,'member').'/photos';
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
if ($file_OK)
{
if (GETPOST('deletephoto'))
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileimg=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'member').'/photos/'.$object->photo;
$dirthumbs=$conf->adherent->dir_output.'/'.get_exdir($object->id,2,0,1,$object,'member').'/photos/thumbs';
$fileimg=$conf->adherent->dir_output.'/'.get_exdir(0,0,0,1,$object,'member').'/photos/'.$object->photo;
$dirthumbs=$conf->adherent->dir_output.'/'.get_exdir(0,0,0,1,$object,'member').'/photos/thumbs';
dol_delete_file($fileimg);
dol_delete_dir_recursive($dirthumbs);
}
@ -394,6 +398,7 @@ if (empty($reshook))
}
$rowid=$object->id;
$id=$object->id;
$action='';
if (! empty($backtopage))
@ -556,6 +561,7 @@ if (empty($reshook))
$db->commit();
$rowid=$object->id;
$id=$object->id;
$action='';
}
else
@ -578,7 +584,7 @@ if (empty($reshook))
if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes')
{
$result=$object->delete($rowid);
$result=$object->delete($id);
if ($result > 0)
{
if (! empty($backtopage))
@ -707,6 +713,11 @@ if (empty($reshook))
}
}
}
// Actions to build doc
$upload_dir = $conf->adherent->dir_output;
$permissioncreate=$user->rights->adherent->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
@ -715,6 +726,7 @@ if (empty($reshook))
*/
$form = new Form($db);
$formfile = new FormFile($db);
$formcompany = new FormCompany($db);
$title=$langs->trans("Member") . " - " . $langs->trans("Card");
@ -728,10 +740,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
// -----------------------------------------
// When used with CANVAS
// -----------------------------------------
if (empty($object->error) && $rowid)
if (empty($object->error) && $id)
{
$object = new Adherent($db);
$result=$object->fetch($rowid);
$result=$object->fetch($id);
if ($result <= 0) dol_print_error('',$object->error);
}
$objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
@ -971,7 +983,7 @@ else
*
********************************************/
$res=$object->fetch($rowid);
$res=$object->fetch($id);
if ($res < 0) {
dol_print_error($db,$object->error); exit;
}
@ -1043,7 +1055,7 @@ else
print '<form name="formsoc" action="'.$_SERVER["PHP_SELF"].'" method="post" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="update" />';
print '<input type="hidden" name="rowid" value="'.$rowid.'" />';
print '<input type="hidden" name="rowid" value="'.$id.'" />';
print '<input type="hidden" name="statut" value="'.$object->statut.'" />';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
@ -1235,7 +1247,7 @@ else
}
if ($rowid && $action != 'edit')
if ($id > 0 && $action != 'edit')
{
/* ************************************************************************** */
/* */
@ -1243,7 +1255,7 @@ else
/* */
/* ************************************************************************** */
$res=$object->fetch($rowid);
$res=$object->fetch($id);
if ($res < 0) {
dol_print_error($db,$object->error); exit;
}
@ -1343,13 +1355,13 @@ else
if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) {
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>'');
}
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
}
// Confirm send card by mail
if ($action == 'sendinfo')
{
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
}
// Confirm terminate
@ -1380,7 +1392,7 @@ else
$formquestion=array();
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false'));
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1);
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1);
}
// Confirm remove member
@ -1388,18 +1400,18 @@ else
{
$formquestion=array();
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1);
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1);
}
// Confirm add in spip
if ($action == 'add_spip')
{
print $form->formconfirm("card.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip');
print $form->formconfirm("card.php?rowid=".$id, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip');
}
// Confirm removed from spip
if ($action == 'del_spip')
{
print $form->formconfirm("card.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip');
print $form->formconfirm("card.php?rowid=$id", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip');
}
$rowspan=17;
@ -1601,7 +1613,7 @@ else
// Modify
if ($user->rights->adherent->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$rowid.'&action=edit">'.$langs->trans("Modify")."</a></div>";
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=edit">'.$langs->trans("Modify")."</a></div>";
}
else
{
@ -1613,7 +1625,7 @@ else
{
if ($user->rights->adherent->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$rowid.'&action=valid">'.$langs->trans("Validate")."</a></div>\n";
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Validate")."</a></div>\n";
}
else
{
@ -1626,7 +1638,7 @@ else
{
if ($user->rights->adherent->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$rowid.'&action=valid">'.$langs->trans("Reenable")."</a></div>\n";
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Reenable")."</a></div>\n";
}
else
{
@ -1657,7 +1669,7 @@ else
{
if ($user->rights->adherent->supprimer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$rowid.'&action=resign">'.$langs->trans("Resiliate")."</a></div>\n";
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=resign">'.$langs->trans("Resiliate")."</a></div>\n";
}
else
{
@ -1726,8 +1738,49 @@ else
{
print '<br><br><font class="error">'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.'</font>';
}
print "<br>\n";
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents generes
$filename = dol_sanitizeFileName($object->ref);
//$filename = 'tmp_cards.php';
//$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref);
$filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member');
$urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
$genallowed = $user->rights->adherent->creer;
$delallowed = $user->rights->adherent->supprimer;
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object);
$somethingshown = $formfile->numoffiles;
// Show links to link elements
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
//$somethingshown = $form->showLinkedObjectBlock($object, '');
// Show links to link elements
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
// Link for paypal payment
/*
if (! empty($conf->paypal->enabled) && $object->statut != 0) {
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';
print showPaypalPaymentUrl('invoice', $object->ref);
}
*/
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
/* Already in tab Agenda/Events
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'member', $socid);
*/
print '</div></div></div>';
}
}

View File

@ -89,25 +89,25 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
// List of values to scan for a replacement
$substitutionarray = array (
'%ID%'=>$objp->rowid,
'%LOGIN%'=>$objp->login,
'%FIRSTNAME%'=>$objp->firstname,
'%LASTNAME%'=>$objp->lastname,
'%FULLNAME%'=>$adherentstatic->getFullName($langs),
'%COMPANY%'=>$objp->company,
'%ADDRESS%'=>$objp->address,
'%ZIP%'=>$objp->zip,
'%TOWN%'=>$objp->town,
'%COUNTRY%'=>$objp->country,
'%COUNTRY_CODE%'=>$objp->country_code,
'%EMAIL%'=>$objp->email,
'%BIRTH%'=>dol_print_date($objp->birth,'day'),
'%TYPE%'=>$objp->type,
'%YEAR%'=>$year,
'%MONTH%'=>$month,
'%DAY%'=>$day,
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
'%ID%'=>$objp->rowid,
'%LOGIN%'=>$objp->login,
'%FIRSTNAME%'=>$objp->firstname,
'%LASTNAME%'=>$objp->lastname,
'%FULLNAME%'=>$adherentstatic->getFullName($langs),
'%COMPANY%'=>$objp->company,
'%ADDRESS%'=>$objp->address,
'%ZIP%'=>$objp->zip,
'%TOWN%'=>$objp->town,
'%COUNTRY%'=>$objp->country,
'%COUNTRY_CODE%'=>$objp->country_code,
'%EMAIL%'=>$objp->email,
'%BIRTH%'=>dol_print_date($objp->birth,'day'),
'%TYPE%'=>$objp->type,
'%YEAR%'=>$year,
'%MONTH%'=>$month,
'%DAY%'=>$day,
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
);
complete_substitutions_array($substitutionarray, $langs);
@ -121,7 +121,10 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
if (is_numeric($foruserid) || $foruserlogin)
{
for($j=0;$j<100;$j++)
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
if ($nb <= 0) $nb=1; // Protection to avoid empty page
for($j=0;$j<$nb;$j++)
{
$arrayofmembers[]=array(
'textleft'=>$textleft,

View File

@ -1070,6 +1070,7 @@ class Adherent extends CommonObject
$sql.= " d.datevalid as datev,";
$sql.= " d.country,";
$sql.= " d.state_id,";
$sql.= " d.model_pdf,";
$sql.= " c.rowid as country_id, c.code as country_code, c.label as country,";
$sql.= " dep.nom as state, dep.code_departement as state_code,";
$sql.= " t.libelle as type, t.subscription as subscription,";
@ -1154,6 +1155,8 @@ class Adherent extends CommonObject
$this->user_id = $obj->user_id;
$this->user_login = $obj->user_login;
$this->model_pdf = $obj->model_pdf;
// Retreive all extrafield for thirdparty
// fetch optionals attributes and labels
@ -1783,6 +1786,41 @@ class Adherent extends CommonObject
}
/**
* Create a document onto disk according to template module.
*
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;
$langs->load("orders");
// Positionne le modele sur le nom du modele a utiliser
if (! dol_strlen($modele))
{
if (! empty($conf->global->ADHERENT_ADDON_PDF))
{
$modele = $conf->global->ADHERENT_ADDON_PDF;
}
else
{
$modele = 'standard';
}
}
$modelpath = "core/modules/member/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.

View File

@ -69,7 +69,7 @@ if ($result < 0)
dol_print_error($db);
exit;
}
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'member') . '/' . dol_sanitizeFileName($object->ref);
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
/*

View File

@ -1,77 +0,0 @@
<?php
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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/adherents/info.php
* \ingroup member
* \brief Page des informations d'un adherent
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
$langs->load("companies");
$langs->load("bills");
$langs->load("members");
$langs->load("users");
$id=(GETPOST('id','int') ? GETPOST('id','int') : GETPOST('rowid','int'));
// Security check
$result=restrictedArea($user,'adherent',$id);
/*
* View
*/
$form = new Form($db);
$title=$langs->trans("Member") . " - " . $langs->trans("Info");
$helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
llxHeader("",$title,$helpurl);
$object = new Adherent($db);
$object->fetch($id);
$object->info($id);
$head = member_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
dol_print_object_info($object);
print '</div>';
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -21,7 +21,7 @@
* \brief Page to add/edit/remove a member subscription
*/
require '../main.inc.php';
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';

View File

@ -22,7 +22,7 @@
* \brief Page with information of subscriptions of a member
*/
require '../main.inc.php';
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';

View File

@ -23,7 +23,7 @@
* \brief list of subscription
*/
require '../main.inc.php';
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';

View File

@ -89,6 +89,7 @@ $actiontypecode='';
$trigger_name='';
$paramname='id';
$mode='emailfortest';
$trackid=(($action == 'testhtml')?"testhtml":"test");
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if ($action == 'presend' && GETPOST('trackid') == 'test') $action='test';

View File

@ -26,11 +26,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/comm/propal/card.php
* \ingroup propale
* \brief Page of commercial proposals card and list
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
@ -609,6 +611,7 @@ if (empty($reshook))
$trigger_name='PROPAL_SENTBYMAIL';
$paramname='id';
$mode='emailfromproposal';
$trackid='pro'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';

View File

@ -1256,6 +1256,7 @@ if (empty($reshook))
$trigger_name='ORDER_SENTBYMAIL';
$paramname='id';
$mode='emailfromorder';
$trackid='ord'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';

View File

@ -3572,9 +3572,9 @@ class Commande extends CommonOrder
}
/**
* Create a document onto disk accordign to template module.
* Create a document onto disk according to template module.
*
* @param string $modele Force le mnodele a utiliser ('' to not force)
* @param string $modele Force template to use ('' to not force)
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description

View File

@ -1781,6 +1781,7 @@ if (empty($reshook))
$trigger_name='BILL_SENTBYMAIL';
$paramname='id';
$mode='emailfrominvoice';
$trackid='inv'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';

View File

@ -103,12 +103,11 @@ if (GETPOST('removAll'))
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected'])
{
$trackid = GETPOST('trackid','aZ09');
$subject='';$actionmsg='';$actionmsg2='';
if (! empty($conf->dolimail->enabled)) $langs->load("dolimail@dolimail");
$langs->load('mails');
$subject='';$actionmsg='';$actionmsg2='';
if (is_object($object))
{
$result=$object->fetch($id);
@ -323,6 +322,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
$object->actiontypecode = $actiontypecode;
$object->actionmsg = $actionmsg; // Long text
$object->actionmsg2 = $actionmsg2; // Short text
$object->trackid = $trackid;
$object->fk_element = $object->id;
$object->elementtype = $object->element;

View File

@ -3753,30 +3753,30 @@ abstract class CommonObject
{
global $user;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources";
$sql.= " WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::delete_resource", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
else
{
if (! $notrigger)
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -1;
}
else
{
if (! $notrigger)
{
$result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
if ($result < 0) { $this->db->rollback(); return -1; }
}
$this->db->commit();
return 1;
$result=$this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user);
if ($result < 0) { $this->db->rollback(); return -1; }
}
$this->db->commit();
return 1;
}
}
@ -3837,7 +3837,8 @@ abstract class CommonObject
{
foreach(array('doc','pdf') as $prefix)
{
$file = $prefix."_".$modele.".modules.php";
if (in_array(get_class($this), array('Adherent'))) $file = $prefix."_".$modele.".class.php"; // Member module use prefix_module.class.php
else $file = $prefix."_".$modele.".modules.php";
// On verifie l'emplacement du modele
$file=dol_buildpath($reldir.$modelspath.$file,0);
@ -3854,6 +3855,8 @@ abstract class CommonObject
// If generator was found
if ($filefound)
{
global $db; // Required to solve a conception default in commonstickergenerator.class.php making an include of code using $db
require_once $file;
$obj = new $classname($this->db);
@ -3911,7 +3914,15 @@ abstract class CommonObject
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0)
if (in_array(get_class($this), array('Adherent')))
{
$arrayofrecords = array();
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1);
}
else $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref);
if ($resultwritefile > 0)
{
$outputlangs->charset_output=$sav_charset_output;

View File

@ -5640,10 +5640,10 @@ class Form
$dir=$conf->adherent->dir_output;
if (! empty($object->photo))
{
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo;
$originalfile=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo;
if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
$originalfile=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
}
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email;

View File

@ -461,6 +461,15 @@ class FormFile
$modellist=ModeleDon::liste_modeles($this->db);
}
}
elseif ($modulepart == 'member')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
{
include_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php';
$modellist=ModelePDFCards::liste_modeles($this->db);
}
}
elseif ($modulepart == 'agenda')
{
if (is_array($genallowed)) $modellist=$genallowed;
@ -913,7 +922,6 @@ class FormFile
{
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2,0,0,$object,'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
if ($object->element == 'member') $relativepath=get_exdir($object->id,2,0,0,$object,'member').$relativepath; // TODO Call using a defined value for $relativepath
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
}
// For backward compatiblity, we detect file is stored into an old path

View File

@ -4239,7 +4239,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
// TODO
// We will enhance here a common way of forging path for document storage
// Here, object->id, object->ref and object->modulepart are required.
if (in_array($modulepart, array('thirdparty','contact')))
if (in_array($modulepart, array('thirdparty','contact','member')))
{
$path=$object->ref?$object->ref:$object->id;
}

View File

@ -1524,7 +1524,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
// If this generation module needs to scan a directory, then description field is filled
// with the constant that contains list of directories to scan (COMPANY_ADDON_PDF_ODT_PATH, ...).
if (! empty($obj->description)) // List of directories to scan is defined
if (! empty($obj->description)) // A list of directories to scan is defined
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1562,7 +1562,19 @@ function getListOfModels($db,$type,$maxfilenamelength=0)
}
else
{
$liste[$obj->id]=$obj->label?$obj->label:$obj->lib;
if ($type == 'member' && $obj->lib == 'standard') // Special case, if member template, we add variant per format
{
global $_Avery_Labels;
include_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
foreach($_Avery_Labels as $key => $val)
{
$liste[$obj->id.':'.$key]=($obj->label?$obj->label:$obj->lib).' '.$val['name'];
}
}
else // Common usage
{
$liste[$obj->id]=$obj->label?$obj->label:$obj->lib;
}
}
$i++;
}

View File

@ -59,15 +59,6 @@ function member_prepare_head(Adherent $object)
$h++;
}
// Show agenda tab
if (! empty($conf->agenda->enabled))
{
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
$head[$h][1] = $langs->trans('Agenda');
$head[$h][2] = 'agenda';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
@ -87,7 +78,7 @@ function member_prepare_head(Adherent $object)
// Attachments
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,1,$object,'member').'/'.dol_sanitizeFileName($object->ref);
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0,0,0,1,$object,'member');
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
@ -96,12 +87,20 @@ function member_prepare_head(Adherent $object)
$head[$h][2] = 'document';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
// Show agenda tab
if (! empty($conf->agenda->enabled))
{
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
$head[$h][1] = $langs->trans("Events");
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$head[$h][1].= '/';
$head[$h][1].= $langs->trans("Agenda");
}
$head[$h][2] = 'agenda';
$h++;
}
complete_head_from_modules($conf,$langs,$object,$head,$h,'member','remove');
return $head;

View File

@ -23,7 +23,7 @@
/**
* \file htdocs/core/modules/member/doc/pdf_standard.class.php
* \ingroup member
* \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise
* \brief File of class to generate PDF document of labels
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php';
@ -63,7 +63,7 @@ class pdf_standard extends CommonStickerGenerator
*/
function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photo='')
{
global $mysoc,$conf,$langs;
global $db,$mysoc,$conf,$langs;
global $forceimgscalewidth,$forceimgscaleheight;
$imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
@ -92,11 +92,15 @@ class pdf_standard extends CommonStickerGenerator
}
}
$member=new Adherent($db);
$member->id = $idmember;
$member->ref = $idmember;
// Define photo
$dir=$conf->adherent->dir_output;
if (! empty($photo))
{
$file=get_exdir($idmember,2,0,0,null,'member').'photos/'.$photo;
$file=get_exdir(0,0,0,0,$member,'member').'photos/'.$photo;
$photo=$dir.'/'.$file;
if (! is_readable($photo)) $photo='';
}
@ -231,19 +235,79 @@ class pdf_standard extends CommonStickerGenerator
}
/**
* Function to build PDF on disk, then output on HTTP strem.
* Function to build PDF on disk, then output on HTTP stream.
*
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>)
* @param Adherent $object Member object. Old usage: Array of record informations (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $srctemplatepath Full path of source filename for generator using a template file. Example: '5161', 'AVERYC32010', 'CARD', ...
* @param string $mode Tell if doc module is called for 'member', ...
* @param int $nooutput 1=Generate only file on disk and do not return it on response
* @return int 1=OK, 0=KO
*/
function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$mode='member')
function write_file($object, $outputlangs, $srctemplatepath, $mode='member', $nooutput=0)
{
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
$this->code=$srctemplatepath;
if (is_object($object))
{
if ($object->country == '-') $object->country='';
// List of values to scan for a replacement
$substitutionarray = array (
'%ID%'=>$object->rowid,
'%LOGIN%'=>$object->login,
'%FIRSTNAME%'=>$object->firstname,
'%LASTNAME%'=>$object->lastname,
'%FULLNAME%'=>$object->getFullName($langs),
'%COMPANY%'=>$object->company,
'%ADDRESS%'=>$object->address,
'%ZIP%'=>$object->zip,
'%TOWN%'=>$object->town,
'%COUNTRY%'=>$object->country,
'%COUNTRY_CODE%'=>$object->country_code,
'%EMAIL%'=>$object->email,
'%BIRTH%'=>dol_print_date($object->birth,'day'),
'%TYPE%'=>$object->type,
'%YEAR%'=>$year,
'%MONTH%'=>$month,
'%DAY%'=>$day,
'%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT,
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
);
complete_substitutions_array($substitutionarray, $langs);
// For business cards
$textleft=make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
$textheader=make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
$textfooter=make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
$textright=make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
$nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY'];
if ($nb <= 0) $nb=1; // Protection to avoid empty page
for($j=0;$j<$nb;$j++)
{
$arrayofmembers[]=array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'id'=>$object->rowid,
'photo'=>$object->photo
);
}
$arrayofrecords = $arrayofmembers;
}
else
{
$arrayofrecords = $object;
}
//var_dump($arrayofrecords);exit;
$this->Tformat = $_Avery_Labels[$this->code];
if (empty($this->Tformat)) { dol_print_error('','ErrorBadTypeForCard'.$this->code); exit; }
$this->type = 'pdf';
@ -270,7 +334,6 @@ class pdf_standard extends CommonStickerGenerator
{
$title=$outputlangs->transnoentities('MembersCards');
$keywords=$outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name);
$outputdir=$conf->adherent->dir_temp;
}
else
{
@ -278,9 +341,21 @@ class pdf_standard extends CommonStickerGenerator
return -1;
}
$dir = $outputdir;
$filename = 'tmp_cards.pdf';
$file = $dir."/".$filename;
if (is_object($object))
{
$outputdir = $conf->adherent->dir_output;
$dir = $outputdir."/".get_exdir(0, 0, 0, 0, $object, 'member');
$file = $dir.'/'.$filename;
}
else
{
$outputdir = $conf->adherent->dir_temp;
$dir = $outputdir;
$file = $dir.'/'.$filename;
}
//var_dump($file);exit;
if (! file_exists($dir))
{
@ -344,23 +419,26 @@ class pdf_standard extends CommonStickerGenerator
// Output to http stream
clearstatcache();
$attachment=true;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
$type=dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($file);
if (empty($nooutput))
{
clearstatcache();
$attachment=true;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
$type=dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($file);
}
return 1;
}

View File

@ -48,7 +48,7 @@ class ModelePDFCards
{
global $conf;
$type='members_card';
$type='member';
$liste=array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -99,7 +99,7 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o
}
}
else $code=$modele;
// If selected modele is a filename template (then $modele="modelname:filename")
$tmp=explode(':',$template,2);
if (! empty($tmp[1]))

View File

@ -76,6 +76,13 @@ class modAdherent extends DolibarrModules
$this->const = array();
$r=0;
$this->const[$r][0] = "ADHERENT_ADDON_PDF";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "standard";
$this->const[$r][3] = 'Name of PDF model of member';
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_MAIL_RESIL";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt";
@ -333,4 +340,47 @@ class modAdherent extends DolibarrModules
$this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$');
$this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d'));
}
/**
* 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
*
* @param string $options Options when enabling module ('', 'newboxdefonly', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
global $conf,$langs;
// Permissions
$this->remove($options);
//ODT template
/*
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt';
$dirodt=DOL_DATA_ROOT.'/doctemplates/orders';
$dest=$dirodt.'/template_order.odt';
if (file_exists($src) && ! file_exists($dest))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_mkdir($dirodt);
$result=dol_copy($src,$dest,0,0);
if ($result < 0)
{
$langs->load("errors");
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
return 0;
}
}*/
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type='member' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','member',".$conf->entity.")"
);
return $this->_init($sql,$options);
}
}

View File

@ -249,7 +249,7 @@ class modCommande extends DolibarrModules
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'order' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order',".$conf->entity.")"
);

View File

@ -157,7 +157,7 @@ class modDon extends DolibarrModules
global $conf;
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'donation' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','donation',".$conf->entity.")",
);

View File

@ -318,9 +318,9 @@ class modExpedition extends DolibarrModules
$sql = array();
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'shipping' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','shipping',".$conf->entity.")",
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[3][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[3][2]."' AND type = 'delivery' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[3][2]."','delivery',".$conf->entity.")",
);

View File

@ -218,7 +218,6 @@ class modExpenseReport extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON ed.fk_projet = p.rowid';
$this->export_sql_end[$r] .=' WHERE ed.fk_expensereport = d.rowid AND d.fk_user_author = u.rowid';
$this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('expensereport',1).')';
}
/**
@ -237,7 +236,7 @@ class modExpenseReport extends DolibarrModules
$this->remove($options);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard' AND type='expensereport' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard','expensereport',".$conf->entity.")"
);

View File

@ -293,7 +293,7 @@ class modFacture extends DolibarrModules
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'invoice' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")"
);

View File

@ -194,7 +194,7 @@ class modFicheinter extends DolibarrModules
$this->remove($options);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'ficheinter' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','ficheinter',".$conf->entity.")",
);

View File

@ -572,7 +572,7 @@ class modFournisseur extends DolibarrModules
$this->remove($options);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'order_supplier' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order_supplier',".$conf->entity.")",
);

View File

@ -153,7 +153,7 @@ class modPrelevement extends DolibarrModules
$this->remove($options);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'bankaccount' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','bankaccount',".$conf->entity.")",
);

View File

@ -377,13 +377,13 @@ class modProjet extends DolibarrModules
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")"
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'project' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','project',".$conf->entity.")",
);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','project',".$conf->entity.")",
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[3][2]."' AND type = 'task' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[3][2]."','task',".$conf->entity.")"
);
return $this->_init($sql,$options);

View File

@ -241,7 +241,7 @@ class modPropale extends DolibarrModules
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'propal' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','propal',".$conf->entity.")",
);

View File

@ -227,7 +227,7 @@ class modSupplierProposal extends DolibarrModules
}
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'supplier_proposal' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','supplier_proposal',".$conf->entity.")",
);

View File

@ -756,9 +756,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Add entry in event table
$now=dol_now();
if (isset($_SESSION['listofnames']))
if (isset($_SESSION['listofnames-'.$object->trackid]))
{
$attachs=$_SESSION['listofnames'];
$attachs=$_SESSION['listofnames-'.$object->trackid];
if ($attachs && strpos($action,'SENTBYMAIL'))
{
$object->actionmsg=dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);

View File

@ -551,6 +551,7 @@ if (empty($reshook))
$trigger_name='SHIPPING_SENTBYMAIL';
$paramname='id';
$mode='emailfromshipment';
$trackid='shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}

View File

@ -766,6 +766,7 @@ if (empty($reshook))
$trigger_name='FICHINTER_SENTBYMAIL';
$paramname='id';
$mode='emailfromintervention';
$trackid='int'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';

View File

@ -1159,6 +1159,7 @@ if (empty($reshook))
$trigger_name='ORDER_SUPPLIER_SENTBYMAIL';
$paramname='id';
$mode='emailfromsupplierorder';
$trackid='sor'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';

View File

@ -1151,6 +1151,7 @@ if (empty($reshook))
$trigger_name='BILL_SUPPLIER_SENTBYMAIL';
$paramname='id';
$mode='emailfromsupplierinvoice';
$trackid='sin'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';

View File

@ -27,6 +27,8 @@ ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1;
UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL;
ALTER TABLE llx_adherent ADD COLUMN model_pdf varchar(255);
ALTER TABLE llx_don ADD COLUMN date_valid datetime;
DELETE FROM llx_menu where module='expensereport';

View File

@ -57,6 +57,7 @@ create table llx_adherent
datefin datetime, -- date de fin de validite de la cotisation
note_private text DEFAULT NULL,
note_public text DEFAULT NULL,
model_pdf varchar(255),
datevalid datetime, -- date de validation
datec datetime, -- date de creation
tms timestamp, -- date de modification

View File

@ -712,6 +712,7 @@ if (empty($reshook))
$trigger_name='COMPANY_SENTBYMAIL';
$paramname='socid';
$mode='emailfromthirdparty';
$trackid='thi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Actions to build doc

View File

@ -475,6 +475,7 @@ if (empty($reshook))
$trigger_name='SUPPLIER_PROPOSAL_SENTBYMAIL';
$paramname='id';
$mode='emailfromsupplierproposal';
$trackid='spr'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';