Merge remote-tracking branch 'Dolibarr/develop' into develop
@ -52,6 +52,36 @@ Replace call to serialize_val with no bugged value
|
||||
|
||||
TCPDF:
|
||||
------
|
||||
* Replace in tcpdf.php:
|
||||
|
||||
if (isset($this->imagekeys)) {
|
||||
foreach($this->imagekeys as $file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
with
|
||||
|
||||
if (isset($this->imagekeys)) {
|
||||
foreach($this->imagekeys as $file) {
|
||||
// unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace
|
||||
|
||||
if (strpos($filename, '://') === false) {
|
||||
|
||||
with
|
||||
|
||||
if (strpos($filename, '//') === 0)
|
||||
{
|
||||
// Share folder on a (windows) server
|
||||
// e.g.: "//[MyServerName]/[MySharedFolder]/"
|
||||
//
|
||||
// nothing to change
|
||||
}
|
||||
elseif (strpos($filename, '://') === false)
|
||||
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
|
||||
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
BIN
dev/initdemo/documents_demo/societe/12/courrier_consult.odt
Normal file
BIN
dev/initdemo/documents_demo/societe/12/logos/person8.jpeg
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
BIN
dev/initdemo/documents_demo/societe/12/radiography1.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
dev/initdemo/documents_demo/societe/12/radiography2-knee.jpg
Normal file
|
After Width: | Height: | Size: 8.7 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 991 KiB After Width: | Height: | Size: 117 KiB |
7066
dev/initdemo/mysqldump_dolibarr_3.5.0.sql
Normal file
@ -245,18 +245,6 @@ export list="
|
||||
--ignore-table=$base.llx_c_ticketsup_category
|
||||
--ignore-table=$base.llx_c_ticketsup_severity
|
||||
--ignore-table=$base.llx_c_ticketsup_type
|
||||
--ignore-table=$base.llx_cabinetmed_c_banques
|
||||
--ignore-table=$base.llx_cabinetmed_c_ccam
|
||||
--ignore-table=$base.llx_cabinetmed_c_examconclusion
|
||||
--ignore-table=$base.llx_cabinetmed_cons
|
||||
--ignore-table=$base.llx_cabinetmed_cons_extrafields
|
||||
--ignore-table=$base.llx_cabinetmed_diaglec
|
||||
--ignore-table=$base.llx_cabinetmed_examaut
|
||||
--ignore-table=$base.llx_cabinetmed_exambio
|
||||
--ignore-table=$base.llx_cabinetmed_examenprescrit
|
||||
--ignore-table=$base.llx_cabinetmed_motifcons
|
||||
--ignore-table=$base.llx_cabinetmed_patient
|
||||
--ignore-table=$base.llx_cabinetmed_societe
|
||||
--ignore-table=$base.llx_congespayes
|
||||
--ignore-table=$base.llx_congespayes_config
|
||||
--ignore-table=$base.llx_congespayes_events
|
||||
@ -300,6 +288,7 @@ export list="
|
||||
--ignore-table=$base.llx_m_extrafields
|
||||
--ignore-table=$base.llx_monmodule_abcdef
|
||||
--ignore-table=$base.llx_notes
|
||||
--ignore-table=$base.llx_packages
|
||||
--ignore-table=$base.llx_pos_cash
|
||||
--ignore-table=$base.llx_pos_control_cash
|
||||
--ignore-table=$base.llx_pos_facture
|
||||
@ -316,6 +305,7 @@ export list="
|
||||
--ignore-table=$base.llx_residence_building
|
||||
--ignore-table=$base.llx_residence_building_links
|
||||
--ignore-table=$base.llx_societe_rib2
|
||||
--ignore-table=$base.llx_sellyoursaas_cancellation
|
||||
--ignore-table=$base.llx_ticketsup
|
||||
--ignore-table=$base.llx_ultimatepdf
|
||||
--ignore-table=$base.llx_update_modules
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
# Usage: txpull.sh (all|xx_XX) [-r dolibarr.file] [-f]
|
||||
#------------------------------------------------------
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
cd $DIR/../..
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" = "x" ]
|
||||
then
|
||||
|
||||
@ -9,6 +9,9 @@
|
||||
|
||||
export project='dolibarr'
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
cd $DIR/../..
|
||||
|
||||
# Syntax
|
||||
if [ "x$1" = "x" ]
|
||||
then
|
||||
|
||||
@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "bills", "members", "users", "other"));
|
||||
$langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal"));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
@ -822,7 +822,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name = 'MEMBER_SENTBYMAIL';
|
||||
$triggersendname = 'MEMBER_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$mode = 'emailfrommember';
|
||||
$trackid = 'mem'.$object->id;
|
||||
@ -1072,16 +1072,10 @@ else
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
|
||||
//Hooks here
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '<tbody>';
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
@ -1769,7 +1763,7 @@ else
|
||||
|
||||
|
||||
/*
|
||||
* Hotbar
|
||||
* Action bar
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
@ -412,7 +412,7 @@ if ($user->rights->adherent->creer)
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
|
||||
@ -71,7 +71,6 @@ $adht = new AdherentType($db);
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
$errmsg = '';
|
||||
$errmsgs = array();
|
||||
|
||||
$defaultdelay = 1;
|
||||
$defaultdelayunit = 'y';
|
||||
@ -398,7 +397,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
|
||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n";
|
||||
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1, '', $moreinheader);
|
||||
$result = $object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofmimes, $listofnames, "", "", 0, -1, '', $moreinheader);
|
||||
if ($result < 0)
|
||||
{
|
||||
$errmsg = $object->error;
|
||||
@ -687,20 +686,19 @@ if ($rowid > 0)
|
||||
$subscriptionstatic = new Subscription($db);
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'c.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td class="center">'.$langs->trans("DateCreation").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="center">'.$langs->trans("DateStart").'</td>';
|
||||
print '<td class="center">'.$langs->trans("DateEnd").'</td>';
|
||||
print '<td class="right">'.$langs->trans("Amount").'</td>';
|
||||
print_liste_field_titre('DateCreation', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td class="right">'.$langs->trans("Account").'</td>';
|
||||
print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
@ -708,6 +706,7 @@ if ($rowid > 0)
|
||||
$adh = new Adherent($db);
|
||||
$adht = new AdherentType($db);
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
@ -766,6 +765,13 @@ if ($rowid > 0)
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (empty($num)) {
|
||||
$colspan = 6;
|
||||
if (!empty($conf->banque->enabled)) $colspan++;
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
@ -1002,7 +1008,7 @@ if ($rowid > 0)
|
||||
print $langs->trans("CreateDolibarrThirdParty");
|
||||
print '</a>)';
|
||||
}
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0);
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled)))
|
||||
{
|
||||
$prodtmp = new Product($db);
|
||||
@ -1027,7 +1033,7 @@ if ($rowid > 0)
|
||||
print $langs->trans("CreateDolibarrThirdParty");
|
||||
print '</a>)';
|
||||
}
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0);
|
||||
if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. <span class="opacitymedium">'.$langs->trans("NoVatOnSubscription", 0).'</span>';
|
||||
if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled)))
|
||||
{
|
||||
$prodtmp = new Product($db);
|
||||
@ -1070,9 +1076,9 @@ if ($rowid > 0)
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr><td colspan="2"> </td>';
|
||||
print '<tr><td></td><td></td></tr>';
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("SendAcknowledgementByMail").'</td>';
|
||||
print '<tr><td>'.$langs->trans("SendAcknowledgementByMail").'</td>';
|
||||
print '<td>';
|
||||
if (!$object->email)
|
||||
{
|
||||
@ -1117,11 +1123,20 @@ if ($rowid > 0)
|
||||
$helpcontent .= '<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailRecipient").'</b>: '.$object->email.'<br>'."\n";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailTopic").'</b>:<br>'."\n";
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
if ($subjecttosend) {
|
||||
$helpcontent .= $subjecttosend."\n";
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
|
||||
}
|
||||
$helpcontent .= "<br>";
|
||||
$helpcontent .= '<b>'.$langs->trans("MailText").'</b>:<br>';
|
||||
$helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
|
||||
|
||||
if ($texttosend) {
|
||||
$helpcontent .= dol_htmlentitiesbr($texttosend)."\n";
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$helpcontent .= '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Module310Name")).'</span>'."\n";
|
||||
}
|
||||
print $form->textwithpicto($tmp, $helpcontent, 1, 'help', '', 0, 2, 'helpemailtosend');
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -95,7 +95,7 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
||||
// Actions to send emails
|
||||
$id = 0;
|
||||
$actiontypecode = ''; // Not an event for agenda
|
||||
$trigger_name = ''; // Disable triggers
|
||||
$triggersendname = ''; // Disable triggers
|
||||
$paramname = 'id';
|
||||
$mode = 'emailfortest';
|
||||
$trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
|
||||
@ -77,7 +77,7 @@ if ($action == 'update' && empty($_POST["cancel"]))
|
||||
// Actions to send emails
|
||||
$id=0;
|
||||
$actiontypecode=''; // Not an event for agenda
|
||||
$trigger_name=''; // Disable triggers
|
||||
$triggersendname = ''; // Disable triggers
|
||||
$paramname='id';
|
||||
$mode='emailfortest';
|
||||
$trackid=(($action == 'testhtml')?"testhtml":"test");
|
||||
|
||||
@ -97,7 +97,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name = 'ASSET_SENTBYMAIL';
|
||||
$triggersendname = 'ASSET_SENTBYMAIL';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_ASSET_TO';
|
||||
$trackid = 'asset'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
@ -46,7 +46,7 @@ function blockedlogadmin_prepare_head()
|
||||
$b=new BlockedLog($db);
|
||||
if ($b->alreadyUsed())
|
||||
{
|
||||
$head[$h][1].=' <span class="badge">...</span>';
|
||||
$head[$h][1].='<span class="badge marginleftonlyshort">...</span>';
|
||||
}
|
||||
$head[$h][2] = 'fingerprints';
|
||||
$h++;
|
||||
|
||||
@ -119,7 +119,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name = 'BOM_SENTBYMAIL';
|
||||
$triggersendname = 'BOM_SENTBYMAIL';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_BOM_TO';
|
||||
$trackid = 'bom'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
@ -146,6 +146,11 @@ if (empty($reshook))
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($object->fk_product == $idprod) {
|
||||
setEventMessages($langs->trans('TheProductXIsAlreadyTheProductToProduce'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$bomline = new BOMLine($db);
|
||||
|
||||
@ -992,7 +992,7 @@ class BOM extends CommonObject
|
||||
/**
|
||||
* Class for BOMLine
|
||||
*/
|
||||
class BOMLine extends CommonObject
|
||||
class BOMLine extends CommonObjectLine
|
||||
{
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
@ -1051,7 +1051,7 @@ class BOMLine extends CommonObject
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'),
|
||||
'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'),
|
||||
//'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'),
|
||||
//'efficiency' => array('type'=>'double(24,8)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -50,10 +50,10 @@ $objectline = new BOMLine($this->db);
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
|
||||
|
||||
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
|
||||
$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
|
||||
if ($nolinesbefore) {
|
||||
print '<tr class="liste_titre'.($nolinesbefore?'':' liste_titre_add_').' nodrag nodrop">';
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
print '<td class="linecolnum center"></td>';
|
||||
}
|
||||
print '<td class="linecoldescription minwidth500imp">';
|
||||
@ -74,11 +74,11 @@ if ($nolinesbefore) {
|
||||
print '<td class="linecoledit" colspan="'.$colspan.'"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr class="pair nodrag nodrop nohoverpair'.($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'.'">';
|
||||
$coldisplay=0;
|
||||
print '<tr class="pair nodrag nodrop nohoverpair'.($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create'.'">';
|
||||
$coldisplay = 0;
|
||||
|
||||
// Adds a line numbering column
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||
$coldisplay++;
|
||||
echo '<td class="bordertop nobottom linecolnum center"></td>';
|
||||
}
|
||||
@ -87,15 +87,15 @@ $coldisplay++;
|
||||
print '<td class="bordertop nobottom linecoldescription minwidth500imp">';
|
||||
|
||||
// Predefined product/service
|
||||
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
|
||||
{
|
||||
if ($forceall >= 0 && $freelines) echo '<br>';
|
||||
echo '<span class="prod_entry_mode_predef">';
|
||||
$filtertype='';
|
||||
if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1';
|
||||
$filtertype = '';
|
||||
if (!empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype = '1';
|
||||
|
||||
$statustoshow = -1;
|
||||
if (! empty($conf->global->ENTREPOT_EXTRA_STATUS))
|
||||
if (!empty($conf->global->ENTREPOT_EXTRA_STATUS))
|
||||
{
|
||||
// hide products in closed warehouse, but show products for internal transfer
|
||||
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
|
||||
@ -109,10 +109,10 @@ if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1).'">';
|
||||
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(isset($_POST["qty"]) ?GETPOST("qty", 'alpha', 2) : 1).'">';
|
||||
print '</td>';
|
||||
|
||||
if($conf->global->PRODUCT_USE_UNITS)
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$coldisplay++;
|
||||
print '<td class="nobottom linecoluseunit left">';
|
||||
@ -121,11 +121,11 @@ if($conf->global->PRODUCT_USE_UNITS)
|
||||
}
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"'.(GETPOST("qty_frozen", 'alpha')?' checked="checked"':'').'>';
|
||||
print '<td class="bordertop nobottom linecolqtyfrozen right"><input type="checkbox" name="qty_frozen" id="qty_frozen" class="flat right" value="1"'.(GETPOST("qty_frozen", 'alpha') ? ' checked="checked"' : '').'>';
|
||||
print '</td>';
|
||||
|
||||
$coldisplay++;
|
||||
print '<td class="bordertop nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOST("disable_stock_change", 'alpha')?' checked="checked"':'').'">';
|
||||
print '<td class="bordertop nobottom linecoldisablestockchange right"><input type="checkbox" name="disable_stock_change" id="disable_stock_change" class="flat right" value="1"'.(GETPOST("disable_stock_change", 'alpha') ? ' checked="checked"' : '').'">';
|
||||
print '</td>';
|
||||
|
||||
//$coldisplay++;
|
||||
|
||||
@ -72,6 +72,7 @@ $coldisplay++;
|
||||
$tmpproduct = new Product($object->db);
|
||||
$tmpproduct->fetch($line->fk_product);
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print ' - '.$tmpproduct->label;
|
||||
print '</td>';
|
||||
print '<td class="linecolqty nowrap right">';
|
||||
$coldisplay++;
|
||||
|
||||
@ -372,7 +372,7 @@ if ($type == Categorie::TYPE_PRODUCT)
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>';
|
||||
print $langs->trans("AddProductServiceIntoCategory").' ';
|
||||
print $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1);
|
||||
$form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -1052,7 +1052,7 @@ if ($action == 'create')
|
||||
|
||||
$numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$societe->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
$urloption = '?action=create';
|
||||
$url = dol_buildpath('comm/action/card.php', 2).$urloption;
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ class AgendaEvents extends DolibarrApi
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) {
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->read) {
|
||||
throw new RestException(401, "Insufficient rights to read an event");
|
||||
}
|
||||
if ($id == 0) {
|
||||
@ -75,15 +75,15 @@ class AgendaEvents extends DolibarrApi
|
||||
$this->actioncomm->fetchObjectLinked();
|
||||
}
|
||||
}
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Agenda Events not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->ownerid != DolibarrApiAccess::$user->id) {
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->allactions->read && $this->actioncomm->userownerid != DolibarrApiAccess::$user->id) {
|
||||
throw new RestException(401, "Insufficient rights to read event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {
|
||||
if (!DolibarrApi::_checkAccessToResource('agenda', $this->actioncomm->id, 'actioncomm', '', 'fk_soc', 'id')) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
return $this->_cleanObjectDatas($this->actioncomm);
|
||||
@ -108,30 +108,30 @@ class AgendaEvents extends DolibarrApi
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->myactions->read) {
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->read) {
|
||||
throw new RestException(401, "Insufficient rights to read events");
|
||||
}
|
||||
|
||||
// case of external user
|
||||
$socid = 0;
|
||||
if (! empty(DolibarrApiAccess::$user->socid)) $socid = DolibarrApiAccess::$user->socid;
|
||||
if (!empty(DolibarrApiAccess::$user->socid)) $socid = DolibarrApiAccess::$user->socid;
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (empty($conf->societe->enabled)) $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (empty($conf->societe->enabled)) $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists
|
||||
|
||||
$sql = "SELECT t.id as rowid";
|
||||
if (! empty($conf->societe->enabled))
|
||||
if (!empty($conf->societe->enabled))
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t";
|
||||
if (! empty($conf->societe->enabled))
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('agenda').')';
|
||||
if (! empty($conf->societe->enabled))
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")";
|
||||
if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as t";
|
||||
if (!empty($conf->societe->enabled))
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('agenda').')';
|
||||
if (!empty($conf->societe->enabled))
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($user_ids) $sql .= " AND t.fk_user_action IN (".$user_ids.")";
|
||||
if ($socid > 0) $sql .= " AND t.fk_soc = ".$socid;
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
@ -140,30 +140,30 @@ class AgendaEvents extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$i=0;
|
||||
$i = 0;
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
while ($i < $min)
|
||||
@ -179,7 +179,7 @@ class AgendaEvents extends DolibarrApi
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve Agenda Event list : '.$db->lasterror());
|
||||
}
|
||||
if ( ! count($obj_ret)) {
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No Agenda Event found');
|
||||
}
|
||||
return $obj_ret;
|
||||
@ -193,17 +193,17 @@ class AgendaEvents extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->myactions->create) {
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->create) {
|
||||
throw new RestException(401, "Insufficient rights to create your Agenda Event");
|
||||
}
|
||||
if (! DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->allactions->create && DolibarrApiAccess::$user->id != $request_data['userownerid']) {
|
||||
throw new RestException(401, "Insufficient rights to create an Agenda Event for owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
}
|
||||
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->actioncomm->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
@ -273,7 +273,7 @@ class AgendaEvents extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->agenda->myactions->delete) {
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->myactions->delete) {
|
||||
throw new RestException(401, "Insufficient rights to delete your Agenda Event");
|
||||
}
|
||||
|
||||
@ -284,19 +284,19 @@ class AgendaEvents extends DolibarrApi
|
||||
$this->actioncomm->oldcopy = clone $this->actioncomm;
|
||||
}
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) {
|
||||
if (!DolibarrApiAccess::$user->rights->agenda->allactions->delete && DolibarrApiAccess::$user->id != $this->actioncomm->userownerid) {
|
||||
throw new RestException(401, "Insufficient rights to delete an Agenda Event of owner id ".$request_data['userownerid'].' Your id is '.DolibarrApiAccess::$user->id);
|
||||
}
|
||||
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Agenda Event not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('actioncomm', $this->actioncomm->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( ! $this->actioncomm->delete(DolibarrApiAccess::$user)) {
|
||||
if (!$this->actioncomm->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when delete Agenda Event : '.$this->actioncomm->error);
|
||||
}
|
||||
|
||||
@ -338,7 +338,7 @@ class AgendaEvents extends DolibarrApi
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->note); // alreaydy into note_private
|
||||
unset($object->note); // alreaydy into note_private
|
||||
unset($object->usermod);
|
||||
unset($object->libelle);
|
||||
unset($object->context);
|
||||
|
||||
@ -37,7 +37,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("users", "companies", "agenda", "commercial"));
|
||||
$langs->loadLangs(array("users", "companies", "agenda", "commercial", "other"));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
|
||||
|
||||
@ -695,7 +695,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
@ -780,7 +780,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
//if($num2 > 0) print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
|
||||
//else print '<td width="20px" class="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
|
||||
@ -856,7 +856,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
@ -921,7 +921,7 @@ if ($object->id > 0)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
|
||||
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
//print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
@ -990,7 +990,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").'<span class="badge marginleftonlyshort">'.$num.'</span></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
@ -1063,7 +1063,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1168,7 +1168,7 @@ if ($object->id > 0)
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -251,7 +251,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
|
||||
print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
@ -333,7 +333,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftOrders").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
|
||||
print '<th colspan="3">'.$langs->trans("DraftOrders").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
@ -422,7 +422,7 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande-
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftSuppliersOrders").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
|
||||
print '<th colspan="3">'.$langs->trans("DraftSuppliersOrders").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
|
||||
@ -781,7 +781,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to send emails
|
||||
$actiontypecode = 'AC_OTH_AUTO';
|
||||
$trigger_name = 'PROPAL_SENTBYMAIL';
|
||||
$triggersendname = 'PROPAL_SENTBYMAIL';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_PROPOSAL_TO';
|
||||
$trackid = 'pro'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
@ -1475,9 +1475,10 @@ if ($action == 'create')
|
||||
{
|
||||
// Parse element/subelement (ex: project_task)
|
||||
$element = $subelement = $origin;
|
||||
$regs = array();
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
||||
$element = $regs [1];
|
||||
$subelement = $regs [2];
|
||||
$element = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
if ($element == 'project') {
|
||||
@ -1588,7 +1589,7 @@ if ($action == 'create')
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
@ -1675,7 +1676,7 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td>';
|
||||
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -2501,11 +2501,11 @@ class Propal extends CommonObject
|
||||
if ($resql)
|
||||
{
|
||||
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->modelpdf;
|
||||
$trigger_name = 'PROPAL_CLOSE_REFUSED';
|
||||
$triggerName = 'PROPAL_CLOSE_REFUSED';
|
||||
|
||||
if ($statut == self::STATUS_SIGNED)
|
||||
{
|
||||
$trigger_name = 'PROPAL_CLOSE_SIGNED';
|
||||
$triggerName = 'PROPAL_CLOSE_SIGNED';
|
||||
$modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->modelpdf;
|
||||
|
||||
// The connected company is classified as a client
|
||||
@ -2522,7 +2522,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
if ($statut == self::STATUS_BILLED) // Why this ?
|
||||
{
|
||||
$trigger_name = 'PROPAL_CLASSIFY_BILLED';
|
||||
$triggerName = 'PROPAL_CLASSIFY_BILLED';
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
@ -2550,7 +2550,7 @@ class Propal extends CommonObject
|
||||
if (!$notrigger && empty($error))
|
||||
{
|
||||
// Call trigger
|
||||
$result = $this->call_trigger($trigger_name, $user);
|
||||
$result = $this->call_trigger($triggerName, $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
@ -61,11 +61,13 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
//if ($user->rights->societe->creer)
|
||||
//if ($user->rights->facture->creer)
|
||||
|
||||
$amount_ttc_1 = GETPOST('amount_ttc_1');
|
||||
$amount_ttc_2 = GETPOST('amount_ttc_2');
|
||||
$amount_ttc_1 = GETPOST('amount_ttc_1', 'alpha');
|
||||
$amount_ttc_1 = price2num($amount_ttc_1);
|
||||
$amount_ttc_2 = GETPOST('amount_ttc_2', 'alpha');
|
||||
$amount_ttc_2 = price2num($amount_ttc_2);
|
||||
|
||||
$error = 0;
|
||||
$remid = GETPOST("remid") ?GETPOST("remid") : 0;
|
||||
$remid = (GETPOST("remid", 'int') ? GETPOST("remid", 'int') : 0);
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$res = $discount->fetch($remid);
|
||||
if (!$res > 0)
|
||||
@ -250,7 +252,7 @@ if ($socid > 0)
|
||||
print '<input type="hidden" name="action" value="setremise">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
|
||||
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), 0, 'company');
|
||||
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), -1, 'company');
|
||||
|
||||
dol_banner_tab($object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
|
||||
@ -271,7 +273,7 @@ if ($socid > 0)
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent tableforfield borderbottom">';
|
||||
|
||||
if ($isCustomer) { // Calcul avoirs client en cours
|
||||
$remise_all = $remise_user = 0;
|
||||
@ -340,13 +342,15 @@ if ($socid > 0)
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewGlobalDiscount"), '', '');
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
if ($isCustomer && !$isSupplier) {
|
||||
print '<input type="hidden" name="discount_type" value="0" />';
|
||||
@ -356,6 +360,8 @@ if ($socid > 0)
|
||||
print '<input type="hidden" name="discount_type" value="1" />';
|
||||
}
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
if ($isCustomer && $isSupplier) {
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('DiscountType').'</td>';
|
||||
@ -374,9 +380,9 @@ if ($socid > 0)
|
||||
print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc', 'none').'"></td></tr>';
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
@ -402,7 +408,7 @@ if ($socid > 0)
|
||||
|
||||
|
||||
/*
|
||||
* Liste remises fixes client restant en cours (= liees a aucune facture ni ligne de facture)
|
||||
* List remises fixes client restant en cours (= liees a aucune facture ni ligne de facture)
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("DiscountStillRemaining"));
|
||||
@ -509,15 +515,14 @@ if ($socid > 0)
|
||||
{
|
||||
print '<td class="right">'.price($obj->multicurrency_amount_ttc).'</td>';
|
||||
}
|
||||
print '<td align="center">';
|
||||
print '<td class="center">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.'</a>';
|
||||
print '</td>';
|
||||
if ($user->rights->societe->creer || $user->rights->facture->creer)
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||
//print ' ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||
print '<a class="reposition marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
@ -533,7 +538,9 @@ if ($socid > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
@ -549,7 +556,7 @@ if ($socid > 0)
|
||||
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
|
||||
);
|
||||
$langs->load("dict");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, '', 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -670,9 +677,8 @@ if ($socid > 0)
|
||||
if ($user->rights->societe->creer || $user->rights->facture->creer)
|
||||
{
|
||||
print '<td class="center nowrap">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||
//print ' ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=split&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).'</a>';
|
||||
print '<a class="reposition marginleftonly" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=remove&remid='.$obj->rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
else print '<td> </td>';
|
||||
@ -688,7 +694,9 @@ if ($socid > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
print "</table>";
|
||||
@ -699,9 +707,9 @@ if ($socid > 0)
|
||||
$amount1 = price2num($showconfirminfo['amount_ttc'] / 2, 'MT');
|
||||
$amount2 = ($showconfirminfo['amount_ttc'] - $amount1);
|
||||
$formquestion = array(
|
||||
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
|
||||
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
|
||||
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
|
||||
'text' => $langs->trans('TypeAmountOfEachNewDiscount'),
|
||||
array('type' => 'text', 'name' => 'amount_ttc_1', 'label' => $langs->trans("AmountTTC").' 1', 'value' => $amount1, 'size' => '5'),
|
||||
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
|
||||
);
|
||||
$langs->load("dict");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
|
||||
@ -736,7 +744,7 @@ if ($socid > 0)
|
||||
|
||||
// Discount linked to invoice lines
|
||||
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,";
|
||||
$sql .= " rc.fk_facture_source,";
|
||||
$sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,";
|
||||
$sql .= " u.login, u.rowid as user_id,";
|
||||
$sql .= " f.rowid as invoiceid, f.ref,";
|
||||
$sql .= " fa.ref as invoice_source_ref, fa.type as type";
|
||||
@ -888,7 +896,9 @@ if ($socid > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
@ -1062,7 +1072,9 @@ if ($socid > 0)
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
$colspan = 8;
|
||||
if (!empty($conf->multicurrency->enabled)) $colspan+=2;
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -1415,7 +1415,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name = 'ORDER_SENTBYMAIL';
|
||||
$triggersendname = 'ORDER_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add
|
||||
$trackid = 'ord'.$object->id;
|
||||
@ -1642,7 +1642,7 @@ if ($action == 'create' && $usercancreate)
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
@ -1734,7 +1734,7 @@ if ($action == 'create' && $usercancreate)
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Project").'</td><td>';
|
||||
$numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ if (empty($reshook))
|
||||
$permissiontoread = $user->rights->commande->lire;
|
||||
$permissiontodelete = $user->rights->commande->supprimer;
|
||||
$uploaddir = $conf->commande->multidir_output[$conf->entity];
|
||||
$trigger_name = 'ORDER_SENTBYMAIL';
|
||||
$triggersendname = 'ORDER_SENTBYMAIL';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -354,7 +354,7 @@ if ($action == 'create')
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||
print '<td><input size="30" type="text" class="flat" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
|
||||
print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(GETPOST("label", 'alpha')).'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
@ -375,7 +375,7 @@ if ($action == 'create')
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
|
||||
print '<td>';
|
||||
print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos));
|
||||
print $form->selectarray("clos", $object->status, (GETPOST("clos", 'int') != '' ?GETPOST("clos", 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
@ -412,7 +412,7 @@ if ($action == 'create')
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled)
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Categories").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
|
||||
|
||||
$arrayselected = array();
|
||||
@ -429,7 +429,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Comment
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
|
||||
print '<tr><td>'.$langs->trans("Comment").'</td>';
|
||||
print '<td>';
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -476,31 +476,32 @@ if ($action == 'create')
|
||||
|
||||
// If bank account
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
|
||||
print '<td><input size="30" type="text" class="flat" name="bank" value="'.(GETPOST('bank') ?GETPOST('bank', 'alpha') : $object->bank).'"></td>';
|
||||
print '<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST('bank') ?GETPOST('bank', 'alpha') : $object->bank).'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$sizecss = '';
|
||||
foreach ($object->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$sizecss = 'minwidth100';
|
||||
$content = $object->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$sizecss = 'minwidth100';
|
||||
$content = $object->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$sizecss = 'minwidth200';
|
||||
$content = $object->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$sizecss = 'minwidth50';
|
||||
$content = $object->cle_rib;
|
||||
}
|
||||
|
||||
print '<td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.(GETPOST($name) ?GETPOST($name, 'alpha') : $content).'"></td>';
|
||||
print '<td><input type="text" class="flat '.$sizecss.'" name="'.$name.'" value="'.(GETPOST($name) ?GETPOST($name, 'alpha') : $content).'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$ibankey = FormBank::getIBANLabel($object);
|
||||
@ -509,22 +510,22 @@ if ($action == 'create')
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOST('iban') ?GETPOST('iban', 'alpha') : $object->iban).'"></td></tr>';
|
||||
print '<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOST('iban') ?GETPOST('iban', 'alpha') : $object->iban).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOST('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
|
||||
print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOST('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
|
||||
print (GETPOST('domiciliation') ?GETPOST('domiciliation') : $object->domiciliation);
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td><input size="30" type="text" class="flat" name="proprio" value="'.(GETPOST('proprio') ?GETPOST('proprio', 'alpha') : $object->proprio).'">';
|
||||
print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST('proprio') ?GETPOST('proprio', 'alpha') : $object->proprio).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.'">';
|
||||
print (GETPOST('owner_address') ?GETPOST('owner_address', 'alpha') : $object->owner_address);
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
@ -922,7 +923,7 @@ else
|
||||
$cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
|
||||
if (is_array($cats))
|
||||
{
|
||||
foreach($cats as $cat) {
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", "int");
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$result = restrictedArea($user, 'banque', '', '', '');
|
||||
|
||||
// Get parameters
|
||||
@ -74,50 +74,50 @@ include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans("VariousPayment") . ' - ' . $langs->trans("Documents");
|
||||
$title = $langs->trans("VariousPayment").' - '.$langs->trans("Documents");
|
||||
$help_url = '';
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$head=various_payment_prepare_head($object);
|
||||
$head = various_payment_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, $object->picto);
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.=$langs->trans('Project') . ' : ';
|
||||
$morehtmlref .= $langs->trans('Project').' : ';
|
||||
if ($user->rights->banque->modifier && 0)
|
||||
{
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.=$proj->getNomUrl(1);
|
||||
$morehtmlref .= $proj->getNomUrl(1);
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
$morehtmlref .= '</div>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ if ($sortorder) $param .= '&sortorder='.$sortorder;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
@ -1387,7 +1387,7 @@ if (empty($reshook))
|
||||
if (empty($amount)) continue;
|
||||
|
||||
$arraylist = array('amount' => 'FixAmount', 'variable' => 'VarAmount');
|
||||
$descline = $langs->trans('Deposit');
|
||||
$descline = '(DEPOSIT)';
|
||||
//$descline.= ' - '.$langs->trans($arraylist[$typeamount]);
|
||||
if ($typeamount == 'amount') {
|
||||
$descline .= ' ('.price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')';
|
||||
@ -2481,7 +2481,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to send emails
|
||||
if (empty($id)) $id = $facid;
|
||||
$trigger_name = 'BILL_SENTBYMAIL';
|
||||
$triggersendname = 'BILL_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$autocopy = 'MAIN_MAIL_AUTOCOPY_INVOICE_TO';
|
||||
$trackid = 'inv'.$object->id;
|
||||
@ -2801,7 +2801,7 @@ if ($action == 'create')
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
if (!GETPOST('fac_rec', 'int')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddThirdParty").'</span><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
|
||||
if (!GETPOST('fac_rec', 'int')) print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
@ -3008,7 +3008,7 @@ if ($action == 'create')
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceFirstSituationAsk").'</label> ';
|
||||
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
@ -3016,7 +3016,7 @@ if ($action == 'create')
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp = '<input type="radio" name="type" id="radio_situation" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceSituationAsk").'</label> ';
|
||||
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
@ -3025,7 +3025,7 @@ if ($action == 'create')
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp = '<input type="radio" name="type" id="radio_replacement" value="0" disabled> ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceReplacement").'</label> ';
|
||||
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceReplacementDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>';
|
||||
@ -3114,7 +3114,7 @@ if ($action == 'create')
|
||||
if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
|
||||
else $tmp = '<input type="radio" name="type" id="radio_creditnote" value="2" > ';
|
||||
$text = '<label>'.$tmp.$langs->trans("InvoiceAvoir").'</label> ';
|
||||
$text .= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromThird").')</span> ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
print '</div></div>'."\n";
|
||||
@ -3211,7 +3211,6 @@ if ($action == 'create')
|
||||
$rwStyle = '';
|
||||
}
|
||||
|
||||
|
||||
$retained_warranty = GETPOST('retained_warranty', 'int');
|
||||
$retained_warranty = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
|
||||
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">'.$langs->trans('RetainedWarranty').'</td><td colspan="2">';
|
||||
@ -3260,7 +3259,7 @@ if ($action == 'create')
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
$numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"><span class="valignmiddle text-plus-circle">'.$langs->trans("AddProject").'</span><span class="fa fa-plus-circle valignmiddle"></span></a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -52,44 +52,44 @@ $show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'invoicetemplatelist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search
|
||||
|
||||
// Security check
|
||||
$id=(GETPOST('facid', 'int')?GETPOST('facid', 'int'):GETPOST('id', 'int'));
|
||||
$lineid=GETPOST('lineid', 'int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
$objecttype = 'facture_rec';
|
||||
if ($action == "create" || $action == "add") $objecttype = '';
|
||||
$result = restrictedArea($user, 'facture', $id, $objecttype);
|
||||
$projectid = GETPOST('projectid', 'int');
|
||||
|
||||
$search_ref=GETPOST('search_ref');
|
||||
$search_societe=GETPOST('search_societe');
|
||||
$search_montant_ht=GETPOST('search_montant_ht');
|
||||
$search_montant_vat=GETPOST('search_montant_vat');
|
||||
$search_montant_ttc=GETPOST('search_montant_ttc');
|
||||
$search_payment_mode=GETPOST('search_payment_mode');
|
||||
$search_payment_term=GETPOST('search_payment_term');
|
||||
$search_day=GETPOST('search_day', 'int');
|
||||
$search_year=GETPOST('search_year', 'int');
|
||||
$search_month=GETPOST('search_month', 'int');
|
||||
$search_day_date_when=GETPOST('search_day_date_when', 'int');
|
||||
$search_year_date_when=GETPOST('search_year_date_when', 'int');
|
||||
$search_month_date_when=GETPOST('search_month_date_when', 'int');
|
||||
$search_recurring=GETPOST('search_recurring', 'int');
|
||||
$search_frequency=GETPOST('search_frequency', 'alpha');
|
||||
$search_unit_frequency=GETPOST('search_unit_frequency', 'alpha');
|
||||
$search_status=GETPOST('search_status', 'int');
|
||||
$search_ref = GETPOST('search_ref');
|
||||
$search_societe = GETPOST('search_societe');
|
||||
$search_montant_ht = GETPOST('search_montant_ht');
|
||||
$search_montant_vat = GETPOST('search_montant_vat');
|
||||
$search_montant_ttc = GETPOST('search_montant_ttc');
|
||||
$search_payment_mode = GETPOST('search_payment_mode');
|
||||
$search_payment_term = GETPOST('search_payment_term');
|
||||
$search_day = GETPOST('search_day', 'int');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
$search_month = GETPOST('search_month', 'int');
|
||||
$search_day_date_when = GETPOST('search_day_date_when', 'int');
|
||||
$search_year_date_when = GETPOST('search_year_date_when', 'int');
|
||||
$search_month_date_when = GETPOST('search_month_date_when', 'int');
|
||||
$search_recurring = GETPOST('search_recurring', 'int');
|
||||
$search_frequency = GETPOST('search_frequency', 'alpha');
|
||||
$search_unit_frequency = GETPOST('search_unit_frequency', 'alpha');
|
||||
$search_status = GETPOST('search_status', 'int');
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='f.titre';
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
if (!$sortfield) $sortfield = 'f.titre';
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -206,40 +206,40 @@ llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-factur
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
$companystatic = new Societe($db);
|
||||
$invoicerectmp = new FactureRec($db);
|
||||
|
||||
$now = dol_now();
|
||||
$tmparray=dol_getdate($now);
|
||||
$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
|
||||
$tmparray = dol_getdate($now);
|
||||
$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
|
||||
|
||||
|
||||
/*
|
||||
* List mode
|
||||
*/
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
|
||||
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
|
||||
$sql.= " f.datec, f.tms,";
|
||||
$sql.= " f.fk_cond_reglement, f.fk_mode_reglement";
|
||||
$sql .= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
|
||||
$sql .= " f.datec, f.tms,";
|
||||
$sql .= " f.fk_cond_reglement, f.fk_mode_reglement";
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql.=preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql =preg_replace('/,\s*$/', '', $sql);
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
if (!$user->rights->societe->client->voir && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||
@ -317,7 +317,7 @@ if ($resql)
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
@ -333,126 +333,126 @@ if ($resql)
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Ref
|
||||
if (! empty($arrayfields['f.titre']['checked']))
|
||||
if (!empty($arrayfields['f.titre']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Thirpdarty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.total']['checked']))
|
||||
if (!empty($arrayfields['f.total']['checked']))
|
||||
{
|
||||
// Amount net
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.tva']['checked']))
|
||||
if (!empty($arrayfields['f.tva']['checked']))
|
||||
{
|
||||
// Amount Vat
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||
if (!empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
// Amount
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.fk_cond_reglement']['checked']))
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked']))
|
||||
{
|
||||
// Payment term
|
||||
print '<td class="liste_titre right">';
|
||||
print $form->select_conditions_paiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
|
||||
$form->select_conditions_paiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
|
||||
print "</td>";
|
||||
}
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
// Payment mode
|
||||
print '<td class="liste_titre right">';
|
||||
print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100');
|
||||
$form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['recurring']['checked']))
|
||||
if (!empty($arrayfields['recurring']['checked']))
|
||||
{
|
||||
// Recurring or not
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1);
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.frequency']['checked']))
|
||||
if (!empty($arrayfields['f.frequency']['checked']))
|
||||
{
|
||||
// Recurring or not
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.unit_frequency']['checked']))
|
||||
if (!empty($arrayfields['f.unit_frequency']['checked']))
|
||||
{
|
||||
// Frequency unit
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
||||
if (!empty($arrayfields['f.nb_gen_done']['checked']))
|
||||
{
|
||||
// Nb generation
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date invoice
|
||||
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
||||
if (!empty($arrayfields['f.date_last_gen']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||
$formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||
print '</td>';
|
||||
}
|
||||
// Date next generation
|
||||
if (! empty($arrayfields['f.date_when']['checked']))
|
||||
if (!empty($arrayfields['f.date_when']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre nowraponall" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
|
||||
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
|
||||
$formother->select_year($search_year_date_when?$search_year_date_when:-1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||
$formother->select_year($search_year_date_when ? $search_year_date_when : -1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['f.datec']['checked']))
|
||||
if (!empty($arrayfields['f.datec']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['f.tms']['checked']))
|
||||
if (!empty($arrayfields['f.tms']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked']))
|
||||
if (!empty($arrayfields['status']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$liststatus=array(
|
||||
$liststatus = array(
|
||||
0=>$langs->trans("Draft"),
|
||||
1=>$langs->trans("Active"),
|
||||
-1=>$langs->trans("Disabled"),
|
||||
@ -462,145 +462,145 @@ if ($resql)
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0, 'checkforselect', 1);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.total']['checked'])) print_liste_field_titre($arrayfields['f.total']['label'], $_SERVER['PHP_SELF'], "f.total", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.tva']['checked'])) print_liste_field_titre($arrayfields['f.tva']['label'], $_SERVER['PHP_SELF'], "f.tva", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['recurring']['checked'])) print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, 'class="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.frequency']['checked'])) print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.unit_frequency']['checked'])) print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.titre']['checked'])) print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total']['checked'])) print_liste_field_titre($arrayfields['f.total']['label'], $_SERVER['PHP_SELF'], "f.total", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.tva']['checked'])) print_liste_field_titre($arrayfields['f.tva']['label'], $_SERVER['PHP_SELF'], "f.tva", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_cond_reglement", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['recurring']['checked'])) print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, 'class="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.frequency']['checked'])) print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.unit_frequency']['checked'])) print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.nb_gen_done']['checked'])) print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.date_last_gen']['checked'])) print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.date_when']['checked'])) print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'nomaxwidthsearch ')."\n";
|
||||
if (!empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'nomaxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
if (empty($objp)) break;
|
||||
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->name=$objp->name;
|
||||
$companystatic->id = $objp->socid;
|
||||
$companystatic->name = $objp->name;
|
||||
|
||||
$invoicerectmp->id=$objp->id?$objp->id:$objp->facid;
|
||||
$invoicerectmp->frequency=$objp->frequency;
|
||||
$invoicerectmp->suspended=$objp->suspended;
|
||||
$invoicerectmp->unit_frequency=$objp->unit_frequency;
|
||||
$invoicerectmp->nb_gen_max=$objp->nb_gen_max;
|
||||
$invoicerectmp->nb_gen_done=$objp->nb_gen_done;
|
||||
$invoicerectmp->ref=$objp->title;
|
||||
$invoicerectmp->id = $objp->id ? $objp->id : $objp->facid;
|
||||
$invoicerectmp->frequency = $objp->frequency;
|
||||
$invoicerectmp->suspended = $objp->suspended;
|
||||
$invoicerectmp->unit_frequency = $objp->unit_frequency;
|
||||
$invoicerectmp->nb_gen_max = $objp->nb_gen_max;
|
||||
$invoicerectmp->nb_gen_done = $objp->nb_gen_done;
|
||||
$invoicerectmp->ref = $objp->title;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
if (! empty($arrayfields['f.titre']['checked']))
|
||||
if (!empty($arrayfields['f.titre']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $invoicerectmp->getNomUrl(1);
|
||||
print "</a>";
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (!empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="tdoverflowmax200">'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.total']['checked']))
|
||||
if (!empty($arrayfields['f.total']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total';
|
||||
$totalarray['val']['f.total'] += $objp->total;
|
||||
}
|
||||
if (! empty($arrayfields['f.tva']['checked']))
|
||||
if (!empty($arrayfields['f.tva']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total_vat).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.tva';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.tva';
|
||||
$totalarray['val']['f.tva'] += $objp->total_vat;
|
||||
}
|
||||
if (! empty($arrayfields['f.total_ttc']['checked']))
|
||||
if (!empty($arrayfields['f.total_ttc']['checked']))
|
||||
{
|
||||
print '<td class="right">'.price($objp->total_ttc).'</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc';
|
||||
$totalarray['val']['f.total_ttc'] += $objp->total_ttc;
|
||||
}
|
||||
// Payment term
|
||||
if (! empty($arrayfields['f.fk_cond_reglement']['checked']))
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked']))
|
||||
{
|
||||
print '<td class="right">';
|
||||
print $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
|
||||
$form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Payment mode
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
print '<td class="right">';
|
||||
print $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
|
||||
$form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['recurring']['checked']))
|
||||
if (!empty($arrayfields['recurring']['checked']))
|
||||
{
|
||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="center">'.yn($objp->frequency ? 1 : 0).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.frequency']['checked']))
|
||||
if (!empty($arrayfields['f.frequency']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($objp->frequency > 0 ? $objp->frequency : '').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.unit_frequency']['checked']))
|
||||
if (!empty($arrayfields['f.unit_frequency']['checked']))
|
||||
{
|
||||
print '<td align="center">'.($objp->frequency > 0 ? $objp->unit_frequency : '').'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.nb_gen_done']['checked']))
|
||||
if (!empty($arrayfields['f.nb_gen_done']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ? ' / '.$objp->nb_gen_max : '') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date last generation
|
||||
if (! empty($arrayfields['f.date_last_gen']['checked']))
|
||||
if (!empty($arrayfields['f.date_last_gen']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date next generation
|
||||
if (! empty($arrayfields['f.date_when']['checked']))
|
||||
if (!empty($arrayfields['f.date_when']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<div class="nowraponall">';
|
||||
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when), 'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
if (! $invoicerectmp->isMaxNbGenReached())
|
||||
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached() ? '<strike>' : '').dol_print_date($db->jdate($objp->date_when), 'day').($invoicerectmp->isMaxNbGenReached() ? '</strike>' : '') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
|
||||
if (!$invoicerectmp->isMaxNbGenReached())
|
||||
{
|
||||
if (! $objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
|
||||
if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -608,36 +608,36 @@ if ($resql)
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.datec']['checked']))
|
||||
if (!empty($arrayfields['f.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->datec), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['f.tms']['checked']))
|
||||
if (!empty($arrayfields['f.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->tms), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$obj = $objp;
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Status
|
||||
if (! empty($arrayfields['status']['checked'])) {
|
||||
if (!empty($arrayfields['status']['checked'])) {
|
||||
print '<td align="center">';
|
||||
print $invoicerectmp->getLibStatut(3, 0);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
|
||||
@ -637,7 +637,7 @@ if ($resql)
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
|
||||
@ -170,7 +170,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("CustomersDraftInvoices").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
|
||||
print '<th colspan="3">'.$langs->trans("CustomersDraftInvoices").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
if ($num)
|
||||
{
|
||||
$companystatic = new Societe($db);
|
||||
@ -257,7 +257,7 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("SuppliersDraftInvoices").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
|
||||
print '<th colspan="3">'.$langs->trans("SuppliersDraftInvoices").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
if ($num)
|
||||
{
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
@ -1803,8 +1803,8 @@ class BonPrelevement extends CommonObject
|
||||
* Write sender of request (me).
|
||||
* Note: The tag PmtInf is opened here but closed into caller
|
||||
*
|
||||
* @param string $configuration conf
|
||||
* @param int $ladate Date
|
||||
* @param Conf $configuration conf
|
||||
* @param int $ladate Date
|
||||
* @param int $nombre 0 or 1
|
||||
* @param float $total Total
|
||||
* @param string $CrLf End of line character
|
||||
@ -1827,15 +1827,15 @@ class BonPrelevement extends CommonObject
|
||||
if ($account->fetch($id) > 0)
|
||||
{
|
||||
$this->emetteur_code_banque = $account->code_banque;
|
||||
$this->emetteur_code_guichet = $account->code_guichet;
|
||||
$this->emetteur_numero_compte = $account->number;
|
||||
$this->emetteur_code_guichet = $account->code_guichet;
|
||||
$this->emetteur_numero_compte = $account->number;
|
||||
$this->emetteur_number_key = $account->cle_rib;
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||
|
||||
$this->raison_sociale = $account->proprio;
|
||||
$this->raison_sociale = $account->proprio;
|
||||
}
|
||||
|
||||
// Récupération info demandeur
|
||||
|
||||
@ -257,7 +257,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
$sql = "SELECT fd.tva_tx AS vatrate,";
|
||||
$sql .= " fd.product_type AS product_type,";
|
||||
$sql .= " cc.label AS country,";
|
||||
$sql .= " cc.code, cc.label AS country,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$sql .= " SUM(".$db->ifsql('MONTH(f.datef)='.$i, 'fd.total_ht', '0').") AS month".str_pad($i, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
@ -289,7 +289,10 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
} else {
|
||||
print '<td class="left">'.$langs->trans("Service").'</td>';
|
||||
}
|
||||
print '<td>'.$obj->country.'</td>';
|
||||
// Country
|
||||
print '<td>';
|
||||
print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country;
|
||||
print '</td>';
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) $j -= 12;
|
||||
@ -335,7 +338,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
$sql2 = "SELECT ffd.tva_tx AS vatrate,";
|
||||
$sql2 .= " ffd.product_type AS product_type,";
|
||||
$sql2 .= " cc.label AS country,";
|
||||
$sql2 .= " cc.code, cc.label AS country,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$sql2 .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$i, 'ffd.total_ht', '0').") AS month".str_pad($i, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
@ -368,7 +371,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
} else {
|
||||
print '<td class="left">'.$langs->trans("Service").'</td>';
|
||||
}
|
||||
print '<td>'.$obj->country.'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("Country".$obj->code) != "Country".$obj->code ? $langs->trans("Country".$obj->code) : $obj->country;
|
||||
print '</td>';
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START);
|
||||
if ($j > 12) $j -= 12;
|
||||
|
||||
@ -40,6 +40,7 @@ $year = GETPOST("year", "int");
|
||||
if (empty($year))
|
||||
{
|
||||
$year_current = strftime("%Y", dol_now());
|
||||
if ($conf->global->SOCIETE_FISCAL_MONTH_START > date('m')) $year_current--;
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
|
||||
@ -482,7 +482,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name = 'CONTACT_SENTBYMAIL';
|
||||
$triggersendname = 'CONTACT_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$mode = 'emailfromcontact';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
@ -64,23 +64,23 @@ class Contact extends CommonObject
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
|
||||
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
|
||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
|
||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
|
||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
|
||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
|
||||
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000),
|
||||
);
|
||||
|
||||
public $civility_id; // In fact we store civility_code
|
||||
public $civility_id; // In fact we store civility_code
|
||||
public $civility_code;
|
||||
public $civility;
|
||||
|
||||
@ -92,14 +92,14 @@ class Contact extends CommonObject
|
||||
public $zip;
|
||||
public $town;
|
||||
|
||||
public $state_id; // Id of department
|
||||
public $state_code; // Code of department
|
||||
public $state; // Label of department
|
||||
public $state_id; // Id of department
|
||||
public $state_code; // Code of department
|
||||
public $state; // Label of department
|
||||
|
||||
public $poste; // Position
|
||||
public $poste; // Position
|
||||
|
||||
public $socid; // fk_soc
|
||||
public $statut; // 0=inactif, 1=actif
|
||||
public $socid; // fk_soc
|
||||
public $statut; // 0=inactif, 1=actif
|
||||
|
||||
public $code;
|
||||
|
||||
@ -181,9 +181,9 @@ class Contact extends CommonObject
|
||||
* Old copy
|
||||
* @var Contact
|
||||
*/
|
||||
public $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
public $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
|
||||
public $roles=array();
|
||||
public $roles = array();
|
||||
|
||||
|
||||
/**
|
||||
@ -208,28 +208,28 @@ class Contact extends CommonObject
|
||||
// phpcs:enable
|
||||
global $user;
|
||||
|
||||
$this->nb=array();
|
||||
$this->nb = array();
|
||||
$clause = "WHERE";
|
||||
|
||||
$sql = "SELECT count(sp.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid)
|
||||
{
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')';
|
||||
$sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
|
||||
if ($user->socid > 0) $sql.=" AND sp.fk_soc = ".$user->socid;
|
||||
$sql .= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')';
|
||||
$sql .= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
|
||||
if ($user->socid > 0) $sql .= " AND sp.fk_soc = ".$user->socid;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$this->nb["contacts"]=$obj->nb;
|
||||
$this->nb["contacts"] = $obj->nb;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
@ -386,7 +386,7 @@ class Contact extends CommonObject
|
||||
$this->town = (empty($this->town) ? '' : $this->town);
|
||||
$this->country_id = ($this->country_id > 0 ? $this->country_id : $this->country_id);
|
||||
if (empty($this->statut)) $this->statut = 0;
|
||||
if (empty($this->civility_code) && ! is_numeric($this->civility_id)) $this->civility_code = $this->civility_id; // For backward compatibility
|
||||
if (empty($this->civility_code) && !is_numeric($this->civility_id)) $this->civility_code = $this->civility_id; // For backward compatibility
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
|
||||
@ -406,16 +406,16 @@ class Contact extends CommonObject
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ", photo='".$this->db->escape($this->photo)."'";
|
||||
$sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null");
|
||||
$sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql .= ", note_public = ".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
|
||||
$sql .= ", phone_perso = ".(isset($this->phone_perso)?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql .= ", note_private = ".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||
$sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null");
|
||||
$sql .= ", phone = ".(isset($this->phone_pro) ? "'".$this->db->escape($this->phone_pro)."'" : "null");
|
||||
$sql .= ", phone_perso = ".(isset($this->phone_perso) ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
||||
$sql .= ", phone_mobile = ".(isset($this->phone_mobile) ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
||||
$sql .= ", priv = '".$this->db->escape($this->priv)."'";
|
||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'":"NULL");
|
||||
$sql .= ", default_lang=".($this->default_lang?"'".$this->db->escape($this->default_lang)."'":"NULL");
|
||||
$sql .= ", entity = " . $this->db->escape($this->entity);
|
||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
|
||||
$sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL");
|
||||
$sql .= ", entity = ".$this->db->escape($this->entity);
|
||||
$sql .= " WHERE rowid=".$this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
@ -525,15 +525,15 @@ class Contact extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTACT_MODIFY', $user);
|
||||
$result = $this->call_trigger('CONTACT_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -757,37 +757,37 @@ class Contact extends CommonObject
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch id=" . $id . " ref_ext=" . $ref_ext . " email=" . $email, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch id=".$id." ref_ext=".$ref_ext." email=".$email, LOG_DEBUG);
|
||||
|
||||
if (empty($id) && empty($ref_ext) && empty($email))
|
||||
{
|
||||
$this->error='BadParameter';
|
||||
$this->error = 'BadParameter';
|
||||
return -1;
|
||||
}
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
$sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_code, c.lastname, c.firstname,";
|
||||
$sql.= " c.address, c.statut, c.zip, c.town,";
|
||||
$sql.= " c.fk_pays as country_id,";
|
||||
$sql.= " c.fk_departement as state_id,";
|
||||
$sql.= " c.birthday,";
|
||||
$sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email,";
|
||||
$sql.= " c.socialnetworks,";
|
||||
$sql.= " c.photo,";
|
||||
$sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
|
||||
$sql.= " c.import_key,";
|
||||
$sql.= " c.datec as date_creation, c.tms as date_modification,";
|
||||
$sql.= " co.label as country, co.code as country_code,";
|
||||
$sql.= " d.nom as state, d.code_departement as state_code,";
|
||||
$sql.= " u.rowid as user_id, u.login as user_login,";
|
||||
$sql.= " s.nom as socname, s.address as socaddress, s.zip as soccp, s.town as soccity, s.default_lang as socdefault_lang";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON c.fk_pays = co.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
if ($id) $sql.= " WHERE c.rowid = ". $id;
|
||||
$sql .= " c.address, c.statut, c.zip, c.town,";
|
||||
$sql .= " c.fk_pays as country_id,";
|
||||
$sql .= " c.fk_departement as state_id,";
|
||||
$sql .= " c.birthday,";
|
||||
$sql .= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email,";
|
||||
$sql .= " c.socialnetworks,";
|
||||
$sql .= " c.photo,";
|
||||
$sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,";
|
||||
$sql .= " c.import_key,";
|
||||
$sql .= " c.datec as date_creation, c.tms as date_modification,";
|
||||
$sql .= " co.label as country, co.code as country_code,";
|
||||
$sql .= " d.nom as state, d.code_departement as state_code,";
|
||||
$sql .= " u.rowid as user_id, u.login as user_login,";
|
||||
$sql .= " s.nom as socname, s.address as socaddress, s.zip as soccp, s.town as soccity, s.default_lang as socdefault_lang";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON c.fk_pays = co.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
if ($id) $sql .= " WHERE c.rowid = ".$id;
|
||||
else
|
||||
{
|
||||
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
|
||||
@ -799,47 +799,47 @@ class Contact extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
$this->ref = $obj->rowid;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
|
||||
$this->civility_code = $obj->civility_code;
|
||||
$this->civility = $obj->civility_code?($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code):'';
|
||||
$this->civility = $obj->civility_code ? ($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code) : '';
|
||||
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->address = $obj->address;
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
$this->lastname = $obj->lastname;
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->address = $obj->address;
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
|
||||
$this->state_id = $obj->state_id;
|
||||
$this->state_code = $obj->state_code;
|
||||
$this->state = $obj->state;
|
||||
$this->state_id = $obj->state_id;
|
||||
$this->state_code = $obj->state_code;
|
||||
$this->state = $obj->state;
|
||||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):'';
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_id ? $obj->country_code : '';
|
||||
$this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
|
||||
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->socname = $obj->socname;
|
||||
$this->poste = $obj->poste;
|
||||
$this->statut = $obj->statut;
|
||||
$this->statut = $obj->statut;
|
||||
|
||||
$this->phone_pro = trim($obj->phone);
|
||||
$this->fax = trim($obj->fax);
|
||||
$this->phone_perso = trim($obj->phone_perso);
|
||||
$this->phone_mobile = trim($obj->phone_mobile);
|
||||
$this->phone_pro = trim($obj->phone);
|
||||
$this->fax = trim($obj->fax);
|
||||
$this->phone_perso = trim($obj->phone_perso);
|
||||
$this->phone_mobile = trim($obj->phone_mobile);
|
||||
|
||||
$this->email = $obj->email;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
@ -847,14 +847,14 @@ class Contact extends CommonObject
|
||||
$this->priv = $obj->priv;
|
||||
$this->mail = $obj->email;
|
||||
|
||||
$this->birthday = $this->db->jdate($obj->birthday);
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->birthday = $this->db->jdate($obj->birthday);
|
||||
$this->note = $obj->note_private; // deprecated
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->default_lang = $obj->default_lang;
|
||||
$this->user_id = $obj->user_id;
|
||||
$this->user_id = $obj->user_id;
|
||||
$this->user_login = $obj->user_login;
|
||||
$this->canvas = $obj->canvas;
|
||||
$this->canvas = $obj->canvas;
|
||||
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
@ -1617,7 +1617,7 @@ class Contact extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_soc=".$this->socid;
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_soc=".$this->socid." AND fk_socpeople=".$this->id; ;
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -1002,7 +1002,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name = 'CONTRACT_SENTBYMAIL';
|
||||
$triggersendname = 'CONTRACT_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
$mode = 'emailfromcontract';
|
||||
$trackid = 'con'.$object->id;
|
||||
|
||||
@ -1054,7 +1054,7 @@ class Contrat extends CommonObject
|
||||
if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
$exp = new Expedition($db);
|
||||
$exp = new Expedition($this->db);
|
||||
$exp->fetch($this->origin_id);
|
||||
$exp->fetchObjectLinked();
|
||||
if (count($exp->linkedObjectsIds['commande']) > 0)
|
||||
|
||||
@ -260,7 +260,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftContracts").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
|
||||
print '<th colspan="3">'.$langs->trans("DraftContracts").($num ? '<span class="badge marginleftonlyshort">'.$num.'</span>' : '').'</th></tr>';
|
||||
if ($num)
|
||||
{
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
@ -44,6 +44,7 @@ if ($cancel)
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
// Action to add record
|
||||
if ($action == 'add' && !empty($permissiontoadd))
|
||||
{
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
// $id must be defined
|
||||
// $paramname may be defined
|
||||
// $autocopy may be defined (used to know the automatic BCC to add)
|
||||
// $trigger_name must be set (can be '')
|
||||
// $triggersendname must be set (can be '')
|
||||
// $actiontypecode can be set
|
||||
// $object and $uobject may be defined
|
||||
|
||||
@ -453,12 +453,12 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
$object->email_subject = $subject;
|
||||
$object->email_msgid = $mailfile->msgid;
|
||||
|
||||
// Call of triggers
|
||||
if (! empty($trigger_name))
|
||||
// Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprcated)
|
||||
if (! empty($triggersendname) || ! empty($trigger_name))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers($trigger_name, $object, $user, $langs, $conf);
|
||||
$result=$interface->run_triggers(empty($triggersendname)?$trigger_name:$triggersendname, $object, $user, $langs, $conf);
|
||||
if ($result < 0) {
|
||||
setEventMessages($interface->error, $interface->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -289,25 +289,49 @@ if ($type == 'directory')
|
||||
}
|
||||
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
|
||||
|
||||
if ($module == 'medias')
|
||||
{
|
||||
$useinecm = 6;
|
||||
$modulepart='medias';
|
||||
$perm=($user->rights->website->write || $user->rights->emailing->creer);
|
||||
$title='none';
|
||||
}
|
||||
else
|
||||
{
|
||||
$useinecm = 5;
|
||||
$modulepart='ecm';
|
||||
$perm=$user->rights->ecm->upload;
|
||||
$title=''; // Use default
|
||||
}
|
||||
if ($module == 'medias')
|
||||
{
|
||||
$useinecm = 6;
|
||||
$modulepart='medias';
|
||||
$perm=($user->rights->website->write || $user->rights->emailing->creer);
|
||||
$title='none';
|
||||
}
|
||||
elseif($module == 'ecm') // DMS/ECM -> manual structure
|
||||
{
|
||||
if($user->rights->ecm->read)
|
||||
{
|
||||
// Buttons: Preview
|
||||
$useinecm = 2;
|
||||
}
|
||||
|
||||
// When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
|
||||
// When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
|
||||
//var_dump("title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
|
||||
$formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm);
|
||||
if($user->rights->ecm->upload)
|
||||
{
|
||||
// Buttons: Preview + Delete
|
||||
$useinecm = 4;
|
||||
}
|
||||
|
||||
if($user->rights->ecm->setup)
|
||||
{
|
||||
// Buttons: Preview + Delete + Edit
|
||||
$useinecm = 5;
|
||||
}
|
||||
|
||||
$perm=$user->rights->ecm->upload;
|
||||
$modulepart='ecm';
|
||||
$title=''; // Use default
|
||||
}
|
||||
else
|
||||
{
|
||||
$useinecm = 5;
|
||||
$modulepart='ecm';
|
||||
$perm=$user->rights->ecm->upload;
|
||||
$title=''; // Use default
|
||||
}
|
||||
|
||||
// When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
|
||||
// When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
|
||||
//var_dump("title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
|
||||
$formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_graph_invoices_permonth extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="invoicespermonth";
|
||||
public $boximg="object_bill";
|
||||
public $boxlabel="BoxCustomersInvoicesPerMonth";
|
||||
public $boxcode = "invoicespermonth";
|
||||
public $boximg = "object_bill";
|
||||
public $boxlabel = "BoxCustomersInvoicesPerMonth";
|
||||
public $depends = array("facture");
|
||||
|
||||
/**
|
||||
@ -52,9 +52,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->facture->lire);
|
||||
$this->hidden = !($user->rights->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,14 +67,14 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
$refreshaction='refresh_'.$this->boxcode;
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
//$facturestatic=new Facture($this->db);
|
||||
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||
|
||||
$text = $langs->trans("BoxCustomersInvoicesPerMonth", $max);
|
||||
@ -89,50 +89,50 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
$dir=''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix='';
|
||||
$socid=0;
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
$dir = ''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix = '';
|
||||
$socid = 0;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$mesg = '';
|
||||
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
|
||||
$autosetarray=preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
|
||||
{
|
||||
$endyear=GETPOST($param_year, 'int');
|
||||
$shownb=GETPOST($param_shownb, 'alpha');
|
||||
$showtot=GETPOST($param_showtot, 'alpha');
|
||||
$endyear = GETPOST($param_year, 'int');
|
||||
$shownb = GETPOST($param_shownb, 'alpha');
|
||||
$showtot = GETPOST($param_showtot, 'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear = $tmparray['year'];
|
||||
$shownb = $tmparray['shownb'];
|
||||
$showtot = $tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||
$nowarray=dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='customer';
|
||||
$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
|
||||
$HEIGHT='192';
|
||||
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
|
||||
$nowarray = dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear = $nowarray['year'];
|
||||
$startyear = $endyear - 1;
|
||||
$mode = 'customer';
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
|
||||
$HEIGHT = '192';
|
||||
|
||||
$stats = new FactureStats($this->db, $socid, $mode, 0);
|
||||
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($shownb)
|
||||
{
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
@ -141,22 +141,22 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$langs->load("bills");
|
||||
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
$i=$startyear;$legend=array();
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -168,7 +168,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetCssPrefix("cssboxes");
|
||||
$px1->mode='depth';
|
||||
$px1->mode = 'depth';
|
||||
$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
|
||||
|
||||
$px1->draw($filenamenb, $fileurlnb);
|
||||
@ -178,7 +178,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showtot)
|
||||
{
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
@ -187,22 +187,22 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$langs->load("bills");
|
||||
|
||||
$px2->SetData($data2);
|
||||
unset($data2);
|
||||
$i=$startyear;$legend=array();
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -214,7 +214,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetCssPrefix("cssboxes");
|
||||
$px2->mode='depth';
|
||||
$px2->mode = 'depth';
|
||||
$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
|
||||
|
||||
$px2->draw($filenamenb, $fileurlnb);
|
||||
@ -224,51 +224,51 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$stringtoshow='';
|
||||
$stringtoshow.='<script type="text/javascript" language="javascript">
|
||||
$stringtoshow = '';
|
||||
$stringtoshow .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
|
||||
$stringtoshow.='<br>';
|
||||
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow.='<input class="reposition inline-block valigntextbottom" type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow.='</form>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow .= '<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfBillsByMonth");
|
||||
$stringtoshow .= ' ';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfBillsByMonthHT");
|
||||
$stringtoshow .= '<br>';
|
||||
$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow .= '<input class="reposition inline-block valigntextbottom" type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow .= '</form>';
|
||||
$stringtoshow .= '</div>';
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='<div class="fichecenter">';
|
||||
$stringtoshow.='<div class="fichehalfleft">';
|
||||
$stringtoshow .= '<div class="fichecenter">';
|
||||
$stringtoshow .= '<div class="fichehalfleft">';
|
||||
}
|
||||
if ($shownb) $stringtoshow.=$px1->show();
|
||||
if ($shownb) $stringtoshow .= $px1->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='<div class="fichehalfright">';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '<div class="fichehalfright">';
|
||||
}
|
||||
if ($showtot) $stringtoshow.=$px2->show();
|
||||
if ($showtot) $stringtoshow .= $px2->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
}
|
||||
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover center"','textnoformat'=>$stringtoshow);
|
||||
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover center"', 'textnoformat'=>$stringtoshow);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -28,9 +28,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="invoicessupplierpermonth";
|
||||
public $boximg="object_bill";
|
||||
public $boxlabel="BoxSuppliersInvoicesPerMonth";
|
||||
public $boxcode = "invoicessupplierpermonth";
|
||||
public $boximg = "object_bill";
|
||||
public $boxlabel = "BoxSuppliersInvoicesPerMonth";
|
||||
public $depends = array("fournisseur");
|
||||
|
||||
/**
|
||||
@ -52,9 +52,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->fournisseur->facture->lire);
|
||||
$this->hidden = !($user->rights->fournisseur->facture->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,13 +67,13 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
$refreshaction='refresh_'.$this->boxcode;
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||
|
||||
$text = $langs->trans("BoxSuppliersInvoicesPerMonth", $max);
|
||||
@ -88,48 +88,48 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
$dir=''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix='';
|
||||
$socid=0;
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
$dir = ''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix = '';
|
||||
$socid = 0;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
if ($user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
|
||||
$autosetarray=preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
|
||||
{
|
||||
$endyear=GETPOST($param_year, 'int');
|
||||
$shownb=GETPOST($param_shownb, 'alpha');
|
||||
$showtot=GETPOST($param_showtot, 'alpha');
|
||||
$endyear = GETPOST($param_year, 'int');
|
||||
$shownb = GETPOST($param_shownb, 'alpha');
|
||||
$showtot = GETPOST($param_showtot, 'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear = $tmparray['year'];
|
||||
$shownb = $tmparray['shownb'];
|
||||
$showtot = $tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||
$nowarray=dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='supplier';
|
||||
$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
|
||||
$HEIGHT='192';
|
||||
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
|
||||
$nowarray = dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear = $nowarray['year'];
|
||||
$startyear = $endyear - 1;
|
||||
$mode = 'supplier';
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
|
||||
$HEIGHT = '192';
|
||||
|
||||
$stats = new FactureStats($this->db, $socid, $mode, 0);
|
||||
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($shownb)
|
||||
{
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png";
|
||||
// default value for customer mode
|
||||
@ -138,23 +138,23 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$langs->load("bills");
|
||||
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
$i=$startyear;
|
||||
$legend=array();
|
||||
$i = $startyear;
|
||||
$legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -166,7 +166,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetCssPrefix("cssboxes");
|
||||
$px1->mode='depth';
|
||||
$px1->mode = 'depth';
|
||||
$px1->SetTitle($langs->trans("NumberOfBillsByMonth"));
|
||||
|
||||
$px1->draw($filenamenb, $fileurlnb);
|
||||
@ -176,7 +176,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showtot)
|
||||
{
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png";
|
||||
// default value for customer mode
|
||||
@ -185,22 +185,22 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$langs->load("bills");
|
||||
|
||||
$px2->SetData($data2);
|
||||
unset($data2);
|
||||
$i=$startyear;$legend=array();
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -212,7 +212,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetCssPrefix("cssboxes");
|
||||
$px2->mode='depth';
|
||||
$px2->mode = 'depth';
|
||||
$px2->SetTitle($langs->trans("AmountOfBillsByMonthHT"));
|
||||
|
||||
$px2->draw($filenamenb, $fileurlnb);
|
||||
@ -222,51 +222,51 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$stringtoshow='';
|
||||
$stringtoshow.='<script type="text/javascript" language="javascript">
|
||||
$stringtoshow = '';
|
||||
$stringtoshow .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfBillsByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
|
||||
$stringtoshow.='<br>';
|
||||
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow.='</form>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow .= '<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfBillsByMonth");
|
||||
$stringtoshow .= ' ';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfBillsByMonthHT");
|
||||
$stringtoshow .= '<br>';
|
||||
$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow .= '</form>';
|
||||
$stringtoshow .= '</div>';
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='<div class="fichecenter">';
|
||||
$stringtoshow.='<div class="fichehalfleft">';
|
||||
$stringtoshow .= '<div class="fichecenter">';
|
||||
$stringtoshow .= '<div class="fichehalfleft">';
|
||||
}
|
||||
if ($shownb) $stringtoshow.=$px1->show();
|
||||
if ($shownb) $stringtoshow .= $px1->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='<div class="fichehalfright">';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '<div class="fichehalfright">';
|
||||
}
|
||||
if ($showtot) $stringtoshow.=$px2->show();
|
||||
if ($showtot) $stringtoshow .= $px2->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
}
|
||||
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"','td' => 'class="nohover center"','textnoformat'=>$stringtoshow);
|
||||
$this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover center"', 'textnoformat'=>$stringtoshow);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -28,9 +28,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_graph_orders_permonth extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="orderspermonth";
|
||||
public $boximg="object_order";
|
||||
public $boxlabel="BoxCustomersOrdersPerMonth";
|
||||
public $boxcode = "orderspermonth";
|
||||
public $boximg = "object_order";
|
||||
public $boxlabel = "BoxCustomersOrdersPerMonth";
|
||||
public $depends = array("commande");
|
||||
|
||||
/**
|
||||
@ -52,9 +52,9 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->commande->lire);
|
||||
$this->hidden = !($user->rights->commande->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,14 +67,14 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
$refreshaction='refresh_'.$this->boxcode;
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
//include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
//$commandestatic=new Commande($this->db);
|
||||
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||
|
||||
$text = $langs->trans("BoxCustomersOrdersPerMonth", $max);
|
||||
@ -89,50 +89,50 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
$dir=''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix='';
|
||||
$socid=0;
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
$dir = ''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix = '';
|
||||
$socid = 0;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
if ($user->rights->commande->lire)
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
|
||||
$autosetarray=preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
|
||||
{
|
||||
$endyear=GETPOST($param_year, 'int');
|
||||
$shownb=GETPOST($param_shownb, 'alpha');
|
||||
$showtot=GETPOST($param_showtot, 'alpha');
|
||||
$endyear = GETPOST($param_year, 'int');
|
||||
$shownb = GETPOST($param_shownb, 'alpha');
|
||||
$showtot = GETPOST($param_showtot, 'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear = $tmparray['year'];
|
||||
$shownb = $tmparray['shownb'];
|
||||
$showtot = $tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||
$nowarray=dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='customer';
|
||||
$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
|
||||
$HEIGHT='192';
|
||||
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
|
||||
$nowarray = dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear = $nowarray['year'];
|
||||
$startyear = $endyear - 1;
|
||||
$mode = 'customer';
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
|
||||
$HEIGHT = '192';
|
||||
|
||||
$stats = new CommandeStats($this->db, $socid, $mode, 0);
|
||||
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($shownb)
|
||||
{
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
@ -141,21 +141,21 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
$i=$startyear;
|
||||
$legend=array();
|
||||
$i = $startyear;
|
||||
$legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -167,7 +167,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetCssPrefix("cssboxes");
|
||||
$px1->mode='depth';
|
||||
$px1->mode = 'depth';
|
||||
$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
|
||||
|
||||
$px1->draw($filenamenb, $fileurlnb);
|
||||
@ -177,7 +177,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showtot)
|
||||
{
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
@ -186,20 +186,20 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$px2->SetData($data2);
|
||||
unset($data2);
|
||||
$i=$startyear;$legend=array();
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -211,7 +211,7 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetCssPrefix("cssboxes");
|
||||
$px2->mode='depth';
|
||||
$px2->mode = 'depth';
|
||||
$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
|
||||
|
||||
$px2->draw($filenamenb, $fileurlnb);
|
||||
@ -221,49 +221,49 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$stringtoshow='';
|
||||
$stringtoshow.='<script type="text/javascript" language="javascript">
|
||||
$stringtoshow = '';
|
||||
$stringtoshow .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
|
||||
$stringtoshow.='<br>';
|
||||
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow.='</form>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow .= '<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfOrdersByMonth");
|
||||
$stringtoshow .= ' ';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfOrdersByMonthHT");
|
||||
$stringtoshow .= '<br>';
|
||||
$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow .= '</form>';
|
||||
$stringtoshow .= '</div>';
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='<div class="fichecenter">';
|
||||
$stringtoshow.='<div class="fichehalfleft">';
|
||||
$stringtoshow .= '<div class="fichecenter">';
|
||||
$stringtoshow .= '<div class="fichehalfleft">';
|
||||
}
|
||||
if ($shownb) $stringtoshow.=$px1->show();
|
||||
if ($shownb) $stringtoshow .= $px1->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='<div class="fichehalfright">';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '<div class="fichehalfright">';
|
||||
}
|
||||
if ($showtot) $stringtoshow.=$px2->show();
|
||||
if ($showtot) $stringtoshow .= $px2->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
}
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'tr'=>'class="oddeven nohover"',
|
||||
|
||||
@ -28,9 +28,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="orderssupplierpermonth";
|
||||
public $boximg="object_order";
|
||||
public $boxlabel="BoxSuppliersOrdersPerMonth";
|
||||
public $boxcode = "orderssupplierpermonth";
|
||||
public $boximg = "object_order";
|
||||
public $boxlabel = "BoxSuppliersOrdersPerMonth";
|
||||
public $depends = array("fournisseur");
|
||||
|
||||
/**
|
||||
@ -52,9 +52,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
{
|
||||
global $user;
|
||||
|
||||
$this->db=$db;
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->fournisseur->commande->lire);
|
||||
$this->hidden = !($user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,13 +67,13 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
$refreshaction='refresh_'.$this->boxcode;
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||
|
||||
$text = $langs->trans("BoxSuppliersOrdersPerMonth", $max);
|
||||
@ -88,50 +88,50 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
$dir=''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix='';
|
||||
$socid=0;
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
$dir = ''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix = '';
|
||||
$socid = 0;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
if ($user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
|
||||
$autosetarray=preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
|
||||
{
|
||||
$endyear=GETPOST($param_year, 'int');
|
||||
$shownb=GETPOST($param_shownb, 'alpha');
|
||||
$showtot=GETPOST($param_showtot, 'alpha');
|
||||
$endyear = GETPOST($param_year, 'int');
|
||||
$shownb = GETPOST($param_shownb, 'alpha');
|
||||
$showtot = GETPOST($param_showtot, 'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear = $tmparray['year'];
|
||||
$shownb = $tmparray['shownb'];
|
||||
$showtot = $tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||
$nowarray=dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$mode='supplier';
|
||||
$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
|
||||
$HEIGHT='192';
|
||||
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
|
||||
$nowarray = dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear = $nowarray['year'];
|
||||
$startyear = $endyear - 1;
|
||||
$mode = 'supplier';
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
|
||||
$HEIGHT = '192';
|
||||
|
||||
$stats = new CommandeStats($this->db, $socid, $mode, 0);
|
||||
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($shownb)
|
||||
{
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
@ -140,21 +140,21 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
$i=$startyear;
|
||||
$legend=array();
|
||||
$i = $startyear;
|
||||
$legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -166,7 +166,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetCssPrefix("cssboxes");
|
||||
$px1->mode='depth';
|
||||
$px1->mode = 'depth';
|
||||
$px1->SetTitle($langs->trans("NumberOfOrdersByMonth"));
|
||||
|
||||
$px1->draw($filenamenb, $fileurlnb);
|
||||
@ -176,7 +176,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showtot)
|
||||
{
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
|
||||
$filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png";
|
||||
// default value for customer mode
|
||||
@ -185,20 +185,20 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$px2->SetData($data2);
|
||||
unset($data2);
|
||||
$i=$startyear;$legend=array();
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -210,7 +210,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetCssPrefix("cssboxes");
|
||||
$px2->mode='depth';
|
||||
$px2->mode = 'depth';
|
||||
$px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT"));
|
||||
|
||||
$px2->draw($filenamenb, $fileurlnb);
|
||||
@ -220,49 +220,49 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$stringtoshow='';
|
||||
$stringtoshow.='<script type="text/javascript" language="javascript">
|
||||
$stringtoshow = '';
|
||||
$stringtoshow .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfOrdersByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
|
||||
$stringtoshow.='<br>';
|
||||
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow.='</form>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow .= '<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfOrdersByMonth");
|
||||
$stringtoshow .= ' ';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfOrdersByMonthHT");
|
||||
$stringtoshow .= '<br>';
|
||||
$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow .= '</form>';
|
||||
$stringtoshow .= '</div>';
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='<div class="fichecenter">';
|
||||
$stringtoshow.='<div class="fichehalfleft">';
|
||||
$stringtoshow .= '<div class="fichecenter">';
|
||||
$stringtoshow .= '<div class="fichehalfleft">';
|
||||
}
|
||||
if ($shownb) $stringtoshow.=$px1->show();
|
||||
if ($shownb) $stringtoshow .= $px1->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='<div class="fichehalfright">';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '<div class="fichehalfright">';
|
||||
}
|
||||
if ($showtot) $stringtoshow.=$px2->show();
|
||||
if ($showtot) $stringtoshow .= $px2->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
}
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'tr'=>'class="oddeven nohover"',
|
||||
|
||||
@ -29,10 +29,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
*/
|
||||
class box_graph_product_distribution extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="productdistribution";
|
||||
public $boximg="object_product";
|
||||
public $boxlabel="BoxProductDistribution";
|
||||
public $depends = array("product|service","facture|propal|commande");
|
||||
public $boxcode = "productdistribution";
|
||||
public $boximg = "object_product";
|
||||
public $boxlabel = "BoxProductDistribution";
|
||||
public $depends = array("product|service", "facture|propal|commande");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
@ -55,12 +55,12 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
{
|
||||
global $user, $conf;
|
||||
|
||||
$this->db=$db;
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! (
|
||||
(! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire))
|
||||
|| (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire))
|
||||
|| (! empty($conf->propal->enabled) && ! empty($user->rights->propale->lire))
|
||||
$this->hidden = !(
|
||||
(!empty($conf->facture->enabled) && !empty($user->rights->facture->lire))
|
||||
|| (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire))
|
||||
|| (!empty($conf->propal->enabled) && !empty($user->rights->propale->lire))
|
||||
);
|
||||
}
|
||||
|
||||
@ -74,43 +74,43 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
$refreshaction='refresh_'.$this->boxcode;
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_showinvoicenb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showinvoicenb';
|
||||
$param_showpropalnb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showpropalnb';
|
||||
$param_showordernb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showordernb';
|
||||
$autosetarray=preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_showinvoicenb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showinvoicenb';
|
||||
$param_showpropalnb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showpropalnb';
|
||||
$param_showordernb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showordernb';
|
||||
$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
|
||||
{
|
||||
$year=GETPOST($param_year, 'int');
|
||||
$showinvoicenb=GETPOST($param_showinvoicenb, 'alpha');
|
||||
$showpropalnb=GETPOST($param_showpropalnb, 'alpha');
|
||||
$showordernb=GETPOST($param_showordernb, 'alpha');
|
||||
$year = GETPOST($param_year, 'int');
|
||||
$showinvoicenb = GETPOST($param_showinvoicenb, 'alpha');
|
||||
$showpropalnb = GETPOST($param_showpropalnb, 'alpha');
|
||||
$showordernb = GETPOST($param_showordernb, 'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$year=$tmparray['year'];
|
||||
$showinvoicenb=$tmparray['showinvoicenb'];
|
||||
$showpropalnb=$tmparray['showpropalnb'];
|
||||
$showordernb=$tmparray['showordernb'];
|
||||
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$year = $tmparray['year'];
|
||||
$showinvoicenb = $tmparray['showinvoicenb'];
|
||||
$showpropalnb = $tmparray['showpropalnb'];
|
||||
$showordernb = $tmparray['showordernb'];
|
||||
}
|
||||
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; }
|
||||
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0;
|
||||
if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) $showpropalnb=0;
|
||||
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0;
|
||||
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1; }
|
||||
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb = 0;
|
||||
if (empty($conf->propal->enabled) || empty($user->rights->propale->lire)) $showpropalnb = 0;
|
||||
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb = 0;
|
||||
|
||||
$nowarray=dol_getdate(dol_now(), true);
|
||||
if (empty($year)) $year=$nowarray['year'];
|
||||
$nowarray = dol_getdate(dol_now(), true);
|
||||
if (empty($year)) $year = $nowarray['year'];
|
||||
|
||||
$nbofgraph=0;
|
||||
$nbofgraph = 0;
|
||||
if ($showinvoicenb) $nbofgraph++;
|
||||
if ($showpropalnb) $nbofgraph++;
|
||||
if ($showordernb) $nbofgraph++;
|
||||
@ -128,13 +128,13 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
);
|
||||
|
||||
|
||||
$socid=empty($user->socid)?0:$user->socid;
|
||||
$userid=0; // No filter on user creation
|
||||
$socid = empty($user->socid) ? 0 : $user->socid;
|
||||
$userid = 0; // No filter on user creation
|
||||
|
||||
$WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320';
|
||||
$HEIGHT='192';
|
||||
$WIDTH = ($nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen)) ? '160' : '320';
|
||||
$HEIGHT = '192';
|
||||
|
||||
if (! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire))
|
||||
if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire))
|
||||
{
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showinvoicenb)
|
||||
@ -143,34 +143,34 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
|
||||
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$mode='customer';
|
||||
$stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid>0?$userid:0));
|
||||
$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)));
|
||||
$mode = 'customer';
|
||||
$stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
|
||||
$data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
if (empty($data1))
|
||||
{
|
||||
$showpointvalue=0;
|
||||
$nocolor=1;
|
||||
$data1=array(array(0=>$langs->trans("None"),1=>1));
|
||||
$showpointvalue = 0;
|
||||
$nocolor = 1;
|
||||
$data1 = array(array(0=>$langs->trans("None"), 1=>1));
|
||||
}
|
||||
$filenamenb = $dir."/prodserforinvoice-".$year.".png";
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=productstats&file=prodserforinvoice-'.$year.'.png';
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$i=0;$tot=count($data1);$legend=array();
|
||||
$i = 0; $tot = count($data1); $legend = array();
|
||||
while ($i <= $tot)
|
||||
{
|
||||
$data1[$i][0]=dol_trunc($data1[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[]=$data1[$i][0];
|
||||
$data1[$i][0] = dol_trunc($data1[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data1[$i][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
|
||||
if ($nocolor) $px1->SetDataColor(array(array(220,220,220)));
|
||||
if ($nocolor) $px1->SetDataColor(array(array(220, 220, 220)));
|
||||
$px1->SetLegend($legend);
|
||||
$px1->setShowLegend(0);
|
||||
$px1->setShowPointValue($showpointvalue);
|
||||
@ -192,7 +192,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->propal->enabled) && ! empty($user->rights->propale->lire))
|
||||
if (!empty($conf->propal->enabled) && !empty($user->rights->propale->lire))
|
||||
{
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showpropalnb)
|
||||
@ -201,13 +201,13 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
|
||||
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$stats_proposal = new PropaleStats($this->db, $socid, ($userid>0?$userid:0));
|
||||
$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)));
|
||||
$stats_proposal = new PropaleStats($this->db, $socid, ($userid > 0 ? $userid : 0));
|
||||
$data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
if (empty($data2))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
$nocolor = 1;
|
||||
$data2=array(array(0=>$langs->trans("None"),1=>1));
|
||||
$data2 = array(array(0=>$langs->trans("None"), 1=>1));
|
||||
}
|
||||
|
||||
$filenamenb = $dir."/prodserforpropal-".$year.".png";
|
||||
@ -215,20 +215,20 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$i=0;$tot=count($data2);$legend=array();
|
||||
$i = 0; $tot = count($data2); $legend = array();
|
||||
while ($i <= $tot)
|
||||
{
|
||||
$data2[$i][0]=dol_trunc($data2[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[]=$data2[$i][0];
|
||||
$data2[$i][0] = dol_trunc($data2[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data2[$i][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
$px2->SetData($data2);
|
||||
unset($data2);
|
||||
|
||||
if ($nocolor) $px2->SetDataColor(array(array(220,220,220)));
|
||||
if ($nocolor) $px2->SetDataColor(array(array(220, 220, 220)));
|
||||
$px2->SetLegend($legend);
|
||||
$px2->setShowLegend(0);
|
||||
$px2->setShowPointValue($showpointvalue);
|
||||
@ -250,7 +250,7 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire))
|
||||
if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire))
|
||||
{
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showordernb)
|
||||
@ -259,14 +259,14 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
|
||||
|
||||
$showpointvalue = 1; $nocolor = 0;
|
||||
$mode='customer';
|
||||
$stats_order = new CommandeStats($this->db, $socid, $mode, ($userid>0?$userid:0));
|
||||
$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)));
|
||||
$mode = 'customer';
|
||||
$stats_order = new CommandeStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0));
|
||||
$data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)));
|
||||
if (empty($data3))
|
||||
{
|
||||
$showpointvalue = 0;
|
||||
$nocolor = 1;
|
||||
$data3=array(array(0=>$langs->trans("None"),1=>1));
|
||||
$data3 = array(array(0=>$langs->trans("None"), 1=>1));
|
||||
}
|
||||
|
||||
$filenamenb = $dir."/prodserfororder-".$year.".png";
|
||||
@ -274,20 +274,20 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
|
||||
$px3 = new DolGraph();
|
||||
$mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$i=0;$tot=count($data3);$legend=array();
|
||||
$i = 0; $tot = count($data3); $legend = array();
|
||||
while ($i <= $tot)
|
||||
{
|
||||
$data3[$i][0]=dol_trunc($data3[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[]=$data3[$i][0];
|
||||
$data3[$i][0] = dol_trunc($data3[$i][0], 5); // Required to avoid error "Could not draw pie with labels contained inside canvas"
|
||||
$legend[] = $data3[$i][0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
$px3->SetData($data3);
|
||||
unset($data3);
|
||||
|
||||
if ($nocolor) $px3->SetDataColor(array(array(220,220,220)));
|
||||
if ($nocolor) $px3->SetDataColor(array(array(220, 220, 220)));
|
||||
$px3->SetLegend($legend);
|
||||
$px3->setShowLegend(0);
|
||||
$px3->setShowPointValue($showpointvalue);
|
||||
@ -312,76 +312,76 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
if (empty($nbofgraph))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("ReadPermissionNotAllowed");
|
||||
$mesg = $langs->trans("ReadPermissionNotAllowed");
|
||||
}
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$stringtoshow='';
|
||||
$stringtoshow.='<script type="text/javascript" language="javascript">
|
||||
$stringtoshow = '';
|
||||
$stringtoshow .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,showinvoicenb,showpropalnb,showordernb">';
|
||||
if (! empty($conf->facture->enabled) || ! empty($user->rights->facture->lire))
|
||||
$stringtoshow .= '<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow .= '<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,showinvoicenb,showpropalnb,showordernb">';
|
||||
if (!empty($conf->facture->enabled) || !empty($user->rights->facture->lire))
|
||||
{
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showinvoicenb.'"'.($showinvoicenb?' checked':'').'> '.$langs->trans("ForCustomersInvoices");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showinvoicenb.'"'.($showinvoicenb ? ' checked' : '').'> '.$langs->trans("ForCustomersInvoices");
|
||||
$stringtoshow .= ' ';
|
||||
}
|
||||
if (! empty($conf->propal->enabled) || ! empty($user->rights->propale->lire))
|
||||
if (!empty($conf->propal->enabled) || !empty($user->rights->propale->lire))
|
||||
{
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showpropalnb.'"'.($showpropalnb?' checked':'').'> '.$langs->trans("ForProposals");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showpropalnb.'"'.($showpropalnb ? ' checked' : '').'> '.$langs->trans("ForProposals");
|
||||
$stringtoshow .= ' ';
|
||||
}
|
||||
if (! empty($conf->commande->enabled) || ! empty($user->rights->commande->lire))
|
||||
if (!empty($conf->commande->enabled) || !empty($user->rights->commande->lire))
|
||||
{
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showordernb.'"'.($showordernb?' checked':'').'> '.$langs->trans("ForCustomersOrders");
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showordernb.'"'.($showordernb ? ' checked' : '').'> '.$langs->trans("ForCustomersOrders");
|
||||
}
|
||||
$stringtoshow.='<br>';
|
||||
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$year.'">';
|
||||
$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto('', 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow.='</form>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '<br>';
|
||||
$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$year.'">';
|
||||
$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto('', 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow .= '</form>';
|
||||
$stringtoshow .= '</div>';
|
||||
|
||||
if ($nbofgraph == 1)
|
||||
{
|
||||
if ($showinvoicenb) $stringtoshow.=$px1->show();
|
||||
elseif ($showpropalnb) $stringtoshow.=$px2->show();
|
||||
else $stringtoshow.=$px3->show();
|
||||
if ($showinvoicenb) $stringtoshow .= $px1->show();
|
||||
elseif ($showpropalnb) $stringtoshow .= $px2->show();
|
||||
else $stringtoshow .= $px3->show();
|
||||
}
|
||||
if ($nbofgraph == 2)
|
||||
{
|
||||
$stringtoshow.='<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
|
||||
if ($showinvoicenb) $stringtoshow.=$px1->show();
|
||||
elseif ($showpropalnb) $stringtoshow.=$px2->show();
|
||||
$stringtoshow.='</div><div class="fichehalfright">';
|
||||
if ($showordernb) $stringtoshow.=$px3->show();
|
||||
elseif ($showpropalnb) $stringtoshow.=$px2->show();
|
||||
$stringtoshow.='</div></div></div>';
|
||||
$stringtoshow .= '<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
|
||||
if ($showinvoicenb) $stringtoshow .= $px1->show();
|
||||
elseif ($showpropalnb) $stringtoshow .= $px2->show();
|
||||
$stringtoshow .= '</div><div class="fichehalfright">';
|
||||
if ($showordernb) $stringtoshow .= $px3->show();
|
||||
elseif ($showpropalnb) $stringtoshow .= $px2->show();
|
||||
$stringtoshow .= '</div></div></div>';
|
||||
}
|
||||
if ($nbofgraph == 3)
|
||||
{
|
||||
$stringtoshow.='<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
|
||||
$stringtoshow.=$px1->show();
|
||||
$stringtoshow.='</div><div class="fichehalfright">';
|
||||
$stringtoshow.=$px2->show();
|
||||
$stringtoshow.='</div></div></div>';
|
||||
$stringtoshow.='<div class="fichecenter"><div class="containercenter">';
|
||||
$stringtoshow.=$px3->show();
|
||||
$stringtoshow.='</div></div>';
|
||||
$stringtoshow .= '<div class="fichecenter"><div class="containercenter"><div class="fichehalfleft">';
|
||||
$stringtoshow .= $px1->show();
|
||||
$stringtoshow .= '</div><div class="fichehalfright">';
|
||||
$stringtoshow .= $px2->show();
|
||||
$stringtoshow .= '</div></div></div>';
|
||||
$stringtoshow .= '<div class="fichecenter"><div class="containercenter">';
|
||||
$stringtoshow .= $px3->show();
|
||||
$stringtoshow .= '</div></div>';
|
||||
}
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'tr'=>'class="oddeven nohover"',
|
||||
|
||||
@ -28,9 +28,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_graph_propales_permonth extends ModeleBoxes
|
||||
{
|
||||
public $boxcode="propalpermonth";
|
||||
public $boximg="object_propal";
|
||||
public $boxlabel="BoxProposalsPerMonth";
|
||||
public $boxcode = "propalpermonth";
|
||||
public $boximg = "object_propal";
|
||||
public $boxlabel = "BoxProposalsPerMonth";
|
||||
public $depends = array("propal");
|
||||
|
||||
/**
|
||||
@ -54,7 +54,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
$this->hidden = ! ($user->rights->propale->lire);
|
||||
$this->hidden = !($user->rights->propale->lire);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,14 +67,14 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$this->max=$max;
|
||||
$this->max = $max;
|
||||
|
||||
$refreshaction='refresh_'.$this->boxcode;
|
||||
$refreshaction = 'refresh_'.$this->boxcode;
|
||||
|
||||
//include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
//$propalstatic=new Propal($this->db);
|
||||
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
$startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1;
|
||||
if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1;
|
||||
|
||||
$langs->load("propal");
|
||||
@ -83,7 +83,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
$this->info_box_head = array(
|
||||
'text' => $text,
|
||||
'limit'=> dol_strlen($text),
|
||||
'graph'=> 1, // Set to 1 if it's a box graph
|
||||
'graph'=> 1, // Set to 1 if it's a box graph
|
||||
'sublink'=>'',
|
||||
'subtext'=>$langs->trans("Filter"),
|
||||
'subpicto'=>'filter.png',
|
||||
@ -91,69 +91,69 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
'target'=>'none' // Set '' to get target="_blank"
|
||||
);
|
||||
|
||||
$dir=''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix='';
|
||||
$socid=0;
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! $user->rights->societe->client->voir || $socid) $prefix.='private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
$dir = ''; // We don't need a path because image file will not be saved into disk
|
||||
$prefix = '';
|
||||
$socid = 0;
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
|
||||
|
||||
if ($user->rights->propale->lire)
|
||||
{
|
||||
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
|
||||
$param_shownb = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
|
||||
$param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
|
||||
$autosetarray=preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
$autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE'));
|
||||
if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray))
|
||||
{
|
||||
$endyear=GETPOST($param_year, 'int');
|
||||
$shownb=GETPOST($param_shownb, 'alpha');
|
||||
$showtot=GETPOST($param_showtot, 'alpha');
|
||||
$endyear = GETPOST($param_year, 'int');
|
||||
$shownb = GETPOST($param_shownb, 'alpha');
|
||||
$showtot = GETPOST($param_showtot, 'alpha');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmparray=json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear=$tmparray['year'];
|
||||
$shownb=$tmparray['shownb'];
|
||||
$showtot=$tmparray['showtot'];
|
||||
$tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true);
|
||||
$endyear = $tmparray['year'];
|
||||
$shownb = $tmparray['shownb'];
|
||||
$showtot = $tmparray['showtot'];
|
||||
}
|
||||
if (empty($shownb) && empty($showtot)) { $shownb=1; $showtot=1; }
|
||||
$nowarray=dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear=$nowarray['year'];
|
||||
$startyear=$endyear-1;
|
||||
$WIDTH=(($shownb && $showtot) || ! empty($conf->dol_optimize_smallscreen))?'256':'320';
|
||||
$HEIGHT='192';
|
||||
if (empty($shownb) && empty($showtot)) { $shownb = 1; $showtot = 1; }
|
||||
$nowarray = dol_getdate(dol_now(), true);
|
||||
if (empty($endyear)) $endyear = $nowarray['year'];
|
||||
$startyear = $endyear - 1;
|
||||
$WIDTH = (($shownb && $showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320';
|
||||
$HEIGHT = '192';
|
||||
|
||||
$stats = new PropaleStats($this->db, $socid, 0);
|
||||
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($shownb)
|
||||
{
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$datatype1 = array_pad(array(), ($endyear-$startyear+1), 'bars');
|
||||
$data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
$datatype1 = array_pad(array(), ($endyear - $startyear + 1), 'bars');
|
||||
|
||||
$filenamenb = $dir."/".$prefix."propalsnbinyear-".$endyear.".png";
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propalsnbinyear-'.$endyear.'.png';
|
||||
|
||||
$px1 = new DolGraph();
|
||||
$mesg = $px1->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$px1->SetType($datatype1);
|
||||
$px1->SetData($data1);
|
||||
unset($data1);
|
||||
$i=$startyear;$legend=array();
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -165,7 +165,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
$px1->SetShading(3);
|
||||
$px1->SetHorizTickIncrement(1);
|
||||
$px1->SetCssPrefix("cssboxes");
|
||||
$px1->mode='depth';
|
||||
$px1->mode = 'depth';
|
||||
$px1->SetTitle($langs->trans("NumberOfProposalsByMonth"));
|
||||
|
||||
$px1->draw($filenamenb, $fileurlnb);
|
||||
@ -175,8 +175,8 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($showtot)
|
||||
{
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth);
|
||||
$datatype2 = array_pad(array(), ($endyear-$startyear+1), 'bars');
|
||||
$data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), ($WIDTH < 300 ? 2 : 0), $startmonth);
|
||||
$datatype2 = array_pad(array(), ($endyear - $startyear + 1), 'bars');
|
||||
//$datatype2 = array('lines','bars');
|
||||
|
||||
$filenamenb = $dir."/".$prefix."propalsamountinyear-".$endyear.".png";
|
||||
@ -185,21 +185,21 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
|
||||
$px2 = new DolGraph();
|
||||
$mesg = $px2->isGraphKo();
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$px2->SetType($datatype2);
|
||||
$px2->SetData($data2);
|
||||
unset($data2);
|
||||
$i=$startyear;$legend=array();
|
||||
$i = $startyear; $legend = array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
if ($startmonth != 1)
|
||||
{
|
||||
$legend[]=sprintf("%d/%d", $i-2001, $i-2000);
|
||||
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
$legend[]=$i;
|
||||
$legend[] = $i;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -211,7 +211,7 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
$px2->SetShading(3);
|
||||
$px2->SetHorizTickIncrement(1);
|
||||
$px2->SetCssPrefix("cssboxes");
|
||||
$px2->mode='depth';
|
||||
$px2->mode = 'depth';
|
||||
$px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT"));
|
||||
|
||||
$px2->draw($filenamenb, $fileurlnb);
|
||||
@ -221,49 +221,49 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg=$langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
$mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs");
|
||||
}
|
||||
|
||||
if (! $mesg)
|
||||
if (!$mesg)
|
||||
{
|
||||
$stringtoshow='';
|
||||
$stringtoshow.='<script type="text/javascript" language="javascript">
|
||||
$stringtoshow = '';
|
||||
$stringtoshow .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery("#idfilter'.$this->boxcode.'").toggle();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow.='<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked':'').'> '.$langs->trans("NumberOfProposalsByMonth");
|
||||
$stringtoshow.=' ';
|
||||
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked':'').'> '.$langs->trans("AmountOfProposalsByMonthHT");
|
||||
$stringtoshow.='<br>';
|
||||
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow.='<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow.='</form>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
|
||||
$stringtoshow .= '<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
$stringtoshow .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$stringtoshow .= '<input type="hidden" name="action" value="'.$refreshaction.'">';
|
||||
$stringtoshow .= '<input type="hidden" name="page_y" value="">';
|
||||
$stringtoshow .= '<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_shownb.'"'.($shownb ? ' checked' : '').'> '.$langs->trans("NumberOfProposalsByMonth");
|
||||
$stringtoshow .= ' ';
|
||||
$stringtoshow .= '<input type="checkbox" name="'.$param_showtot.'"'.($showtot ? ' checked' : '').'> '.$langs->trans("AmountOfProposalsByMonthHT");
|
||||
$stringtoshow .= '<br>';
|
||||
$stringtoshow .= $langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
|
||||
$stringtoshow .= '<input type="image" class="reposition inline-block valigntextbottom" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"), 'refresh.png', '', '', 1).'">';
|
||||
$stringtoshow .= '</form>';
|
||||
$stringtoshow .= '</div>';
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='<div class="fichecenter">';
|
||||
$stringtoshow.='<div class="fichehalfleft">';
|
||||
$stringtoshow .= '<div class="fichecenter">';
|
||||
$stringtoshow .= '<div class="fichehalfleft">';
|
||||
}
|
||||
if ($shownb) $stringtoshow.=$px1->show();
|
||||
if ($shownb) $stringtoshow .= $px1->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='<div class="fichehalfright">';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '<div class="fichehalfright">';
|
||||
}
|
||||
if ($showtot) $stringtoshow.=$px2->show();
|
||||
if ($showtot) $stringtoshow .= $px2->show();
|
||||
if ($shownb && $showtot)
|
||||
{
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow.='</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
$stringtoshow .= '</div>';
|
||||
}
|
||||
$this->info_box_contents[0][0] = array(
|
||||
'tr'=>'class="oddeven nohover"',
|
||||
|
||||
@ -118,16 +118,16 @@ class box_task extends ModeleBoxes
|
||||
|
||||
// list the summary of the orders
|
||||
if ($user->rights->projet->lire) {
|
||||
$boxcontent.= '<div id="ancor-idfilter'.$this->boxcode.'" style="display: block; position: absolute; margin-top: -100px"></div>'."\n";
|
||||
$boxcontent.= '<div id="idfilter'.$this->boxcode.'" class="center" >'."\n";
|
||||
$boxcontent.= '<form class="flat " method="POST" action="'.$_SERVER["PHP_SELF"].'#ancor-idfilter'.$this->boxcode.'">'."\n";
|
||||
$boxcontent.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
$boxcontent .= '<div id="ancor-idfilter'.$this->boxcode.'" style="display: block; position: absolute; margin-top: -100px"></div>'."\n";
|
||||
$boxcontent .= '<div id="idfilter'.$this->boxcode.'" class="center" >'."\n";
|
||||
$boxcontent .= '<form class="flat " method="POST" action="'.$_SERVER["PHP_SELF"].'#ancor-idfilter'.$this->boxcode.'">'."\n";
|
||||
$boxcontent .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
||||
$selectArray = array('all' => $langs->trans("NoFilter"), 'im_task_contact' => $langs->trans("WhichIamLinkedTo"), 'im_project_contact' => $langs->trans("WhichIamLinkedToProject"));
|
||||
$boxcontent.= $form->selectArray($cookie_name, $selectArray, $filterValue);
|
||||
$boxcontent.= '<button type="submit" class="button">'.$langs->trans("Refresh").'</button>';
|
||||
$boxcontent.= '</form>'."\n";
|
||||
$boxcontent.= '</div>'."\n";
|
||||
$boxcontent.= '<script type="text/javascript" language="javascript">
|
||||
$boxcontent .= $form->selectArray($cookie_name, $selectArray, $filterValue);
|
||||
$boxcontent .= '<button type="submit" class="button">'.$langs->trans("Refresh").'</button>';
|
||||
$boxcontent .= '</form>'."\n";
|
||||
$boxcontent .= '</div>'."\n";
|
||||
$boxcontent .= '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
|
||||
jQuery(".showiffilter'.$this->boxcode.'").toggle();
|
||||
|
||||
@ -621,7 +621,7 @@ abstract class CommonObject
|
||||
$thirdpartyid = $object->fk_soc;
|
||||
}
|
||||
|
||||
$out = '<!-- BEGIN part to show address block -->';
|
||||
$out = '';
|
||||
|
||||
$outdone = 0;
|
||||
$coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT);
|
||||
@ -682,7 +682,7 @@ abstract class CommonObject
|
||||
$out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax")); $outdone++;
|
||||
}
|
||||
|
||||
$out .= '<div style="clear: both;"></div>';
|
||||
if ($out) $out .= '<div style="clear: both;"></div>';
|
||||
$outdone = 0;
|
||||
if (!empty($this->email))
|
||||
{
|
||||
@ -695,32 +695,36 @@ abstract class CommonObject
|
||||
$out .= dol_print_url($this->url, '_blank', 0, 1);
|
||||
$outdone++;
|
||||
}
|
||||
$out .= '<div style="clear: both;">';
|
||||
|
||||
if (!empty($conf->socialnetworks->enabled))
|
||||
{
|
||||
$outsocialnetwork = '';
|
||||
|
||||
if (is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
|
||||
foreach ($this->socialnetworks as $key => $value) {
|
||||
$out .= dol_print_socialnetworks($value, $this->id, $object->id, $key);
|
||||
$outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key);
|
||||
$outdone++;
|
||||
}
|
||||
} else {
|
||||
if ($this->skype) $out .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
||||
if ($this->skype) $outsocialnetwork .= dol_print_socialnetworks($this->skype, $this->id, $object->id, 'skype');
|
||||
$outdone++;
|
||||
if ($this->jabberid) $out .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
||||
if ($this->jabberid) $outsocialnetwork .= dol_print_socialnetworks($this->jabberid, $this->id, $object->id, 'jabber');
|
||||
$outdone++;
|
||||
if ($this->twitter) $out .= dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
|
||||
if ($this->twitter) $outsocialnetwork .= dol_print_socialnetworks($this->twitter, $this->id, $object->id, 'twitter');
|
||||
$outdone++;
|
||||
if ($this->facebook) $out .= dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
|
||||
if ($this->facebook) $outsocialnetwork .= dol_print_socialnetworks($this->facebook, $this->id, $object->id, 'facebook');
|
||||
$outdone++;
|
||||
if ($this->linkedin) $out .= dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
|
||||
if ($this->linkedin) $outsocialnetwork .= dol_print_socialnetworks($this->linkedin, $this->id, $object->id, 'linkedin');
|
||||
$outdone++;
|
||||
}
|
||||
|
||||
if ($outsocialnetwork) {
|
||||
$out .= '<div style="clear: both;">'.$outsocialnetwork.'</div>';
|
||||
}
|
||||
}
|
||||
$out .= '</div>';
|
||||
|
||||
$out .= '<!-- END Part to show address block -->';
|
||||
|
||||
return $out;
|
||||
if ($out) return '<!-- BEGIN part to show address block -->'."\n".$out.'<!-- END Part to show address block -->'."\n";
|
||||
else return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4118,7 +4122,7 @@ abstract class CommonObject
|
||||
|
||||
$i = 0;
|
||||
|
||||
print "<tbody>\n";
|
||||
print "<!-- begin printObjectLines() --><tbody>\n";
|
||||
foreach ($this->lines as $line)
|
||||
{
|
||||
//Line extrafield
|
||||
@ -4956,11 +4960,11 @@ abstract class CommonObject
|
||||
* NB: Error from trigger are stacked in interface->errors
|
||||
* NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction.
|
||||
*
|
||||
* @param string $trigger_name trigger's name to execute
|
||||
* @param string $triggerName trigger's name to execute
|
||||
* @param User $user Object user
|
||||
* @return int Result of run_triggers
|
||||
*/
|
||||
public function call_trigger($trigger_name, $user)
|
||||
public function call_trigger($triggerName, $user)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
@ -4972,7 +4976,7 @@ abstract class CommonObject
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
||||
$interface = new Interfaces($this->db);
|
||||
$result = $interface->run_triggers($trigger_name, $this, $user, $langs, $conf);
|
||||
$result = $interface->run_triggers($triggerName, $this, $user, $langs, $conf);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -7317,7 +7321,7 @@ abstract class CommonObject
|
||||
global $conf;
|
||||
|
||||
$queryarray = array();
|
||||
foreach ($this->fields as $field=>$info) // Loop on definition of fields
|
||||
foreach ($this->fields as $field => $info) // Loop on definition of fields
|
||||
{
|
||||
// Depending on field type ('datetime', ...)
|
||||
if ($this->isDate($info))
|
||||
@ -7553,6 +7557,8 @@ abstract class CommonObject
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
} else {
|
||||
$this->ref = '(PROV'.$this->id.')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -689,6 +689,11 @@ class DiscountAbsolute
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$link = '';
|
||||
$linkend = '';
|
||||
$label = '';
|
||||
$picto = '';
|
||||
$ref = '';
|
||||
|
||||
if ($option == 'invoice') {
|
||||
$facid=! empty($this->discount_type)?$this->fk_invoice_supplier_source:$this->fk_facture_source;
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
*/
|
||||
class DolEditor
|
||||
{
|
||||
public $tool; // Store the selected tool
|
||||
public $tool; // Store the selected tool
|
||||
|
||||
// If using fckeditor
|
||||
public $editor;
|
||||
@ -66,55 +66,55 @@ class DolEditor
|
||||
*/
|
||||
public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::DolEditor htmlname=".$htmlname." width=".$width." height=".$height." toolbarname=".$toolbarname);
|
||||
|
||||
if (! $rows) $rows=round($height/20);
|
||||
if (! $cols) $cols=($width?round($width/6):80);
|
||||
$shorttoolbarname=preg_replace('/_encoded$/', '', $toolbarname);
|
||||
if (!$rows) $rows = round($height / 20);
|
||||
if (!$cols) $cols = ($width ?round($width / 6) : 80);
|
||||
$shorttoolbarname = preg_replace('/_encoded$/', '', $toolbarname);
|
||||
|
||||
// Name of extended editor to use (FCKEDITOR_EDITORNAME can be 'ckeditor' or 'fckeditor')
|
||||
$defaulteditor='ckeditor';
|
||||
$this->tool=empty($conf->global->FCKEDITOR_EDITORNAME)?$defaulteditor:$conf->global->FCKEDITOR_EDITORNAME;
|
||||
$this->uselocalbrowser=$uselocalbrowser;
|
||||
$this->readonly=$readonly;
|
||||
$defaulteditor = 'ckeditor';
|
||||
$this->tool = empty($conf->global->FCKEDITOR_EDITORNAME) ? $defaulteditor : $conf->global->FCKEDITOR_EDITORNAME;
|
||||
$this->uselocalbrowser = $uselocalbrowser;
|
||||
$this->readonly = $readonly;
|
||||
|
||||
// Check if extended editor is ok. If not we force textarea
|
||||
if ((empty($conf->fckeditor->enabled) && $okforextendededitor != 'ace') || empty($okforextendededitor)) $this->tool = 'textarea';
|
||||
if ($okforextendededitor === 'ace') $this->tool='ace';
|
||||
if ($okforextendededitor === 'ace') $this->tool = 'ace';
|
||||
//if ($conf->dol_use_jmobile) $this->tool = 'textarea'; // ckeditor and ace seems ok with mobile
|
||||
|
||||
// Define content and some properties
|
||||
if ($this->tool == 'ckeditor')
|
||||
{
|
||||
$content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
|
||||
$content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
|
||||
}
|
||||
if ($this->tool == 'fckeditor')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php';
|
||||
|
||||
$content=dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
|
||||
$content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML.
|
||||
|
||||
$this->editor = new FCKeditor($htmlname);
|
||||
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/' ;
|
||||
$this->editor->Value = $content;
|
||||
$this->editor->BasePath = DOL_URL_ROOT.'/includes/fckeditor/';
|
||||
$this->editor->Value = $content;
|
||||
$this->editor->Height = $height;
|
||||
if (! empty($width)) $this->editor->Width = $width;
|
||||
$this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js
|
||||
$this->editor->Config['AutoDetectLanguage'] = 'true'; // Language of user (browser)
|
||||
if (!empty($width)) $this->editor->Width = $width;
|
||||
$this->editor->ToolbarSet = $shorttoolbarname; // Profile of this toolbar set is deinfed into theme/mytheme/ckeditor/config.js
|
||||
$this->editor->Config['AutoDetectLanguage'] = 'true'; // Language of user (browser)
|
||||
$this->editor->Config['ToolbarLocation'] = $toolbarlocation ? $toolbarlocation : 'In';
|
||||
$this->editor->Config['ToolbarStartExpanded'] = $toolbarstartexpanded;
|
||||
|
||||
// Rem: Le forcage de ces 2 parametres ne semble pas fonctionner.
|
||||
// Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart.
|
||||
// Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ?
|
||||
$modulepart='fckeditor';
|
||||
$modulepart = 'fckeditor';
|
||||
$this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file=';
|
||||
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ;
|
||||
$this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/';
|
||||
|
||||
$this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false');
|
||||
$this->editor->Config['ImageBrowser']=($uselocalbrowser?'true':'false');
|
||||
$this->editor->Config['LinkBrowser'] = ($uselocalbrowser ? 'true' : 'false');
|
||||
$this->editor->Config['ImageBrowser'] = ($uselocalbrowser ? 'true' : 'false');
|
||||
|
||||
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'))
|
||||
{
|
||||
@ -124,15 +124,15 @@ class DolEditor
|
||||
}
|
||||
|
||||
// Define some properties
|
||||
if (in_array($this->tool, array('textarea','ckeditor','ace')))
|
||||
if (in_array($this->tool, array('textarea', 'ckeditor', 'ace')))
|
||||
{
|
||||
$this->content = $content;
|
||||
$this->content = $content;
|
||||
$this->htmlname = $htmlname;
|
||||
$this->toolbarname = $shorttoolbarname;
|
||||
$this->toolbarname = $shorttoolbarname;
|
||||
$this->toolbarstartexpanded = $toolbarstartexpanded;
|
||||
$this->rows = max(ROWS_3, $rows);
|
||||
$this->cols = (preg_match('/%/', $cols)?$cols:max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max
|
||||
$this->height = $height;
|
||||
$this->cols = (preg_match('/%/', $cols) ? $cols : max(40, $cols)); // If $cols is a percent, we keep it, otherwise, we take max
|
||||
$this->height = $height;
|
||||
$this->width = $width;
|
||||
}
|
||||
}
|
||||
@ -152,57 +152,58 @@ class DolEditor
|
||||
public function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$fullpage=false;
|
||||
$fullpage = false;
|
||||
if (isset($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT))
|
||||
{
|
||||
$disallowAnyContent=empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
|
||||
$disallowAnyContent = empty($conf->global->FCKEDITOR_ALLOW_ANY_CONTENT); // Only predefined list of html tags are allowed or all
|
||||
}
|
||||
|
||||
$found=0;
|
||||
$out='';
|
||||
$found = 0;
|
||||
$out = '';
|
||||
|
||||
if ($this->tool == 'fckeditor') // not used anymore
|
||||
{
|
||||
$found=1;
|
||||
$found = 1;
|
||||
$this->editor->Create();
|
||||
}
|
||||
if (in_array($this->tool, array('textarea','ckeditor')))
|
||||
if (in_array($this->tool, array('textarea', 'ckeditor')))
|
||||
{
|
||||
$found=1;
|
||||
$found = 1;
|
||||
//$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" '.($this->readonly?' disabled':'').' rows="'.$this->rows.'"'.(preg_match('/%/',$this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
|
||||
// TODO We do not put the disabled tag because on a read form, it change style with grey.
|
||||
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/', $this->cols)?' style="margin-top: 5px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
|
||||
$out.= htmlspecialchars($this->content);
|
||||
$out.= '</textarea>';
|
||||
$out .= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/', $this->cols) ? ' style="margin-top: 5px; width: '.$this->cols.'"' : ' cols="'.$this->cols.'"').' class="flat">';
|
||||
$out .= htmlspecialchars($this->content);
|
||||
$out .= '</textarea>';
|
||||
|
||||
if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax) && ! empty($conf->fckeditor->enabled))
|
||||
if ($this->tool == 'ckeditor' && !empty($conf->use_javascript_ajax) && !empty($conf->fckeditor->enabled))
|
||||
{
|
||||
if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR', '1');
|
||||
if (!defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR', '1');
|
||||
|
||||
if (! empty($conf->global->FCKEDITOR_SKIN)) {
|
||||
if (!empty($conf->global->FCKEDITOR_SKIN)) {
|
||||
$skin = $conf->global->FCKEDITOR_SKIN;
|
||||
} else {
|
||||
$skin = 'moono-lisa'; // default with ckeditor 4.6 : moono-lisa
|
||||
}
|
||||
|
||||
$htmlencode_force=preg_match('/_encoded$/', $this->toolbarname)?'true':'false';
|
||||
$htmlencode_force = preg_match('/_encoded$/', $this->toolbarname) ? 'true' : 'false';
|
||||
|
||||
$out.= '<!-- Output ckeditor $disallowAnyContent='.$disallowAnyContent.' toolbarname='.$this->toolbarname.' -->'."\n";
|
||||
$out.= '<script type="text/javascript">
|
||||
$out .= '<!-- Output ckeditor $disallowAnyContent='.$disallowAnyContent.' toolbarname='.$this->toolbarname.' -->'."\n";
|
||||
$out .= '<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
/* console.log("Run ckeditor"); */
|
||||
/* if (CKEDITOR.loadFullCore) CKEDITOR.loadFullCore(); */
|
||||
/* should be editor=CKEDITOR.replace but what if serveral editors ? */
|
||||
CKEDITOR.replace(\''.$this->htmlname.'\',
|
||||
{
|
||||
/* property:xxx is same than CKEDITOR.config.property = xxx */
|
||||
customConfig : ckeditorConfig,
|
||||
readOnly : '.($this->readonly?'true':'false').',
|
||||
readOnly : '.($this->readonly ? 'true' : 'false').',
|
||||
htmlEncodeOutput :'.$htmlencode_force.',
|
||||
allowedContent :'.($disallowAnyContent?'false':'true').',
|
||||
allowedContent :'.($disallowAnyContent ? 'false' : 'true').',
|
||||
extraAllowedContent : \'\',
|
||||
fullPage : '.($fullpage?'true':'false').',
|
||||
fullPage : '.($fullpage ? 'true' : 'false').',
|
||||
toolbar: \''.$this->toolbarname.'\',
|
||||
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
|
||||
width: '.($this->width ? '\''.$this->width.'\'' : '\'\'').',
|
||||
@ -225,15 +226,16 @@ class DolEditor
|
||||
});
|
||||
}
|
||||
}';
|
||||
|
||||
if ($this->uselocalbrowser)
|
||||
{
|
||||
$out.= ','."\n";
|
||||
$out .= ','."\n";
|
||||
// To use filemanager with old fckeditor (GPL)
|
||||
$out.= ' filebrowserBrowseUrl : ckeditorFilebrowserBrowseUrl,';
|
||||
$out.= ' filebrowserImageBrowseUrl : ckeditorFilebrowserImageBrowseUrl,';
|
||||
$out .= ' filebrowserBrowseUrl : ckeditorFilebrowserBrowseUrl,';
|
||||
$out .= ' filebrowserImageBrowseUrl : ckeditorFilebrowserImageBrowseUrl,';
|
||||
//$out.= ' filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=File\',';
|
||||
//$out.= ' filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=Image\',';
|
||||
$out.= "\n";
|
||||
$out .= "\n";
|
||||
// To use filemanager with ckfinder (Non free) and ckfinder directory is inside htdocs/includes
|
||||
/* $out.= ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html\',
|
||||
filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Images\',
|
||||
@ -242,14 +244,14 @@ class DolEditor
|
||||
filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
|
||||
filebrowserFlashUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\','."\n";
|
||||
*/
|
||||
$out.= ' filebrowserWindowWidth : \'900\',
|
||||
$out .= ' filebrowserWindowWidth : \'900\',
|
||||
filebrowserWindowHeight : \'500\',
|
||||
filebrowserImageWindowWidth : \'900\',
|
||||
filebrowserImageWindowHeight : \'500\'';
|
||||
}
|
||||
$out.= ' })'.$morejs;
|
||||
$out.= '});'."\n";
|
||||
$out.= '</script>'."\n";
|
||||
$out .= ' })'.$morejs;
|
||||
$out .= '});'."\n";
|
||||
$out .= '</script>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,19 +259,19 @@ class DolEditor
|
||||
// Warning: ace.js and ext-statusbar.js must be loaded by the parent page.
|
||||
if (preg_match('/^ace/', $this->tool))
|
||||
{
|
||||
$found=1;
|
||||
$format=$option;
|
||||
$found = 1;
|
||||
$format = $option;
|
||||
|
||||
$out.= "\n".'<!-- Output Ace editor -->'."\n";
|
||||
$out .= "\n".'<!-- Output Ace editor -->'."\n";
|
||||
|
||||
if ($titlecontent)
|
||||
{
|
||||
$out.= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
|
||||
$out.= ' - <a id="morelines" href="#" class="right morelines'.$this->htmlname.' reposition">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> ';
|
||||
$out.= '</div>';
|
||||
$out.= '<script type="text/javascript" language="javascript">'."\n";
|
||||
$out.= 'jQuery(document).ready(function() {'."\n";
|
||||
$out.= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||
$out .= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
|
||||
$out .= ' - <a id="morelines" href="#" class="right morelines'.$this->htmlname.' reposition">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> ';
|
||||
$out .= '</div>';
|
||||
$out .= '<script type="text/javascript" language="javascript">'."\n";
|
||||
$out .= 'jQuery(document).ready(function() {'."\n";
|
||||
$out .= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
|
||||
var statusBar = new StatusBar(aceEditor, document.getElementById("statusBar'.$this->htmlname.'")); // Init status bar. Need lib ext-statusbar
|
||||
var oldNbOfLines = 0
|
||||
@ -291,21 +293,21 @@ class DolEditor
|
||||
}
|
||||
});
|
||||
})';
|
||||
$out.= '</script>'."\n";
|
||||
$out .= '</script>'."\n";
|
||||
}
|
||||
|
||||
$out.= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width?'width: '.$this->width.'px; ':'');
|
||||
$out.= ($this->height?' height: '.$this->height.'px; ':'');
|
||||
$out .= '<pre id="'.$this->htmlname.'aceeditorid" style="'.($this->width ? 'width: '.$this->width.'px; ' : '');
|
||||
$out .= ($this->height ? ' height: '.$this->height.'px; ' : '');
|
||||
//$out.=" min-height: 100px;";
|
||||
$out.= '">';
|
||||
$out.= htmlspecialchars($this->content);
|
||||
$out.= '</pre>';
|
||||
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
|
||||
$out.= htmlspecialchars($this->content);
|
||||
$out.= '</textarea>';
|
||||
$out .= '">';
|
||||
$out .= htmlspecialchars($this->content);
|
||||
$out .= '</pre>';
|
||||
$out .= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" style="width:0px; height: 0px; display: none;">';
|
||||
$out .= htmlspecialchars($this->content);
|
||||
$out .= '</textarea>';
|
||||
|
||||
$out.= '<script type="text/javascript" language="javascript">'."\n";
|
||||
$out.= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||
$out .= '<script type="text/javascript" language="javascript">'."\n";
|
||||
$out .= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
|
||||
|
||||
aceEditor.session.setMode("ace/mode/'.$format.'");
|
||||
aceEditor.setOptions({
|
||||
@ -313,7 +315,7 @@ class DolEditor
|
||||
enableLiveAutocompletion: false, // the editor completes the statement while you are typing. Need lib ext-language_tools.js
|
||||
showPrintMargin: false, // hides the vertical limiting strip
|
||||
minLines: 10,
|
||||
maxLines: '.(empty($this->height)?'34':(round($this->height/10))).',
|
||||
maxLines: '.(empty($this->height) ? '34' : (round($this->height / 10))).',
|
||||
fontSize: "110%" // ensures that the editor fits in the environment
|
||||
});
|
||||
|
||||
@ -325,7 +327,7 @@ class DolEditor
|
||||
//aceEditor.getSession().setMode("ace/mode/javascript_expression");
|
||||
'."\n";
|
||||
|
||||
$out.= 'jQuery(document).ready(function() {
|
||||
$out .= 'jQuery(document).ready(function() {
|
||||
jQuery(".buttonforacesave").click(function() {
|
||||
console.log("We click on savefile button for component '.$this->htmlname.'");
|
||||
var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid")
|
||||
@ -335,12 +337,12 @@ class DolEditor
|
||||
else return false;*/
|
||||
});
|
||||
})';
|
||||
$out.= '</script>'."\n";
|
||||
$out .= '</script>'."\n";
|
||||
}
|
||||
|
||||
if (empty($found))
|
||||
{
|
||||
$out.= 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.';
|
||||
$out .= 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.';
|
||||
}
|
||||
|
||||
if ($noprint) return $out;
|
||||
|
||||
@ -185,7 +185,7 @@ class Form
|
||||
$ret .= "\n";
|
||||
$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
|
||||
$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
$ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
|
||||
if (empty($notabletag)) $ret .= '<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
|
||||
if (empty($notabletag)) $ret .= '<tr><td>';
|
||||
@ -228,6 +228,7 @@ class Form
|
||||
elseif (preg_match('/^select;/', $typeofdata))
|
||||
{
|
||||
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
|
||||
$arraylist = array();
|
||||
foreach ($arraydata as $val)
|
||||
{
|
||||
$tmp = explode(':', $val);
|
||||
@ -265,6 +266,7 @@ class Form
|
||||
elseif (preg_match('/^select;/', $typeofdata))
|
||||
{
|
||||
$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
|
||||
$arraylist = array();
|
||||
foreach ($arraydata as $val)
|
||||
{
|
||||
$tmp = explode(':', $val);
|
||||
@ -825,7 +827,7 @@ class Form
|
||||
{
|
||||
$out .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="action" value="set_incoterms">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
}
|
||||
|
||||
$out .= '<select id="'.$htmlname.'" class="flat selectincoterm minwidth100imp noenlargeonsmartphone" name="'.$htmlname.'" '.$htmloption.'>';
|
||||
@ -3548,7 +3550,7 @@ class Form
|
||||
|
||||
$return = '';
|
||||
|
||||
$return .= '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$return .= '<select class="flat maxwidth75" id="select_'.$htmlname.'" name="'.$htmlname.'">';
|
||||
$options = array(
|
||||
'HT'=>$langs->trans("HT"),
|
||||
'TTC'=>$langs->trans("TTC")
|
||||
@ -3642,7 +3644,7 @@ class Form
|
||||
if ($htmlname != "none") {
|
||||
print '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setshippingmethod">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$this->selectShippingMethod($selected, $htmlname, '', $addempty);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -3918,7 +3920,7 @@ class Form
|
||||
if ($htmlname != "none") {
|
||||
print '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setbankaccount">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
|
||||
if ($nbaccountfound > 0) print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -3951,10 +3953,11 @@ class Form
|
||||
* - array (list of categories ids)
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param int $include [=0] Removed or 1=Keep only
|
||||
* @param string $morecss More CSS
|
||||
* @return string
|
||||
* @see select_categories()
|
||||
*/
|
||||
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0)
|
||||
public function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $markafterid = 0, $outputmode = 0, $include = 0, $morecss = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
@ -3997,7 +4000,7 @@ class Form
|
||||
$cate_arbo = $cat->get_full_arbo($type, $markafterid, $include);
|
||||
}
|
||||
|
||||
$output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$output = '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
$outarray = array();
|
||||
if (is_array($cate_arbo))
|
||||
{
|
||||
@ -4114,7 +4117,9 @@ class Form
|
||||
|
||||
// Now add questions
|
||||
$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
|
||||
if (!empty($formquestion['text'])) $more .= '<tr><td colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
|
||||
if (!empty($formquestion['text'])) {
|
||||
$more .= '<div class="tagtr"><div class="tagtd">'.$formquestion['text'].'</div></div>'."\n";
|
||||
}
|
||||
foreach ($formquestion as $key => $input)
|
||||
{
|
||||
if (is_array($input) && !empty($input))
|
||||
@ -4256,7 +4261,7 @@ class Form
|
||||
closeOnEscape: false,
|
||||
buttons: {
|
||||
"'.dol_escape_js($langs->transnoentities("Yes")).'": function() {
|
||||
var options = "&token='.urlencode($_SESSION['newtoken']).'";
|
||||
var options = "&token='.urlencode(newToken()).'";
|
||||
var inputok = '.json_encode($inputok).';
|
||||
var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
|
||||
if (inputok.length>0) {
|
||||
@ -4275,7 +4280,7 @@ class Form
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"'.dol_escape_js($langs->transnoentities("No")).'": function() {
|
||||
var options = "&token='.urlencode($_SESSION['newtoken']).'";
|
||||
var options = "&token='.urlencode(newToken()).'";
|
||||
var inputko = '.json_encode($inputko).';
|
||||
var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'";
|
||||
if (inputko.length>0) {
|
||||
@ -4314,7 +4319,7 @@ class Form
|
||||
if (empty($disableformtag)) $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
|
||||
|
||||
$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
|
||||
$formconfirm .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
||||
|
||||
$formconfirm .= '<table class="valid centpercent">'."\n";
|
||||
|
||||
@ -4382,7 +4387,7 @@ class Form
|
||||
$out .= "\n";
|
||||
$out .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="action" value="classin">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1);
|
||||
$out .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
$out .= '</form>';
|
||||
@ -4428,7 +4433,7 @@ class Form
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setconditions">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$this->select_conditions_paiements($selected, $htmlname, -1, $addempty);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -4463,7 +4468,7 @@ class Form
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setavailability">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -4497,7 +4502,7 @@ class Form
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setdemandreason">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$this->selectInputReason($selected, $htmlname, -1, $addempty);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -4545,7 +4550,7 @@ class Form
|
||||
{
|
||||
$ret .= '<form method="post" action="'.$page.'" name="form'.$htmlname.'">';
|
||||
$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
$ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$ret .= '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
$ret .= '<tr><td>';
|
||||
$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
|
||||
@ -4584,7 +4589,7 @@ class Form
|
||||
{
|
||||
print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
|
||||
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -4624,7 +4629,7 @@ class Form
|
||||
{
|
||||
print '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setmode">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -4658,7 +4663,7 @@ class Form
|
||||
{
|
||||
print '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setmulticurrencycode">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print $this->selectMultiCurrency($selected, $htmlname, 0);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
@ -4689,7 +4694,7 @@ class Form
|
||||
{
|
||||
print '<form method="POST" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setmulticurrencyrate">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="text" name="'.$htmlname.'" value="'.(!empty($rate) ? price($rate) : 1).'" size="10" /> ';
|
||||
print '<select name="calculation_mode">';
|
||||
print '<option value="1">'.$currency.' > '.$conf->currency.'</option>';
|
||||
@ -4737,7 +4742,7 @@ class Form
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setabsolutediscount">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<div class="inline-block">';
|
||||
if (!empty($discount_type)) {
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
@ -4829,7 +4834,7 @@ class Form
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="set_contact">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$num = $this->select_contacts($societe->id, $selected, $htmlname);
|
||||
@ -4869,7 +4874,7 @@ class Form
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param int $nooutput No print output. Return it only.
|
||||
* @return void
|
||||
* @return void|string
|
||||
*/
|
||||
public function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0)
|
||||
{
|
||||
@ -4881,7 +4886,7 @@ class Form
|
||||
{
|
||||
$out .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="action" value="set_thirdparty">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events);
|
||||
$out .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$out .= '</form>';
|
||||
@ -6940,7 +6945,7 @@ class Form
|
||||
print '<br>';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
|
||||
print '<input type="hidden" name="action" value="addlink">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="addlink" value="'.$key.'">';
|
||||
print '<table class="noborder">';
|
||||
|
||||
@ -37,7 +37,7 @@ class FormBarCode
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
public $error = '';
|
||||
|
||||
|
||||
/**
|
||||
@ -81,8 +81,8 @@ class FormBarCode
|
||||
}
|
||||
|
||||
// We check if barcode is already selected by default
|
||||
if (((! empty($conf->product->enabled) || ! empty($conf->service->enabled)) && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) ||
|
||||
(! empty($conf->societe->enabled) && $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY == $code_id))
|
||||
if (((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE == $code_id) ||
|
||||
(!empty($conf->societe->enabled) && $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY == $code_id))
|
||||
{
|
||||
$disable = 'disabled';
|
||||
}
|
||||
@ -90,24 +90,24 @@ class FormBarCode
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$select_encoder = '<form action="'.DOL_URL_ROOT.'/admin/barcode.php" method="POST" id="form'.$idForm.'">';
|
||||
$select_encoder.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$select_encoder.= '<input type="hidden" name="action" value="update">';
|
||||
$select_encoder.= '<input type="hidden" name="code_id" value="'.$code_id.'">';
|
||||
$select_encoder .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$select_encoder .= '<input type="hidden" name="action" value="update">';
|
||||
$select_encoder .= '<input type="hidden" name="code_id" value="'.$code_id.'">';
|
||||
}
|
||||
|
||||
$selectname=(!empty($conf->use_javascript_ajax)?'coder':'coder'.$code_id);
|
||||
$select_encoder.= '<select id="select'.$idForm.'" class="flat" name="'.$selectname.'">';
|
||||
$select_encoder.= '<option value="0"'.($selected==0?' selected':'').' '.$disable.'>'.$langs->trans('Disable').'</option>';
|
||||
$select_encoder.= '<option value="-1" disabled>--------------------</option>';
|
||||
foreach($barcodelist as $key => $value)
|
||||
$selectname = (!empty($conf->use_javascript_ajax) ? 'coder' : 'coder'.$code_id);
|
||||
$select_encoder .= '<select id="select'.$idForm.'" class="flat" name="'.$selectname.'">';
|
||||
$select_encoder .= '<option value="0"'.($selected == 0 ? ' selected' : '').' '.$disable.'>'.$langs->trans('Disable').'</option>';
|
||||
$select_encoder .= '<option value="-1" disabled>--------------------</option>';
|
||||
foreach ($barcodelist as $key => $value)
|
||||
{
|
||||
$select_encoder.= '<option value="'.$key.'"'.($selected==$key?' selected':'').'>'.$value.'</option>';
|
||||
$select_encoder .= '<option value="'.$key.'"'.($selected == $key ? ' selected' : '').'>'.$value.'</option>';
|
||||
}
|
||||
$select_encoder.= '</select>';
|
||||
$select_encoder .= '</select>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
$select_encoder.= '</form>';
|
||||
$select_encoder .= '</form>';
|
||||
}
|
||||
|
||||
return $select_encoder;
|
||||
@ -144,10 +144,10 @@ class FormBarCode
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT rowid, code, libelle";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql.= " WHERE coder <> '0'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||
$sql .= " WHERE coder <> '0'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY code";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -155,20 +155,20 @@ class FormBarCode
|
||||
$i = 0;
|
||||
|
||||
if ($useempty && $num > 0) {
|
||||
$out .= '<select class="flat minwidth75imp" name="' . $htmlname . '" id="select_' . $htmlname . '">';
|
||||
$out .= '<select class="flat minwidth75imp" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||
$out .= '<option value="0"> </option>';
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$out .= '<select disabled class="flat minwidth75imp" name="' . $htmlname . '" id="select_' . $htmlname . '">';
|
||||
$out .= '<option value="0" selected>' . $langs->trans('ErrorNoActivatedBarcode') . '</option>';
|
||||
$out .= '<select disabled class="flat minwidth75imp" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||
$out .= '<option value="0" selected>'.$langs->trans('ErrorNoActivatedBarcode').'</option>';
|
||||
}
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($selected == $obj->rowid) {
|
||||
$out .= '<option value="' . $obj->rowid . '" selected>';
|
||||
$out .= '<option value="'.$obj->rowid.'" selected>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->rowid . '">';
|
||||
$out .= '<option value="'.$obj->rowid.'">';
|
||||
}
|
||||
$out .= $obj->libelle;
|
||||
$out .= '</option>';
|
||||
@ -212,14 +212,14 @@ class FormBarCode
|
||||
global $langs, $conf;
|
||||
$out = '';
|
||||
if ($htmlname != "none") {
|
||||
$out .= '<form method="post" action="' . $page . '">';
|
||||
$out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
$out .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$out .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
$out .= '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
$out .= '<tr><td>';
|
||||
$out .= $this->selectBarcodeType($selected, $htmlname, 1);
|
||||
$out .= '</td>';
|
||||
$out .= '<td class="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||
$out .= '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
$out .= '</td></tr></table></form>';
|
||||
}
|
||||
return $out;
|
||||
|
||||
@ -135,7 +135,7 @@ class FormCompany extends Form
|
||||
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setprospectlevel">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG);
|
||||
$sql = "SELECT code, label";
|
||||
|
||||
@ -183,7 +183,7 @@ class FormContract
|
||||
print "\n";
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setcontract">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
|
||||
@ -118,7 +118,7 @@ class FormFile
|
||||
if (empty($usewithoutform)) // Try to avoid this and set instead the form by the caller.
|
||||
{
|
||||
$out .= '<form name="'.$htmlname.'" id="'.$htmlname.'" action="'.$url.'" enctype="multipart/form-data" method="POST">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$out .= '<input type="hidden" id="'.$htmlname.'_section_dir" name="section_dir" value="'.$sectiondir.'">';
|
||||
$out .= '<input type="hidden" id="'.$htmlname.'_section_id" name="section_id" value="'.$sectionid.'">';
|
||||
$out .= '<input type="hidden" name="sortfield" value="'.GETPOST('sortfield', 'alpha').'">';
|
||||
@ -232,7 +232,7 @@ class FormFile
|
||||
if (empty($usewithoutform))
|
||||
{
|
||||
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">'."\n";
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'."\n";
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
|
||||
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">'."\n";
|
||||
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">'."\n";
|
||||
}
|
||||
@ -707,7 +707,7 @@ class FormFile
|
||||
if ($conf->browser->layout == 'phone') $urlsource .= '#'.$forname.'_form'; // So we switch to form after a generation
|
||||
if (empty($noform)) $out .= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc').'" id="'.$forname.'_form" method="post">';
|
||||
$out .= '<input type="hidden" name="action" value="builddoc">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
$out .= load_fiche_titre($titletoshow, '', '');
|
||||
$out .= '<div class="div-table-responsive-no-min">';
|
||||
@ -1099,7 +1099,7 @@ class FormFile
|
||||
if ($disablecrop == -1)
|
||||
{
|
||||
$disablecrop = 1;
|
||||
if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'project', 'product', 'produit', 'service', 'societe', 'tax', 'ticket', 'user'))) $disablecrop = 0;
|
||||
if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'holiday', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'ticket', 'user'))) $disablecrop = 0;
|
||||
}
|
||||
|
||||
// Define relative path used to store the file
|
||||
@ -1178,7 +1178,7 @@ class FormFile
|
||||
if (GETPOST('action', 'aZ09') == 'editfile' && $permtoeditline)
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="renamefile">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||
@ -1496,7 +1496,7 @@ class FormFile
|
||||
if (!empty($addfilterfields))
|
||||
{
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="module" value="'.$modulepart.'">';
|
||||
}
|
||||
|
||||
@ -1790,7 +1790,7 @@ class FormFile
|
||||
print load_fiche_titre($langs->trans("LinkedFiles"));
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].($param ? '?'.$param : '').'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
print '<table width="100%" class="liste noborder nobottom">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@ -135,7 +135,7 @@ function limitChars(textarea, limit, infodiv)
|
||||
|
||||
if ($showform) print "<form method=\"POST\" name=\"smsform\" enctype=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
|
||||
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
foreach ($this->param as $key=>$value)
|
||||
{
|
||||
print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
|
||||
|
||||
@ -153,7 +153,7 @@ class FormTicket
|
||||
if ($withdolfichehead) dol_fiche_head(null, 'card', '', 0, '');
|
||||
|
||||
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="'.$this->action.'">';
|
||||
foreach ($this->param as $key => $value) {
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
||||
@ -200,7 +200,7 @@ class FormTicket
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">'.$langs->trans("TicketTypeRequest").'</span></label></td><td>';
|
||||
$this->selectTypesTickets((GETPOST('type_code') ? GETPOST('type_code') : $this->type_code), 'type_code', '', '2');
|
||||
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', '2', 0, 0, 0, 'minwidth150');
|
||||
print '</td></tr>';
|
||||
|
||||
// Severity
|
||||
@ -225,7 +225,7 @@ class FormTicket
|
||||
if ($this->withthreadid > 0) {
|
||||
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withthreadid.' : '.$this->topic_title.'';
|
||||
}
|
||||
print '<input class="text" size="50" id="subject" name="subject" value="'.(GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject).'" />';
|
||||
print '<input class="text minwidth300" id="subject" name="subject" value="'.(GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject).'" />';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -376,33 +376,33 @@ class FormTicket
|
||||
}
|
||||
|
||||
$out = '<tr>';
|
||||
$out .= '<td width="180">' . $langs->trans("MailFile") . '</td>';
|
||||
$out .= '<td colspan="2">';
|
||||
$out .= '<td>'.$langs->trans("MailFile").'</td>';
|
||||
$out .= '<td>';
|
||||
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
|
||||
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">' . "\n";
|
||||
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
||||
$out .= '<script type="text/javascript" language="javascript">';
|
||||
$out .= 'jQuery(document).ready(function () {';
|
||||
$out .= ' jQuery(".removedfile").click(function() {';
|
||||
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
|
||||
$out .= ' });';
|
||||
$out .= '})';
|
||||
$out .= '</script>' . "\n";
|
||||
$out .= '</script>'."\n";
|
||||
if (count($listofpaths)) {
|
||||
foreach ($listofpaths as $key => $val) {
|
||||
$out .= '<div id="attachfile_' . $key . '">';
|
||||
$out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key];
|
||||
$out .= '<div id="attachfile_'.$key.'">';
|
||||
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
|
||||
if (!$this->withfilereadonly) {
|
||||
$out .= ' <input type="image" style="border: 0px;" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/delete.png" value="' . ($key + 1) . '" class="removedfile" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />';
|
||||
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
|
||||
}
|
||||
$out .= '<br></div>';
|
||||
}
|
||||
} else {
|
||||
$out .= $langs->trans("NoAttachedFiles") . '<br>';
|
||||
$out .= $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
if ($this->withfile == 2) { // Can add other files
|
||||
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="' . $langs->trans("Upload") . '" />';
|
||||
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||
$out .= ' ';
|
||||
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="' . $langs->trans("MailingAddFile") . '" />';
|
||||
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="'.$langs->trans("MailingAddFile").'" />';
|
||||
}
|
||||
$out .= "</td></tr>\n";
|
||||
|
||||
@ -859,7 +859,7 @@ class FormTicket
|
||||
</script>';
|
||||
|
||||
print '<form method="post" name="ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="'.$this->action.'">';
|
||||
print '<input type="hidden" name="actionbis" value="add_message">';
|
||||
foreach ($this->param as $key => $value) {
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
* \ingroup notification
|
||||
* \brief File of class to manage notifications
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/CMailFile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -44,7 +44,7 @@ class Notify
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
@ -110,27 +110,27 @@ class Notify
|
||||
global $langs;
|
||||
$langs->load("mails");
|
||||
|
||||
$listofnotiftodo=$this->getNotificationsArray($action, $socid, $object, 0);
|
||||
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
|
||||
|
||||
$nb=-1;
|
||||
if (is_array($listofnotiftodo)) $nb=count($listofnotiftodo);
|
||||
if ($nb < 0) $texte=img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend");
|
||||
if ($nb == 0) $texte=img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
||||
if ($nb == 1) $texte=img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ANotificationsWillBeSent");
|
||||
if ($nb >= 2) $texte=img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("SomeNotificationsWillBeSent", $nb);
|
||||
$nb = -1;
|
||||
if (is_array($listofnotiftodo)) $nb = count($listofnotiftodo);
|
||||
if ($nb < 0) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend");
|
||||
if ($nb == 0) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("NoNotificationsWillBeSent");
|
||||
if ($nb == 1) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ANotificationsWillBeSent");
|
||||
if ($nb >= 2) $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("SomeNotificationsWillBeSent", $nb);
|
||||
|
||||
if (is_array($listofnotiftodo))
|
||||
{
|
||||
$i=0;
|
||||
$i = 0;
|
||||
foreach ($listofnotiftodo as $key => $val)
|
||||
{
|
||||
if ($i) $texte.=', ';
|
||||
else $texte.=' (';
|
||||
if ($val['isemailvalid']) $texte.=$val['email'];
|
||||
else $texte.=$val['emaildesc'];
|
||||
if ($i) $texte .= ', ';
|
||||
else $texte .= ' (';
|
||||
if ($val['isemailvalid']) $texte .= $val['email'];
|
||||
else $texte .= $val['emaildesc'];
|
||||
$i++;
|
||||
}
|
||||
if ($i) $texte.=')';
|
||||
if ($i) $texte .= ')';
|
||||
}
|
||||
|
||||
return $texte;
|
||||
@ -150,31 +150,31 @@ class Notify
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$error=0;
|
||||
$resarray=array();
|
||||
$error = 0;
|
||||
$resarray = array();
|
||||
|
||||
$valueforthreshold = 0;
|
||||
if (is_object($object)) $valueforthreshold = $object->total_ht;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if ($socid >= 0 && in_array('thirdparty', $scope))
|
||||
{
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE n.fk_contact = c.rowid";
|
||||
$sql.= " AND a.rowid = n.fk_action";
|
||||
$sql.= " AND n.fk_soc = s.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE n.fk_contact = c.rowid";
|
||||
$sql .= " AND a.rowid = n.fk_action";
|
||||
$sql .= " AND n.fk_soc = s.rowid";
|
||||
if ($notifcode)
|
||||
{
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
if (is_numeric($notifcode)) $sql .= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql .= " AND a.code = '".$notifcode."'"; // New usage
|
||||
}
|
||||
$sql.= " AND s.entity IN (".getEntity('societe').")";
|
||||
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
|
||||
|
||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||
|
||||
@ -182,14 +182,14 @@ class Notify
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$newval2=trim($obj->email);
|
||||
$isvalid=isValidEmail($newval2);
|
||||
$newval2 = trim($obj->email);
|
||||
$isvalid = isValidEmail($newval2);
|
||||
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>$newval2, 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
$i++;
|
||||
@ -198,28 +198,28 @@ class Notify
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if ($userid >= 0 && in_array('user', $scope))
|
||||
{
|
||||
$sql = "SELECT a.code, c.email, c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||
$sql.= " WHERE n.fk_user = c.rowid";
|
||||
$sql.= " AND a.rowid = n.fk_action";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||
$sql .= " WHERE n.fk_user = c.rowid";
|
||||
$sql .= " AND a.rowid = n.fk_action";
|
||||
if ($notifcode)
|
||||
{
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
if (is_numeric($notifcode)) $sql .= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql .= " AND a.code = '".$notifcode."'"; // New usage
|
||||
}
|
||||
$sql.= " AND c.entity IN (".getEntity('user').")";
|
||||
if ($userid > 0) $sql.= " AND c.rowid = ".$userid;
|
||||
$sql .= " AND c.entity IN (".getEntity('user').")";
|
||||
if ($userid > 0) $sql .= " AND c.rowid = ".$userid;
|
||||
|
||||
dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
|
||||
|
||||
@ -227,14 +227,14 @@ class Notify
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$newval2=trim($obj->email);
|
||||
$isvalid=isValidEmail($newval2);
|
||||
$newval2 = trim($obj->email);
|
||||
$isvalid = isValidEmail($newval2);
|
||||
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'touser', 'code'=>trim($obj->code), 'emaildesc'=>'User id '.$obj->rowid, 'email'=>$newval2, 'userid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
$i++;
|
||||
@ -243,49 +243,49 @@ class Notify
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
if (in_array('global', $scope))
|
||||
{
|
||||
// List of notifications enabled for fixed email
|
||||
foreach($conf->global as $key => $val)
|
||||
foreach ($conf->global as $key => $val)
|
||||
{
|
||||
if ($notifcode)
|
||||
{
|
||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||
}
|
||||
|
||||
$threshold = (float) $reg[1];
|
||||
if ($valueforthreshold < $threshold) continue;
|
||||
|
||||
$tmpemail=explode(',', $val);
|
||||
foreach($tmpemail as $key2 => $val2)
|
||||
$tmpemail = explode(',', $val);
|
||||
foreach ($tmpemail as $key2 => $val2)
|
||||
{
|
||||
$newval2=trim($val2);
|
||||
$newval2 = trim($val2);
|
||||
if ($newval2 == '__SUPERVISOREMAIL__')
|
||||
{
|
||||
if ($user->fk_user > 0)
|
||||
{
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser = new User($this->db);
|
||||
$tmpuser->fetch($user->fk_user);
|
||||
if ($tmpuser->email) $newval2=trim($tmpuser->email);
|
||||
else $newval2='';
|
||||
if ($tmpuser->email) $newval2 = trim($tmpuser->email);
|
||||
else $newval2 = '';
|
||||
}
|
||||
else $newval2='';
|
||||
else $newval2 = '';
|
||||
}
|
||||
if ($newval2)
|
||||
{
|
||||
$isvalid=isValidEmail($newval2, 0);
|
||||
if (empty($resarray[$newval2])) $resarray[$newval2]=array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid);
|
||||
$isvalid = isValidEmail($newval2, 0);
|
||||
if (empty($resarray[$newval2])) $resarray[$newval2] = array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -311,17 +311,17 @@ class Notify
|
||||
*/
|
||||
public function send($notifcode, $object, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
|
||||
{
|
||||
global $user,$conf,$langs,$mysoc;
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
global $hookmanager;
|
||||
global $dolibarr_main_url_root;
|
||||
|
||||
if (! in_array($notifcode, $this->arrayofnotifsupported)) return 0;
|
||||
if (!in_array($notifcode, $this->arrayofnotifsupported)) return 0;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
if (! is_object($hookmanager))
|
||||
if (!is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('notification'));
|
||||
|
||||
@ -341,6 +341,7 @@ class Notify
|
||||
$object_type = '';
|
||||
$link = '';
|
||||
$num = 0;
|
||||
$error = 0;
|
||||
|
||||
$oldref=(empty($object->oldref)?$object->ref:$object->oldref);
|
||||
$newref=(empty($object->newref)?$object->ref:$object->newref);
|
||||
@ -358,6 +359,7 @@ class Notify
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
|
||||
$sql.= " AND n.fk_soc = s.rowid";
|
||||
$sql.= " AND c.statut = 1";
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$notifcode."'"; // New usage
|
||||
$sql .= " AND s.rowid = ".$object->socid;
|
||||
@ -372,6 +374,7 @@ class Notify
|
||||
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."notify_def as n";
|
||||
$sql.= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
|
||||
$sql.= " AND c.statut = 1";
|
||||
if (is_numeric($notifcode)) $sql.= " AND n.fk_action = ".$notifcode; // Old usage
|
||||
else $sql.= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage
|
||||
|
||||
@ -406,77 +409,77 @@ class Notify
|
||||
{
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($obj->default_lang);
|
||||
$outputlangs->loadLangs(array("main","other"));
|
||||
$outputlangs->loadLangs(array("main", "other"));
|
||||
}
|
||||
|
||||
$subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification").($projtitle?' '.$projtitle:'');
|
||||
$subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification").($projtitle ? ' '.$projtitle : '');
|
||||
|
||||
switch ($notifcode) {
|
||||
case 'BILL_VALIDATE':
|
||||
$link='/compta/facture/card.php?facid='.$object->id;
|
||||
$link = '/compta/facture/card.php?facid='.$object->id;
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$object_type = 'facture';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoiceValidated", $newref);
|
||||
break;
|
||||
case 'BILL_PAYED':
|
||||
$link='/compta/facture/card.php?facid='.$object->id;
|
||||
$link = '/compta/facture/card.php?facid='.$object->id;
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$object_type = 'facture';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoicePayed", $newref);
|
||||
break;
|
||||
case 'ORDER_VALIDATE':
|
||||
$link='/commande/card.php?id='.$object->id;
|
||||
$link = '/commande/card.php?id='.$object->id;
|
||||
$dir_output = $conf->commande->dir_output;
|
||||
$object_type = 'order';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated", $newref);
|
||||
break;
|
||||
case 'PROPAL_VALIDATE':
|
||||
$link='/comm/propal/card.php?id='.$object->id;
|
||||
$link = '/comm/propal/card.php?id='.$object->id;
|
||||
$dir_output = $conf->propal->multidir_output[$object->entity];
|
||||
$object_type = 'propal';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated", $newref);
|
||||
break;
|
||||
case 'PROPAL_CLOSE_SIGNED':
|
||||
$link='/comm/propal/card.php?id='.$object->id;
|
||||
$link = '/comm/propal/card.php?id='.$object->id;
|
||||
$dir_output = $conf->propal->multidir_output[$object->entity];
|
||||
$object_type = 'propal';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $newref);
|
||||
break;
|
||||
case 'FICHINTER_ADD_CONTACT':
|
||||
$link='/fichinter/card.php?id='.$object->id;
|
||||
$link = '/fichinter/card.php?id='.$object->id;
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $newref);
|
||||
break;
|
||||
case 'FICHINTER_VALIDATE':
|
||||
$link='/fichinter/card.php?id='.$object->id;
|
||||
$link = '/fichinter/card.php?id='.$object->id;
|
||||
$dir_output = $conf->ficheinter->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionValidated", $newref);
|
||||
break;
|
||||
case 'ORDER_SUPPLIER_VALIDATE':
|
||||
$link='/fourn/commande/card.php?id='.$object->id;
|
||||
$link = '/fourn/commande/card.php?id='.$object->id;
|
||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||
$object_type = 'order_supplier';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
|
||||
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $newref, $user->getFullName($outputlangs));
|
||||
$mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
$mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $newref, $user->getFullName($outputlangs));
|
||||
$mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
break;
|
||||
case 'ORDER_SUPPLIER_APPROVE':
|
||||
$link='/fourn/commande/card.php?id='.$object->id;
|
||||
$link = '/fourn/commande/card.php?id='.$object->id;
|
||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||
$object_type = 'order_supplier';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
|
||||
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $newref, $user->getFullName($outputlangs));
|
||||
$mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
$mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $newref, $user->getFullName($outputlangs));
|
||||
$mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
break;
|
||||
case 'ORDER_SUPPLIER_REFUSE':
|
||||
$link='/fourn/commande/card.php?id='.$object->id;
|
||||
$link = '/fourn/commande/card.php?id='.$object->id;
|
||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||
$object_type = 'order_supplier';
|
||||
$mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
|
||||
$mesg.= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $newref, $user->getFullName($outputlangs));
|
||||
$mesg.= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
$mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $newref, $user->getFullName($outputlangs));
|
||||
$mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
break;
|
||||
case 'SHIPPING_VALIDATE':
|
||||
$dir_output = $conf->expedition->dir_output.'/sending/';
|
||||
@ -506,7 +509,7 @@ class Notify
|
||||
}
|
||||
$ref = dol_sanitizeFileName($newref);
|
||||
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
|
||||
if (! dol_is_file($pdf_path))
|
||||
if (!dol_is_file($pdf_path))
|
||||
{
|
||||
// We can't add PDF as it is not generated yet.
|
||||
$filepdf = '';
|
||||
@ -517,17 +520,17 @@ class Notify
|
||||
}
|
||||
|
||||
$message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n";
|
||||
$message.= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
|
||||
$message.= "\n";
|
||||
$message.= $mesg;
|
||||
if ($link) $message.= "\n" . $urlwithroot . $link;
|
||||
$message .= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
|
||||
$message .= "\n";
|
||||
$message .= $mesg;
|
||||
if ($link) $message .= "\n".$urlwithroot.$link;
|
||||
|
||||
$parameters=array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
|
||||
$reshook=$hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
|
||||
$reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
|
||||
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
||||
if (!empty($hookmanager->resArray['subject'])) $subject .= $hookmanager->resArray['subject'];
|
||||
if (!empty($hookmanager->resArray['message'])) $message .= $hookmanager->resArray['message'];
|
||||
}
|
||||
|
||||
$mailfile = new CMailFile(
|
||||
@ -553,13 +556,13 @@ class Notify
|
||||
{
|
||||
if ($obj->type_target == 'touserid') {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||
}
|
||||
else {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", ".$obj->cid.", '".$obj->type."', '".$object_type."', '".$obj->type_target."', ".$object->id.", '".$this->db->escape($obj->email)."')";
|
||||
}
|
||||
if (! $this->db->query($sql))
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
@ -567,7 +570,7 @@ class Notify
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->errors[]=$mailfile->error;
|
||||
$this->errors[] = $mailfile->error;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -585,17 +588,17 @@ class Notify
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->errors[]=$this->db->lasterror();
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check notification using fixed email
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
foreach($conf->global as $key => $val)
|
||||
foreach ($conf->global as $key => $val)
|
||||
{
|
||||
if ($val == '' || ! preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||
if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) continue;
|
||||
|
||||
$threshold = (float) $reg[1];
|
||||
if (!empty($object->total_ht) && $object->total_ht <= $threshold)
|
||||
@ -604,7 +607,7 @@ class Notify
|
||||
continue;
|
||||
}
|
||||
|
||||
$param='NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
|
||||
$param = 'NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
|
||||
|
||||
$sendto = $conf->global->$param;
|
||||
$notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
|
||||
@ -614,82 +617,82 @@ class Notify
|
||||
$link = '';
|
||||
$num++;
|
||||
|
||||
$subject = '['.$mysoc->name.'] '.$langs->transnoentitiesnoconv("DolibarrNotification").($projtitle?' '.$projtitle:'');
|
||||
$subject = '['.$mysoc->name.'] '.$langs->transnoentitiesnoconv("DolibarrNotification").($projtitle ? ' '.$projtitle : '');
|
||||
|
||||
switch ($notifcode) {
|
||||
case 'BILL_VALIDATE':
|
||||
$link = '<a href="' . $urlwithroot . '/compta/facture/card.php?facid=' . $object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$object_type = 'facture';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated", $link);
|
||||
break;
|
||||
case 'BILL_PAYED':
|
||||
$link ='<a href="' . $urlwithroot . '/compta/facture/card.php?facid='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$object_type = 'facture';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed", $link);
|
||||
break;
|
||||
case 'ORDER_VALIDATE':
|
||||
$link = '<a href="' . $urlwithroot . '/commande/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->commande->dir_output;
|
||||
$object_type = 'order';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
|
||||
break;
|
||||
case 'PROPAL_VALIDATE':
|
||||
$link = '<a href="' . $urlwithroot . '/comm/propal/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->propal->multidir_output[$object->entity];
|
||||
$object_type = 'propal';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $link);
|
||||
break;
|
||||
case 'PROPAL_CLOSE_SIGNED':
|
||||
$link = '<a href="' . $urlwithroot . '/comm/propal/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->propal->multidir_output[$object->entity];
|
||||
$object_type = 'propal';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link);
|
||||
break;
|
||||
case 'FICHINTER_ADD_CONTACT':
|
||||
$link = '<a href="' . $urlwithroot . '/fichinter/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $link);
|
||||
break;
|
||||
case 'FICHINTER_VALIDATE':
|
||||
$link = '<a href="' . $urlwithroot . '/fichinter/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->facture->dir_output;
|
||||
$object_type = 'ficheinter';
|
||||
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
|
||||
break;
|
||||
case 'ORDER_SUPPLIER_VALIDATE':
|
||||
$link = '<a href="' . $urlwithroot . '/fourn/commande/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||
$object_type = 'order_supplier';
|
||||
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($langs));
|
||||
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($langs));
|
||||
$mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
break;
|
||||
case 'ORDER_SUPPLIER_APPROVE':
|
||||
$link = '<a href="' . $urlwithroot . '/fourn/commande/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||
$object_type = 'order_supplier';
|
||||
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
|
||||
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
|
||||
$mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
break;
|
||||
case 'ORDER_SUPPLIER_APPROVE2':
|
||||
$link = '<a href="' . $urlwithroot . '/fourn/commande/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->fournisseur->commande->dir_output;
|
||||
$object_type = 'order_supplier';
|
||||
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
|
||||
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
|
||||
$mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
break;
|
||||
case 'ORDER_SUPPLIER_REFUSE':
|
||||
$link = '<a href="' . $urlwithroot . '/fourn/commande/card.php?id='.$object->id . '">' . $newref . '</a>';
|
||||
$link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'">'.$newref.'</a>';
|
||||
$dir_output = $conf->fournisseur->dir_output.'/commande/';
|
||||
$object_type = 'order_supplier';
|
||||
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
|
||||
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($langs));
|
||||
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($langs));
|
||||
$mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
|
||||
break;
|
||||
case 'SHIPPING_VALIDATE':
|
||||
$dir_output = $conf->expedition->dir_output.'/sending/';
|
||||
@ -719,7 +722,7 @@ class Notify
|
||||
}
|
||||
$ref = dol_sanitizeFileName($newref);
|
||||
$pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
|
||||
if (! dol_is_file($pdf_path))
|
||||
if (!dol_is_file($pdf_path))
|
||||
{
|
||||
// We can't add PDF as it is not generated yet.
|
||||
$filepdf = '';
|
||||
@ -730,9 +733,9 @@ class Notify
|
||||
}
|
||||
|
||||
$message = $langs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n";
|
||||
$message.= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
|
||||
$message.= "\n";
|
||||
$message.= $mesg;
|
||||
$message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
|
||||
$message .= "\n";
|
||||
$message .= $mesg;
|
||||
//if ($link) $message.= "\n" . $urlwithroot . $link; // link already added around the ref into the text
|
||||
|
||||
$message = nl2br($message);
|
||||
@ -740,28 +743,28 @@ class Notify
|
||||
// Replace keyword __SUPERVISOREMAIL__
|
||||
if (preg_match('/__SUPERVISOREMAIL__/', $sendto))
|
||||
{
|
||||
$newval='';
|
||||
$newval = '';
|
||||
if ($user->fk_user > 0)
|
||||
{
|
||||
$supervisoruser=new User($this->db);
|
||||
$supervisoruser = new User($this->db);
|
||||
$supervisoruser->fetch($user->fk_user);
|
||||
if ($supervisoruser->email) $newval=trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
|
||||
if ($supervisoruser->email) $newval = trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
|
||||
}
|
||||
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
|
||||
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
|
||||
$sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
|
||||
$sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
|
||||
$sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
|
||||
$sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
|
||||
$sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
|
||||
$sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
|
||||
}
|
||||
|
||||
if ($sendto)
|
||||
{
|
||||
$parameters=array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
|
||||
$reshook=$hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
|
||||
$reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (! empty($hookmanager->resArray['subject'])) $subject.=$hookmanager->resArray['subject'];
|
||||
if (! empty($hookmanager->resArray['message'])) $message.=$hookmanager->resArray['message'];
|
||||
if (!empty($hookmanager->resArray['subject'])) $subject .= $hookmanager->resArray['subject'];
|
||||
if (!empty($hookmanager->resArray['message'])) $message .= $hookmanager->resArray['message'];
|
||||
}
|
||||
$mailfile = new CMailFile(
|
||||
$subject,
|
||||
@ -785,8 +788,8 @@ class Notify
|
||||
if ($mailfile->sendfile())
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
|
||||
$sql.= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid?$object->socid:'null').", null, 'email', 'tofixedemail', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
||||
if (! $this->db->query($sql))
|
||||
$sql .= " VALUES ('".$this->db->idate(dol_now())."', ".$notifcodedefid.", ".($object->socid ? $object->socid : 'null').", null, 'email', 'tofixedemail', '".$object_type."', ".$object->id.", '".$this->db->escape($conf->global->$param)."')";
|
||||
if (!$this->db->query($sql))
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
@ -794,13 +797,13 @@ class Notify
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->errors[]=$mailfile->error;
|
||||
$this->errors[] = $mailfile->error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) return $num;
|
||||
if (!$error) return $num;
|
||||
else return -1 * $error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ class DoliDBPgsql extends DoliDB
|
||||
}
|
||||
|
||||
if (preg_match('/[\s\t\(]*(\w*)[\s\t]+bigint.*auto_increment/i', $line, $reg)) {
|
||||
$newline=preg_replace('/([\s\t\(]*)([a-zA-Z_0-9]*)[\s\t]+int.*auto_increment[^,]*/i', '\\1 \\2 BIGSERIAL PRIMARY KEY', $line);
|
||||
$newline=preg_replace('/([\s\t\(]*)([a-zA-Z_0-9]*)[\s\t]+bigint.*auto_increment[^,]*/i', '\\1 \\2 BIGSERIAL PRIMARY KEY', $line);
|
||||
//$line = "-- ".$line." replaced by --\n".$newline;
|
||||
$line=$newline;
|
||||
}
|
||||
|
||||
@ -486,7 +486,7 @@ function actions_prepare_head($object)
|
||||
$nbLinks=Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/comm/action/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ function account_statement_prepare_head($object, $num)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/compta/bank/account_statement_document.php?account=".$object->id."&num=".$num;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
|
||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
|
||||
{
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->societe->contact->lire)
|
||||
{
|
||||
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
|
||||
$nbContact = 0; // TODO
|
||||
@ -228,7 +228,7 @@ function societe_prepare_head(Societe $object)
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id;
|
||||
$head[$h][1] = $title;
|
||||
if ($foundonexternalonlinesystem) $head[$h][1] .= ' <span class="badge">...</span>';
|
||||
if ($foundonexternalonlinesystem) $head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';
|
||||
elseif ($nbBankAccount > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbBankAccount.'</span>';
|
||||
$head[$h][2] = 'rib';
|
||||
$h++;
|
||||
|
||||
@ -1582,9 +1582,12 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
|
||||
if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files')
|
||||
{
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
$morehtmlref .= $object->getBannerAddress('refaddress', $object);
|
||||
$morehtmlref .= '</div>';
|
||||
$moreaddress = $object->getBannerAddress('refaddress', $object);
|
||||
if ($moreaddress) {
|
||||
$morehtmlref .= '<div class="refidno">';
|
||||
$morehtmlref .= $moreaddress;
|
||||
$morehtmlref .= '</div>';
|
||||
}
|
||||
}
|
||||
if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product')))
|
||||
{
|
||||
@ -3081,7 +3084,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'address'=> 'address-book', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'project'=>'sitemap',
|
||||
'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'generic'=>'folder-open',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'object_bookmark'=>'star', 'bookmark'=>'star', 'stats' => 'chart-bar',
|
||||
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-fork',
|
||||
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil', 'filter'=>'filter', 'split'=>'code-branch',
|
||||
'object_list'=>'list-alt', 'object_calendar'=>'calendar-alt', 'object_calendarweek'=>'calendar-week', 'object_calendarmonth'=>'calendar-alt', 'object_calendarday'=>'calendar-day', 'object_calendarperuser'=>'table',
|
||||
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
|
||||
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt'
|
||||
@ -7896,23 +7899,26 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
|
||||
|
||||
$tmpfile = preg_replace('/\.noexe$/', '', $file);
|
||||
|
||||
// Text files
|
||||
// Plain text files
|
||||
if (preg_match('/\.txt$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.rtx$/i', $tmpfile)) { $mime = 'text/richtext'; $imgmime = 'text.png'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.csv$/i', $tmpfile)) { $mime = 'text/csv'; $imgmime = 'text.png'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.tsv$/i', $tmpfile)) { $mime = 'text/tab-separated-values'; $imgmime = 'text.png'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.(cf|conf|log)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.ini$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'ini'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.md$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'md'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.css$/i', $tmpfile)) { $mime = 'text/css'; $imgmime = 'css.png'; $srclang = 'css'; $famime = 'file-text-o'; }
|
||||
// Certificate files
|
||||
if (preg_match('/\.(crt|cer|key|pub)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; }
|
||||
// HTML/XML
|
||||
// XML based (HTML/XML/XAML)
|
||||
if (preg_match('/\.(html|htm|shtml)$/i', $tmpfile)) { $mime = 'text/html'; $imgmime = 'html.png'; $srclang = 'html'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) { $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xml'; $famime = 'file-text-o'; }
|
||||
if (preg_match('/\.xaml$/i', $tmpfile)) { $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xaml'; $famime = 'file-text-o'; }
|
||||
// Languages
|
||||
if (preg_match('/\.bas$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'bas'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(c)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'c'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(cpp)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cpp'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.cs$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cs'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(h)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'h'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.(java|jsp)$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'java'; $famime = 'file-code-o'; }
|
||||
if (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) { $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; $famime = 'file-code-o'; }
|
||||
@ -8369,6 +8375,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
||||
}
|
||||
|
||||
$class = 'btnTitle';
|
||||
|
||||
// hidden conf keep during button transition TODO: remove this block
|
||||
if (!empty($conf->global->MAIN_USE_OLD_TITLE_BUTTON)) {
|
||||
$class = 'butActionNew';
|
||||
@ -8443,10 +8450,9 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
|
||||
|
||||
$tag = (empty($attr['href']) ? 'span' : 'a');
|
||||
|
||||
|
||||
$button = '<'.$tag.' '.$compiledAttributes.' >';
|
||||
$button .= '<span class="'.$iconClass.' valignmiddle btnTitle-icon"></span>';
|
||||
$button .= '<span class="valignmiddle text-plus-circle btnTitle-label">'.$label.'</span>';
|
||||
$button .= '<span class="valignmiddle text-plus-circle btnTitle-label'.(empty($params['forcenohideoftext']) ? ' hideonsmartphone' : '').'">'.$label.'</span>';
|
||||
$button .= '</'.$tag.'>';
|
||||
|
||||
// hidden conf keep during button transition TODO: remove this block
|
||||
@ -8473,3 +8479,13 @@ function isAFileWithExecutableContent($filename)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return new session token
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function newToken()
|
||||
{
|
||||
return $_SESSION['newtoken'];
|
||||
}
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
// Define size of logo small and mini
|
||||
$maxwidthsmall=270;$maxheightsmall=150;
|
||||
$maxwidthmini=128;$maxheightmini=72;
|
||||
$maxwidthsmall = 270; $maxheightsmall = 150;
|
||||
$maxwidthmini = 128; $maxheightmini = 72;
|
||||
$quality = 80;
|
||||
|
||||
|
||||
@ -37,14 +37,14 @@ $quality = 80;
|
||||
*/
|
||||
function image_format_supported($file)
|
||||
{
|
||||
$regeximgext='\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
|
||||
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php
|
||||
|
||||
// Case filename is not a format image
|
||||
$reg = array();
|
||||
if (! preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1;
|
||||
if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1;
|
||||
|
||||
// Case filename is a format image but not supported by this PHP
|
||||
$imgfonction='';
|
||||
$imgfonction = '';
|
||||
if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif';
|
||||
if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
|
||||
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
|
||||
@ -52,10 +52,10 @@ function image_format_supported($file)
|
||||
if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
|
||||
if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
|
||||
if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
|
||||
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
|
||||
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
|
||||
if ($imgfonction)
|
||||
{
|
||||
if (! function_exists($imgfonction))
|
||||
if (!function_exists($imgfonction))
|
||||
{
|
||||
// Fonctions de conversion non presente dans ce PHP
|
||||
return 0;
|
||||
@ -76,21 +76,21 @@ function image_format_supported($file)
|
||||
*/
|
||||
function dol_getImageSize($file, $url = false)
|
||||
{
|
||||
$ret=array();
|
||||
$ret = array();
|
||||
|
||||
if (image_format_supported($file) < 0) return $ret;
|
||||
|
||||
$filetoread = $file;
|
||||
if (!$url)
|
||||
{
|
||||
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
|
||||
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
|
||||
}
|
||||
|
||||
if ($filetoread)
|
||||
{
|
||||
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
|
||||
$ret['width']=$infoImg[0]; // Largeur de l'image
|
||||
$ret['height']=$infoImg[1]; // Hauteur de l'image
|
||||
$ret['width'] = $infoImg[0]; // Largeur de l'image
|
||||
$ret['height'] = $infoImg[1]; // Hauteur de l'image
|
||||
}
|
||||
|
||||
return $ret;
|
||||
@ -112,29 +112,29 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog("dol_imageResizeOrCrop file=".$file." mode=".$mode." newWidth=".$newWidth." newHeight=".$newHeight." src_x=".$src_x." src_y=".$src_y);
|
||||
|
||||
// Clean parameters
|
||||
$file=trim($file);
|
||||
$file = trim($file);
|
||||
|
||||
// Check parameters
|
||||
if (! $file)
|
||||
if (!$file)
|
||||
{
|
||||
// Si le fichier n'a pas ete indique
|
||||
return 'Bad parameter file';
|
||||
}
|
||||
elseif (! file_exists($file))
|
||||
elseif (!file_exists($file))
|
||||
{
|
||||
// Si le fichier passe en parametre n'existe pas
|
||||
return $langs->trans("ErrorFileNotFound", $file);
|
||||
}
|
||||
elseif(image_format_supported($file) < 0)
|
||||
elseif (image_format_supported($file) < 0)
|
||||
{
|
||||
return 'This filename '.$file.' does not seem to be an image filename.';
|
||||
}
|
||||
elseif(!is_numeric($newWidth) && !is_numeric($newHeight))
|
||||
elseif (!is_numeric($newWidth) && !is_numeric($newHeight))
|
||||
{
|
||||
return 'Wrong value for parameter newWidth or newHeight';
|
||||
}
|
||||
@ -147,7 +147,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
return 'Both newHeight or newWidth must be defined for croping';
|
||||
}
|
||||
|
||||
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
|
||||
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
|
||||
|
||||
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
|
||||
$imgWidth = $infoImg[0]; // Largeur de l'image
|
||||
@ -155,18 +155,18 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
|
||||
if ($mode == 0) // If resize, we check parameters
|
||||
{
|
||||
if ($newWidth <= 0)
|
||||
if ($newWidth <= 0)
|
||||
{
|
||||
$newWidth=intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio
|
||||
$newWidth = intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio
|
||||
}
|
||||
if ($newHeight <= 0)
|
||||
{
|
||||
$newHeight=intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio
|
||||
$newHeight = intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio
|
||||
}
|
||||
}
|
||||
|
||||
$imgfonction='';
|
||||
switch($infoImg[2])
|
||||
$imgfonction = '';
|
||||
switch ($infoImg[2])
|
||||
{
|
||||
case 1: // IMG_GIF
|
||||
$imgfonction = 'imagecreatefromgif';
|
||||
@ -183,7 +183,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
}
|
||||
if ($imgfonction)
|
||||
{
|
||||
if (! function_exists($imgfonction))
|
||||
if (!function_exists($imgfonction))
|
||||
{
|
||||
// Fonctions de conversion non presente dans ce PHP
|
||||
return 'Resize not possible. This PHP does not support GD functions '.$imgfonction;
|
||||
@ -191,27 +191,27 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
}
|
||||
|
||||
// Initialisation des variables selon l'extension de l'image
|
||||
switch($infoImg[2])
|
||||
switch ($infoImg[2])
|
||||
{
|
||||
case 1: // Gif
|
||||
$img = imagecreatefromgif($filetoread);
|
||||
$extImg = '.gif'; // File name extension of image
|
||||
$newquality='NU'; // Quality is not used for this format
|
||||
$extImg = '.gif'; // File name extension of image
|
||||
$newquality = 'NU'; // Quality is not used for this format
|
||||
break;
|
||||
case 2: // Jpg
|
||||
$img = imagecreatefromjpeg($filetoread);
|
||||
$extImg = '.jpg';
|
||||
$newquality=100; // % quality maximum
|
||||
$newquality = 100; // % quality maximum
|
||||
break;
|
||||
case 3: // Png
|
||||
$img = imagecreatefrompng($filetoread);
|
||||
$extImg = '.png';
|
||||
$newquality=0; // No compression (0-9)
|
||||
$newquality = 0; // No compression (0-9)
|
||||
break;
|
||||
case 4: // Bmp
|
||||
$img = imagecreatefromwbmp($filetoread);
|
||||
$extImg = '.bmp';
|
||||
$newquality='NU'; // Quality is not used for this format
|
||||
$newquality = 'NU'; // Quality is not used for this format
|
||||
break;
|
||||
}
|
||||
|
||||
@ -239,7 +239,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
}
|
||||
|
||||
// Initialisation des variables selon l'extension de l'image
|
||||
switch($infoImg[2])
|
||||
switch ($infoImg[2])
|
||||
{
|
||||
case 1: // Gif
|
||||
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF
|
||||
@ -250,7 +250,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
break;
|
||||
case 3: // Png
|
||||
imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
|
||||
break;
|
||||
case 4: // Bmp
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||
@ -260,7 +260,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
|
||||
dol_syslog("dol_imageResizeOrCrop: convert image from ($imgWidth x $imgHeight) at position ($src_x x $src_y) to ($newWidth x $newHeight) as $extImg, newquality=$newquality");
|
||||
//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
|
||||
imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode==0?$imgWidth:$newWidth), ($mode==0?$imgHeight:$newHeight)); // Insere l'image de base redimensionnee
|
||||
imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode == 0 ? $imgWidth : $newWidth), ($mode == 0 ? $imgHeight : $newHeight)); // Insere l'image de base redimensionnee
|
||||
|
||||
$imgThumbName = $file;
|
||||
|
||||
@ -269,7 +269,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
//fclose($fp);
|
||||
|
||||
// Create image on disk
|
||||
switch($infoImg[2])
|
||||
switch ($infoImg[2])
|
||||
{
|
||||
case 1: // Gif
|
||||
imagegif($imgThumb, $imgThumbName);
|
||||
@ -286,13 +286,13 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
}
|
||||
|
||||
// Set permissions on file
|
||||
if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
|
||||
if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
// Free memory. This does not delete image.
|
||||
imagedestroy($img);
|
||||
imagedestroy($imgThumb);
|
||||
|
||||
clearstatcache(); // File was replaced by a modified one, so we clear file caches.
|
||||
clearstatcache(); // File was replaced by a modified one, so we clear file caches.
|
||||
|
||||
return $imgThumbName;
|
||||
}
|
||||
@ -308,35 +308,93 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
|
||||
*/
|
||||
function dolRotateImage($file_path)
|
||||
{
|
||||
$exif = @exif_read_data($file_path);
|
||||
if ($exif === false) {
|
||||
return false;
|
||||
}
|
||||
$orientation = intval(@$exif['Orientation']);
|
||||
if (!in_array($orientation, array(3, 6, 8))) {
|
||||
return false;
|
||||
}
|
||||
$image = @imagecreatefromjpeg($file_path);
|
||||
switch ($orientation) {
|
||||
case 3:
|
||||
$image = @imagerotate($image, 180, 0);
|
||||
break;
|
||||
case 6:
|
||||
$image = @imagerotate($image, 270, 0);
|
||||
break;
|
||||
case 8:
|
||||
$image = @imagerotate($image, 90, 0);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
$success = imagejpeg($image, $file_path);
|
||||
// Free up memory (imagedestroy does not delete files):
|
||||
@imagedestroy($image);
|
||||
return $success;
|
||||
return correctExifImageOrientation($file_path, $file_path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add exif orientation correction for image
|
||||
*
|
||||
* @param string $fileSource Full path to source image to rotate
|
||||
* @param string $fileDest string : Full path to image to rotate | false return gd img | null the raw image stream will be outputted directly
|
||||
* @param int $quality output image quality
|
||||
* @return bool : true on success or false on failure or gd img if $fileDest is false.
|
||||
*/
|
||||
function correctExifImageOrientation($fileSource, $fileDest, $quality = 95)
|
||||
{
|
||||
if (function_exists('exif_read_data')) {
|
||||
$exif = exif_read_data($fileSource);
|
||||
if ($exif && isset($exif['Orientation'])) {
|
||||
$infoImg = getimagesize($fileSource); // Get image infos
|
||||
|
||||
$orientation = $exif['Orientation'];
|
||||
if($orientation != 1){
|
||||
$img = imagecreatefromjpeg($fileSource);
|
||||
$deg = 0;
|
||||
switch ($orientation) {
|
||||
case 3:
|
||||
$deg = 180;
|
||||
break;
|
||||
case 6:
|
||||
$deg = 270;
|
||||
break;
|
||||
case 8:
|
||||
$deg = 90;
|
||||
break;
|
||||
}
|
||||
if ($deg) {
|
||||
if ($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
|
||||
{
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
$img = imagerotate($img, $deg, imageColorAllocateAlpha($img, 0, 0, 0, 127));
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
}
|
||||
else {
|
||||
$img = imagerotate($img, $deg, 0);
|
||||
}
|
||||
}
|
||||
// then rewrite the rotated image back to the disk as $fileDest
|
||||
if ($fileDest === false) {
|
||||
return $img;
|
||||
}
|
||||
else
|
||||
{
|
||||
// In fact there exif is only for JPG but just in case
|
||||
// Create image on disk
|
||||
$image = false;
|
||||
|
||||
switch ($infoImg[2])
|
||||
{
|
||||
case IMAGETYPE_GIF: // 1
|
||||
$image = imagegif($img, $fileDest);
|
||||
break;
|
||||
case IMAGETYPE_JPEG: // 2
|
||||
$image = imagejpeg($img, $fileDest, $quality);
|
||||
break;
|
||||
case IMAGETYPE_PNG: // 3
|
||||
$image = imagepng($img, $fileDest, $quality);
|
||||
break;
|
||||
case IMAGETYPE_BMP: // 6
|
||||
// Not supported by PHP GD
|
||||
break;
|
||||
case IMAGETYPE_WBMP: // 15
|
||||
$image = imagewbmp($img, $fileDest);
|
||||
break;
|
||||
}
|
||||
|
||||
// Free up memory (imagedestroy does not delete files):
|
||||
@imagedestroy($img);
|
||||
|
||||
return $image;
|
||||
}
|
||||
} // if there is some rotation necessary
|
||||
} // if have the exif orientation info
|
||||
} // if function exists
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp).
|
||||
@ -379,12 +437,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
dol_syslog('This file '.$file.' does not seem to be an image format file name.', LOG_WARNING);
|
||||
return 'ErrorBadImageFormat';
|
||||
}
|
||||
elseif(!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1){
|
||||
elseif(!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1) {
|
||||
// Si la largeur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0)
|
||||
dol_syslog('Wrong value for parameter maxWidth', LOG_ERR);
|
||||
return 'Error: Wrong value for parameter maxWidth';
|
||||
}
|
||||
elseif(!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1){
|
||||
elseif(!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1) {
|
||||
// Si la hauteur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0)
|
||||
dol_syslog('Wrong value for parameter maxHeight', LOG_ERR);
|
||||
return 'Error: Wrong value for parameter maxHeight';
|
||||
@ -396,6 +454,14 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
$imgWidth = $infoImg[0]; // Largeur de l'image
|
||||
$imgHeight = $infoImg[1]; // Hauteur de l'image
|
||||
|
||||
$ort = false;
|
||||
if (function_exists('exif_read_data')) {
|
||||
$exif = exif_read_data($filetoread);
|
||||
if ($exif && !empty($exif['Orientation'])) {
|
||||
$ort = $exif['Orientation'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($maxWidth == -1) $maxWidth=$infoImg[0]; // If size is -1, we keep unchanged
|
||||
if ($maxHeight == -1) $maxHeight=$infoImg[1]; // If size is -1, we keep unchanged
|
||||
|
||||
@ -407,8 +473,8 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
//return 'Le fichier '.$file.' ne necessite pas de creation de vignette';
|
||||
}
|
||||
|
||||
$imgfonction='';
|
||||
switch($infoImg[2])
|
||||
$imgfonction = '';
|
||||
switch ($infoImg[2])
|
||||
{
|
||||
case IMAGETYPE_GIF: // 1
|
||||
$imgfonction = 'imagecreatefromgif';
|
||||
@ -428,7 +494,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
}
|
||||
if ($imgfonction)
|
||||
{
|
||||
if (! function_exists($imgfonction))
|
||||
if (!function_exists($imgfonction))
|
||||
{
|
||||
// Fonctions de conversion non presente dans ce PHP
|
||||
return 'Error: Creation of thumbs not possible. This PHP does not support GD function '.$imgfonction;
|
||||
@ -436,12 +502,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
}
|
||||
|
||||
// On cree le repertoire contenant les vignettes
|
||||
$dirthumb = dirname($file).($outdir?'/'.$outdir:''); // Chemin du dossier contenant les vignettes
|
||||
$dirthumb = dirname($file).($outdir ? '/'.$outdir : ''); // Chemin du dossier contenant les vignettes
|
||||
dol_mkdir($dirthumb);
|
||||
|
||||
// Initialisation des variables selon l'extension de l'image
|
||||
$img=null;
|
||||
switch($infoImg[2])
|
||||
$img = null;
|
||||
switch ($infoImg[2])
|
||||
{
|
||||
case IMAGETYPE_GIF: // 1
|
||||
$img = imagecreatefromgif($filetoread);
|
||||
@ -449,7 +515,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
break;
|
||||
case IMAGETYPE_JPEG: // 2
|
||||
$img = imagecreatefromjpeg($filetoread);
|
||||
$extImg = (preg_match('/\.jpeg$/', $file)?'.jpeg':'.jpg'); // Extension de l'image
|
||||
$extImg = (preg_match('/\.jpeg$/', $file) ? '.jpeg' : '.jpg'); // Extension de l'image
|
||||
break;
|
||||
case IMAGETYPE_PNG: // 3
|
||||
$img = imagecreatefrompng($filetoread);
|
||||
@ -464,21 +530,68 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
$extImg = '.bmp';
|
||||
break;
|
||||
}
|
||||
|
||||
if (! is_resource($img))
|
||||
{
|
||||
dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Initialisation des dimensions de la vignette si elles sont superieures a l'original
|
||||
if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; }
|
||||
if($maxHeight > $imgHeight){ $maxHeight = $imgHeight; }
|
||||
$exifAngle = false;
|
||||
if ($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)) {
|
||||
switch($ort)
|
||||
{
|
||||
case 3: // 180 rotate left
|
||||
$exifAngle = 180;
|
||||
break;
|
||||
case 6: // 90 rotate right
|
||||
$exifAngle = -90;
|
||||
// changing sizes
|
||||
$trueImgWidth = $infoImg[1];
|
||||
$trueImgHeight = $infoImg[0];
|
||||
break;
|
||||
case 8: // 90 rotate left
|
||||
$exifAngle = 90;
|
||||
// changing sizes
|
||||
$trueImgWidth = $infoImg[1]; // Largeur de l'image
|
||||
$trueImgHeight = $infoImg[0]; // Hauteur de l'image
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$whFact = $maxWidth/$maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette
|
||||
$imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original
|
||||
if ($exifAngle)
|
||||
{
|
||||
$rotated = false;
|
||||
|
||||
if($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
|
||||
{
|
||||
imagealphablending($img, false);
|
||||
imagesavealpha($img, true);
|
||||
$rotated = imagerotate($img, $exifAngle, imageColorAllocateAlpha($img, 0, 0, 0, 127));
|
||||
imagealphablending($rotated, false);
|
||||
imagesavealpha($rotated, true);
|
||||
}
|
||||
else {
|
||||
$rotated = imagerotate($img, $exifAngle, 0);
|
||||
}
|
||||
|
||||
// replace image with good orientation
|
||||
if (!empty($rotated)) {
|
||||
$img = $rotated;
|
||||
$imgWidth = $trueImgWidth;
|
||||
$imgHeight = $trueImgHeight;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialisation des dimensions de la vignette si elles sont superieures a l'original
|
||||
if ($maxWidth > $imgWidth) { $maxWidth = $imgWidth; }
|
||||
if ($maxHeight > $imgHeight) { $maxHeight = $imgHeight; }
|
||||
|
||||
$whFact = $maxWidth / $maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette
|
||||
$imgWhFact = $imgWidth / $imgHeight; // Facteur largeur/hauteur de l'original
|
||||
|
||||
// Fixe les dimensions de la vignette
|
||||
if($whFact < $imgWhFact)
|
||||
if ($whFact < $imgWhFact)
|
||||
{
|
||||
// Si largeur determinante
|
||||
$thumbWidth = $maxWidth;
|
||||
@ -490,11 +603,11 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
$thumbHeight = $maxHeight;
|
||||
$thumbWidth = $thumbHeight * $imgWhFact;
|
||||
}
|
||||
$thumbHeight=round($thumbHeight);
|
||||
$thumbWidth=round($thumbWidth);
|
||||
$thumbHeight = round($thumbHeight);
|
||||
$thumbWidth = round($thumbWidth);
|
||||
|
||||
// Define target format
|
||||
if (empty($targetformat)) $targetformat=$infoImg[2];
|
||||
if (empty($targetformat)) $targetformat = $infoImg[2];
|
||||
|
||||
// Create empty image
|
||||
if ($targetformat == IMAGETYPE_GIF)
|
||||
@ -521,35 +634,35 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
|
||||
// Initialisation des variables selon l'extension de l'image
|
||||
// $targetformat is 0 by default, in such case, we keep original extension
|
||||
switch($targetformat)
|
||||
switch ($targetformat)
|
||||
{
|
||||
case IMAGETYPE_GIF: // 1
|
||||
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF
|
||||
imagecolortransparent($imgThumb, $trans_colour);
|
||||
$extImgTarget = '.gif';
|
||||
$newquality='NU';
|
||||
$newquality = 'NU';
|
||||
break;
|
||||
case IMAGETYPE_JPEG: // 2
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||
$extImgTarget = (preg_match('/\.jpeg$/i', $file)?'.jpeg':'.jpg');
|
||||
$newquality=$quality;
|
||||
$extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '.jpg');
|
||||
$newquality = $quality;
|
||||
break;
|
||||
case IMAGETYPE_PNG: // 3
|
||||
imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
|
||||
$extImgTarget = '.png';
|
||||
$newquality=$quality-100;
|
||||
$newquality=round(abs($quality-100)*9/100);
|
||||
$newquality = $quality - 100;
|
||||
$newquality = round(abs($quality - 100) * 9 / 100);
|
||||
break;
|
||||
case IMAGETYPE_BMP: // 6
|
||||
// Not supported by PHP GD
|
||||
$extImgTarget = '.bmp';
|
||||
$newquality='NU';
|
||||
$newquality = 'NU';
|
||||
break;
|
||||
case IMAGETYPE_WBMP: // 15
|
||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||
$extImgTarget = '.bmp';
|
||||
$newquality='NU';
|
||||
$newquality = 'NU';
|
||||
break;
|
||||
}
|
||||
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
|
||||
@ -558,10 +671,10 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
|
||||
imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee
|
||||
|
||||
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse
|
||||
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse
|
||||
$fileName = basename($fileName);
|
||||
//$imgThumbName = $dirthumb.'/'.getImageFileNameForSize(basename($file), $extName, $extImgTarget); // Full path of thumb file
|
||||
$imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file
|
||||
$imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file
|
||||
|
||||
|
||||
// Check if permission are ok
|
||||
@ -569,7 +682,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
//fclose($fp);
|
||||
|
||||
// Create image on disk
|
||||
switch($targetformat)
|
||||
switch ($targetformat)
|
||||
{
|
||||
case IMAGETYPE_GIF: // 1
|
||||
imagegif($imgThumb, $imgThumbName);
|
||||
@ -589,7 +702,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
||||
}
|
||||
|
||||
// Set permissions on file
|
||||
if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
|
||||
if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
// Free memory. This does not delete image.
|
||||
imagedestroy($img);
|
||||
|
||||
@ -134,7 +134,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
global $langs;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('payment', 'paybox'));
|
||||
$langs->loadLangs(array('payment', 'stripe'));
|
||||
|
||||
$servicename = $langs->transnoentitiesnoconv('Online');
|
||||
|
||||
|
||||
@ -1282,6 +1282,11 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
|
||||
if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) $note = $prodser->multilangs[$outputlangs->defaultlang]["note"];
|
||||
}
|
||||
}
|
||||
elseif ($object->element == 'facture' || $object->element == 'facturefourn') {
|
||||
if ($object->type == $object::TYPE_DEPOSIT) {
|
||||
$desc = str_replace('(DEPOSIT)', $outputlangs->trans('Deposit'), $desc);
|
||||
}
|
||||
}
|
||||
|
||||
// Description short of product line
|
||||
$libelleproduitservice = $label;
|
||||
@ -1308,9 +1313,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
|
||||
$sourceref = !empty($discount->discount_type) ? $discount->ref_invoive_supplier_source : $discount->ref_facture_source;
|
||||
$libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromDeposit", $sourceref);
|
||||
// Add date of deposit
|
||||
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')';
|
||||
if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice .= ' ('.dol_print_date($discount->datec, 'day', '', $outputlangs).')';
|
||||
}
|
||||
if ($desc == '(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except)
|
||||
elseif ($desc == '(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except)
|
||||
{
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$discount->fetch($object->lines[$i]->fk_remise_except);
|
||||
|
||||