Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
markus 2019-03-08 11:47:08 +01:00
commit 1e4ed531b4
125 changed files with 2009 additions and 1434 deletions

View File

@ -22,21 +22,51 @@ Following changes may create regressions for some external modules, but were nec
FIX: #10381
FIX: #10460 compatibility with MariaDB 10.4
FIX: #10485
FIX: #10638
FIX: Accountancy - Adding transaction with multicompany uses all the time 1st entity
FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work
FIX: add fk_unit on addline action
FIX: adding css by page if url is externam
FIX: Bad link in menu manager
FIX: better test on fetch
FIX: can't add lines on invoices
FIX: Check for old picture name if the new one was not found
FIX: could not create several superadmin in transversal mode
FIX: creation of menu entry with parent id not int
FIX: creation of new left menu entry
FIX: Default language of company is not set
FIX: error on setup of password if pass generators have a .old file.
FIX: error report not returned
FIX: expedition: reset status on rollback + replace hardcoded status with const
FIX: fetch module / pos source
FIX: fk_default_warehouse missing in group by
FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it
FIX: if empty error message, we just see "error" displayed
FIX: label of bank account
FIX: line edit template: keep fk_parent_line
FIX: Mark credit note as available for credit note in other currency
FIX: missing access security checking with multicompany
FIX: missing entity filter in function "build_filterField()" (export module)
FIX: missing $ismultientitymanaged for previous/next ref
FIX: Missing province in export of invoice
FIX: must fetch member in current entity
FIX: positive values creating diff on addline rounding
FIX: positive values IN supplier credit notes creating diff on addline rounding
FIX: Price in combo list of service does not use the correct price level
FIX: supplier invoice payment total doesnt care about deposit or credit
FIX: project_title for display of getNomUrl()
FIX: same thing here
FIX: Show button POS Ticket only if invoice was generated by POS
FIX: supplier invoice payment total doesn't care about deposit or credit
FIX: supplier invoice product stats total ht is line total not invoice total
FIX: The notes was also copied on invoice
FIX: Transaction on leave approval and decrease ko if setup not complete
FIX: Translation not loaded by scheduled jobs
FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9
FIX: we want to be able to reopen fourn credit note
FIX: wrong feature2 when user rights "group_advance" is used
FIX: wrong merged conflict
FIX: wrong tests on fetch
NEW: Add protection to avoid packaging if files non indexed exists into
NEW: Add protection to avoid packaging if files non indexed exists
***** ChangeLog for 9.0.0 compared to 8.0.0 *****
For Users:

View File

@ -1,6 +1,6 @@
# DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg)
![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|6|7|8|9|develop|

View File

@ -428,4 +428,5 @@
<rule ref="PSR2.Files.EndFileNewline.TooMany" />
<rule ref="PSR2.Files.EndFileNewline.NoneFound" />
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket" />
<rule ref="PSR2.Classes.PropertyDeclaration.VarUsed" />
</ruleset>

View File

@ -572,6 +572,22 @@ class Adherent extends CommonObject
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
$sql.= " WHERE rowid = ".$this->id;
// If we change the type of membership, we set also label of new type
if (! empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid)
{
$sql2 = "SELECT libelle as label";
$sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql2.= " WHERE rowid = ".$this->typeid;
$resql2 = $this->db->query($sql2);
if ($resql2)
{
while ($obj=$this->db->fetch_object($resql2))
{
$this->type=$obj->label;
}
}
}
dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)

View File

@ -288,15 +288,16 @@ class Members extends DolibarrApi
return $member;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource.

View File

@ -266,15 +266,16 @@ class MembersTypes extends DolibarrApi
return $membertype;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->array_options);

View File

@ -58,15 +58,16 @@ llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, arra
$title=$langs->trans("MembersStatisticsByProperties");
print load_fiche_titre($title, $mesg);
print load_fiche_titre($title, '');
dol_mkdir($dir);
$tab='byproperties';
$data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code";
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY d.morphy";
@ -87,7 +88,7 @@ if ($resql)
if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++;
$data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate));
$data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
$i++;
}
@ -120,22 +121,21 @@ print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Nature").'</td>';
print '<td class="right">'.$langs->trans("NbOfMembers").'</td>';
print '<td align="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td align="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>';
if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'');
if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'');
if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
$oldyear=0;
foreach ($data as $val)
{
$year = $val['year'];
print '<tr class="oddeven">';
print '<td>'.$memberstatic->getmorphylib($val['label']).'</td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td align="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>';
print '<td align="center">'.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'</td>';
print '</tr>';
$oldyear=$year;
}
print '</table>';

View File

@ -77,8 +77,10 @@ if ($mode)
$tab='statscountry';
$data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code";
@ -92,10 +94,12 @@ if ($mode)
$tab='statsstate';
$data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, c.nom as label2"; //
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, c.nom";
@ -108,10 +112,12 @@ if ($mode)
$tab='statsregion'; //onglet
$data = array(); //tableau de donnée
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, r.nom as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, r.nom"; //+
@ -124,9 +130,10 @@ if ($mode)
$tab='statstown';
$data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label, d.town as label2";
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code, d.town";
@ -154,7 +161,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'code'=>$obj->code,
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbyregion') //+
@ -164,7 +172,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbystate')
@ -173,7 +182,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
if ($mode == 'memberbytown')
@ -182,7 +192,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate)
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
);
}
@ -289,9 +300,9 @@ if ($mode)
if ($label2) print '<td align="center">'.$label2.'</td>';
print '<td class="right">'.$langs->trans("NbOfMembers").'</td>';
print '<td align="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td align="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>';
$oldyear=0;
foreach ($data as $val)
{
$year = $val['year'];
@ -300,8 +311,8 @@ if ($mode)
if ($label2) print '<td align="center">'.$val['label2'].'</td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td align="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>';
print '<td align="center">'.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'</td>';
print '</tr>';
$oldyear=$year;
}
print '</table>';

View File

@ -1912,7 +1912,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td class="maxxxx"><input type="text" class="flat minwidth75" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
print '<td class="maxxxx"><input type="text" class="flat minwidth75 maxwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
}
elseif ($fieldlist[$field]=='unit') {
print '<td>';

View File

@ -212,7 +212,7 @@ if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i', $file, $reg))
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php$/i', $file, $reg))
{
// Charging the numbering class
$classname = $reg[1];
@ -398,7 +398,6 @@ print '<td align="center">'.$langs->trans("Action").'</td>';
print '</tr>';
// Disable clear password in database
print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
print '<td align="center" width="60">';
@ -413,6 +412,8 @@ if (! $conf->global->DATABASE_PWD_ENCRYPTED)
print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>';
print "</td>";
}
// Database conf file encryption
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
{
print '<td align="center" width="100">';
@ -494,9 +495,21 @@ print '</tr>';
print '</table>';
print '</form>';
print '<br>';
//print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>';
if (GETPOST('info', 'int') > 0)
{
if (function_exists('password_hash'))
{
print $langs->trans("Note: The function password_hash exists on your PHP")."<br>\n";
}
else
{
print $langs->trans("Note: The function password_hash does not exists on your PHP")."<br>\n";
}
print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."<br>\n";
print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."<br>\n";
}
print '</div>';

View File

@ -339,8 +339,8 @@ if (! $error && $xml)
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'];
if (! preg_match('/^win/i', PHP_OS)) {
$htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm');
$htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.$file['filename']); // The slash is included int file['filename']
$out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i);
}
$out.='</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";

View File

@ -19,7 +19,7 @@
/**
* \file admin/ticket.php
* \ingroup ticket
* \brief This file is a module setup page
* \brief Page to setup module ticket
*/
require '../main.inc.php';
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
// Load translation files required by the page
$langs->load("ticket");
$langs->loadLangs(array("admin", "ticket"));
// Access control
if (!$user->admin) {
@ -91,16 +91,6 @@ if ($action == 'updateMask') {
$error++;
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
if (!empty($mail_new_ticket)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
@ -121,36 +111,6 @@ if ($action == 'updateMask') {
$error++;
}
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
@ -163,26 +123,14 @@ if ($action == 'updateMask') {
}
if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_ALL_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_ALL_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_activate_log_by_email = GETPOST('TICKET_ACTIVATE_LOG_BY_EMAIL', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ACTIVATE_LOG_BY_EMAIL', $param_activate_log_by_email, 'chaine', 0, '', $conf->entity);
$param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
@ -242,9 +190,7 @@ $head = ticketAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
print $langs->trans("TicketSetupDictionaries") . ' : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
print $langs->trans("TicketPublicAccess") . ' : <a href="' . dol_buildpath('/public/ticket/index.php', 1) . '" target="_blank" >' . dol_buildpath('/public/ticket/index.php', 2) . '</a>';
print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries") . '</span> : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
dol_fiche_end();
@ -353,80 +299,19 @@ if (!$conf->use_javascript_ajax) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvarother">';
}
print load_fiche_titre($langs->trans("TicketParamPublicInterface"));
print '<table class="noborder" width="100%">';
// Activate public interface
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsActivatePublicInterface") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ENABLE_PUBLIC_INTERFACE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_ENABLE_PUBLIC_INTERFACE", $arrval, $conf->global->TICKET_ENABLE_PUBLIC_INTERFACE);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsActivatePublicInterfaceHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Check if email exists
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
print '</td>';
print '</tr>';
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
// Show logo for module
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
}*/
// Show logo for company
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</table><br>';
print load_fiche_titre($langs->trans("TicketParams"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Parameter") . '</td>';
print '<td></td>';
print '<td></td>';
print "</tr>\n";
// Activate email notifications
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsDisableEmail") . '</td>';
/*
print '<tr class="pair"><td>' . $langs->trans("TicketsDisableEmail") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS');
@ -441,7 +326,7 @@ print '</td>';
print '</tr>';
// Activate log by email
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
@ -454,11 +339,12 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
*/
// Also send to main email address
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
@ -474,7 +360,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
}
// Limiter la vue des tickets à ceux assignés à l'utilisateur
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
/*
print '<tr class="pair"><td>' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY');
@ -487,14 +374,15 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help');
print '</td>';
print '</tr>';
*/
if (!$conf->use_javascript_ajax) {
/*if (!$conf->use_javascript_ajax) {
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
}*/
// Auto assign ticket at user who created it
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
@ -515,7 +403,7 @@ if (!$conf->use_javascript_ajax) {
}
// Admin var of module
print load_fiche_titre($langs->trans("TicketParamMail"));
print load_fiche_titre($langs->trans("Notification"));
print '<table class="noborder" width="100%">';
@ -533,17 +421,26 @@ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
print "</tr>\n";
}
// Email d'envoi des notifications
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>';
// Activate log by email
/*print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
*/
// @TODO Use module notification instead...
// Email de réception des notifications
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>';
print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="' . (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : $conf->global->TICKET_NOTIFICATION_EMAIL_FROM) . '" size="20" ></td>';
print '<td align="center">';
@ -551,21 +448,18 @@ print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1
print '</td>';
print '</tr>';
// Texte de création d'un ticket
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
// Email d'envoi des notifications
print '<tr class="oddeven"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>';
print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</td></tr>';
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Texte d'introduction
$mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
print '<tr><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
@ -577,7 +471,7 @@ print '</td></tr>';
// Texte de signature
$mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
print '<tr><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>';
print '<tr class="oddeven"><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
@ -587,58 +481,12 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
print '</td></tr>';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans("PublicInterface") . '</td>';
print "</tr>\n";
print '</table>';
// Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '</div>';
// Interface topic
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
print '</td></tr>';
// Texte d'accueil homepage
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
print '</td></tr>';
// Texte d'aide à la saisie du message
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
print '</td></tr>';
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
print '</table><br>';
print '</form>';
// End of page

View File

@ -0,0 +1,453 @@
<?php
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file admin/ticket_public.php
* \ingroup ticket
* \brief Page to public interface of module Ticket
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
// Load translation files required by the page
$langs->loadLangs(array("admin", "ticket"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$value = GETPOST('value', 'alpha');
$action = GETPOST('action', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'ticket';
if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE')
{
if (GETPOST('value')) dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
else dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
}
if ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
if (!empty($notification_email)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
// altairis : differentiate notification email FROM and TO
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
if (!empty($notification_email_to)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
if (!empty($mail_new_ticket)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
}
if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
/*
* View
*/
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$form = new Form($db);
$help_url = "FR:Module_Ticket";
$page_name = "TicketSetup";
llxHeader('', $langs->trans($page_name), $help_url);
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = ticketAdminPrepareHead();
dol_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess") . '</span> : <a href="' . dol_buildpath('/public/ticket/index.php', 1) . '" target="_blank" >' . dol_buildpath('/public/ticket/index.php', 2) . '</a>';
dol_fiche_end();
$enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
// Button off, click to enable
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
$enabledisablehtml.=img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml.='</a>';
}
else
{
// Button on, click to disable
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
$enabledisablehtml.=img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml.='</a>';
}
print $enabledisablehtml;
print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)?0:1).'">';
print '<br><br>';
if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
if (!$conf->use_javascript_ajax) {
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvarother">';
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Parameters") . '</td>';
print '<td class="left">';
print '</td>';
print '<td class="center">';
print '</td>';
print '</tr>';
// Check if email exists
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
print '</td>';
print '</tr>';
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
// Show logo for module
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
}*/
// Show logo for company
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Also send to main email address
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
print '</td>';
print '</tr>';
}
if (!$conf->use_javascript_ajax) {
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
// Auto assign ticket at user who created it
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</table><br>';
if (!$conf->use_javascript_ajax) {
print '</form>';
}
// Admin var of module
print load_fiche_titre($langs->trans("TicketParamMail"));
print '<table class="noborder" width="100%">';
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvar">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans("Parameter") . '</td>';
print "</tr>\n";
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
print '<tr>';
print '<td colspan="3"><div class="info">' . $langs->trans("TicketCkEditorEmailNotActivated") . '</div></td>';
print "</tr>\n";
}
// Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
// Interface topic
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
print '</td></tr>';
// Texte d'accueil homepage
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
print '</td></tr>';
// Texte d'aide à la saisie du message
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
print '</td></tr>';
// Activate email creation to user
print '<tr class="pair"><td>' . $langs->trans("TicketsDisableCustomerEmail") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Texte de création d'un ticket
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</td></tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></div>';
print '</form>';
}
// End of page
llxFooter();
$db->close();

View File

@ -274,7 +274,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id;
}
else if ($modulepart == 'adherent' || $modulepart == 'member')
elseif ($modulepart == 'adherent' || $modulepart == 'member')
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@ -290,7 +290,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
}
else if ($modulepart == 'propal' || $modulepart == 'proposal')
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
{
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
@ -306,7 +306,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
}
else if ($modulepart == 'commande' || $modulepart == 'order')
elseif ($modulepart == 'commande' || $modulepart == 'order')
{
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -322,7 +322,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande');
}
else if ($modulepart == 'shipment' || $modulepart == 'expedition')
elseif ($modulepart == 'shipment' || $modulepart == 'expedition')
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
@ -338,7 +338,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment');
}
else if ($modulepart == 'facture' || $modulepart == 'invoice')
elseif ($modulepart == 'facture' || $modulepart == 'invoice')
{
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -354,7 +354,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
}
else if ($modulepart == 'produit' || $modulepart == 'product')
elseif ($modulepart == 'produit' || $modulepart == 'product')
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
@ -370,7 +370,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
}
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -600,7 +600,8 @@ class Documents extends DolibarrApi
* @return array
* @throws RestException
*/
private function _validate_file($data) {
private function _validate_file($data)
{
// phpcs:enable
$result = array();
foreach (Documents::$DOCUMENT_FIELDS as $field) {

View File

@ -273,14 +273,16 @@ class Setup extends DolibarrApi
return $list;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->error);

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,21 +24,7 @@
*/
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
global $langs, $user;
require '../../main.inc.php';
// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once '../lib/bom.lib.php';
@ -62,11 +49,7 @@ $arrayofparameters=array(
/*
* Actions
*/
if ((float) DOL_VERSION >= 6)
{
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
/*
* View

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,50 +17,17 @@
*/
/**
* \file bom_card.php
* \file htdocs/bom/bom_card.php
* \ingroup bom
* \brief Page to create/edit/view bom
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom_bom.lib.php');
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom_bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("mrp","other"));
@ -75,7 +42,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard
$backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical objects
$object=new BillOfMaterials($db);
$object=new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array
@ -119,10 +86,10 @@ if (empty($reshook))
$permissiontoadd = $user->rights->bom->write;
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/bom/bom_list.php', 1);
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__');
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id;
}
$triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,26 +23,13 @@
*/
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom_bom.lib.php');
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom_bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("mrp","companies","other","mails"));

View File

@ -17,49 +17,16 @@
*/
/**
* \file bom_list.php
* \file htdocs/bom/bom_list.php
* \ingroup bom
* \brief List page for bom
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL'
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/bom/class/bom.class.php');
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
// Load translation files required by the page
$langs->loadLangs(array("mrp", "other"));
@ -89,7 +56,7 @@ $pagenext = $page + 1;
//if (! $sortorder) $sortorder="DESC";
// Initialize technical objects
$object = new BillOfMaterials($db);
$object = new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array
@ -179,7 +146,7 @@ if (empty($reshook))
}
// Mass actions
$objectclass='BillOfMaterials';
$objectclass='BOM';
$objectlabel='BillOfMaterials';
$permtoread = $user->rights->bom->read;
$permtodelete = $user->rights->bom->delete;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,22 +23,9 @@
*/
// Load Dolibarr environment
$res=0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom_bom.lib.php');
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom_bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("mrp","companies"));

View File

@ -18,12 +18,11 @@
use Luracast\Restler\RestException;
dol_include_once('/bom/class/bom.class.php');
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
/**
* \file bom/class/api_bom.class.php
* \file bom/class/api_boms.class.php
* \ingroup bom
* \brief File for API management of bom.
*/
@ -31,36 +30,32 @@ dol_include_once('/bom/class/bom.class.php');
/**
* API class for bom bom
*
* @smart-auto-routing false
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class BillOfMaterialsApi extends DolibarrApi
class BOMs extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'name',
'label'
);
/**
* @var BillOfMaterials $bom {@type BillOfMaterials}
* @var BOM $bom {@type BOM}
*/
public $bom;
/**
* Constructor
*
* @url GET /
*
*/
public function __construct()
{
global $db, $conf;
$this->db = $db;
$this->bom = new BillOfMaterials($this->db);
$this->bom = new BOM($this->db);
}
/**
@ -71,7 +66,7 @@ class BillOfMaterialsApi extends DolibarrApi
* @param int $id ID of bom
* @return array|mixed data without useless information
*
* @url GET boms/{id}
* @url GET {id}
* @throws RestException
*/
public function get($id)
@ -82,7 +77,7 @@ class BillOfMaterialsApi extends DolibarrApi
$result = $this->bom->fetch($id);
if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found');
throw new RestException(404, 'BOM not found');
}
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
@ -106,8 +101,6 @@ class BillOfMaterialsApi extends DolibarrApi
* @return array Array of order objects
*
* @throws RestException
*
* @url GET /boms/
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{
@ -134,7 +127,7 @@ class BillOfMaterialsApi extends DolibarrApi
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
$tmpobject = new BillOfMaterials($db);
$tmpobject = new BOM($db);
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')';
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
@ -172,7 +165,7 @@ class BillOfMaterialsApi extends DolibarrApi
while ($i < $num)
{
$obj = $db->fetch_object($result);
$bom_static = new BillOfMaterials($db);
$bom_static = new BOM($db);
if($bom_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($bom_static);
}
@ -193,8 +186,6 @@ class BillOfMaterialsApi extends DolibarrApi
*
* @param array $request_data Request datas
* @return int ID of bom
*
* @url POST boms/
*/
public function post($request_data = null)
{
@ -208,7 +199,7 @@ class BillOfMaterialsApi extends DolibarrApi
$this->bom->$field = $value;
}
if( ! $this->bom->create(DolibarrApiAccess::$user)) {
throw new RestException(500);
throw new RestException(500, "Error creating BOM", array_merge(array($this->bom->error), $this->bom->errors));
}
return $this->bom->id;
}
@ -218,9 +209,8 @@ class BillOfMaterialsApi extends DolibarrApi
*
* @param int $id Id of bom to update
* @param array $request_data Datas
* @return int
*
* @url PUT boms/{id}
* @return int
*/
public function put($id, $request_data = null)
{
@ -230,7 +220,7 @@ class BillOfMaterialsApi extends DolibarrApi
$result = $this->bom->fetch($id);
if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found');
throw new RestException(404, 'BOM not found');
}
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
@ -238,59 +228,64 @@ class BillOfMaterialsApi extends DolibarrApi
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->bom->$field = $value;
}
if($this->bom->update($id, DolibarrApiAccess::$user))
if($this->bom->update($id, DolibarrApiAccess::$user) > 0)
{
return $this->get($id);
return false;
}
else
{
throw new RestException(500, $this->commande->error);
}
}
/**
* Delete bom
*
* @param int $id BillOfMaterials ID
* @param int $id BOM ID
* @return array
*
* @url DELETE bom/{id}
*/
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->bom->delete) {
if (! DolibarrApiAccess::$user->rights->bom->delete) {
throw new RestException(401);
}
$result = $this->bom->fetch($id);
if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found');
if (! $result) {
throw new RestException(404, 'BOM not found');
}
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( !$this->bom->delete(DolibarrApiAccess::$user, 0))
if (! $this->bom->delete(DolibarrApiAccess::$user))
{
throw new RestException(500);
throw new RestException(500, 'Error when deleting BOM : '.$this->bom->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'BillOfMaterials deleted'
'message' => 'BOM deleted'
)
);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
/*unset($object->note);
@ -306,15 +301,15 @@ class BillOfMaterialsApi extends DolibarrApi
/**
* Validate fields before create or update object
*
* @param array $data Data to validate
* @return array
* @param array $data Array of data to validate
* @return array
*
* @throws RestException
* @throws RestException
*/
private function _validate($data)
{
$bom = array();
foreach (BillOfMaterialsApi::$FIELDS as $field) {
foreach (BOMs::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$bom[$field] = $data[$field];

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
/* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +17,7 @@
*/
/**
* \file bom/lib/bom.lib.php
* \file htdocs/bom/lib/bom.lib.php
* \ingroup bom
* \brief Library files with common functions for BillOfMaterials
*/
@ -40,7 +41,7 @@ function bomAdminPrepareHead()
$head[$h][2] = 'settings';
$h++;
/*$head[$h][0] = dol_buildpath("/bom/admin/about.php", 1);
/*$head[$h][0] = DOL_URL_ROOT."/bom/admin/about.php";
$head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about';
$h++;
@ -77,7 +78,7 @@ function bomPrepareHead($object)
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/bom/bom_card.php", 1).'?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT."/bom/bom_card.php?id=".$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
@ -87,7 +88,7 @@ function bomPrepareHead($object)
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = dol_buildpath('/bom/bom_note.php', 1).'?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$h][2] = 'note';
@ -99,13 +100,13 @@ function bomPrepareHead($object)
$upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/bom/bom_document.php", 1).'?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
$head[$h][2] = 'document';
$h++;
$head[$h][0] = dol_buildpath("/bom/bom_agenda.php", 1).'?id='.$object->id;
$head[$h][0] = DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
$head[$h][2] = 'agenda';
$h++;

View File

@ -261,15 +261,16 @@ class Categories extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param Categorie $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
// Remove fields not relevent to categories

View File

@ -81,6 +81,7 @@ if ($cancel)
// Action mise a jour d'une categorie
if ($action == 'update' && $user->rights->categorie->creer)
{
$object->oldcopy = dol_clone($object);
$object->label = $label;
$object->description = dol_htmlcleanlastbr($description);
$object->color = $color;

View File

@ -160,6 +160,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
{
if ($id > 0) {
$object->fetch($id);
if (!empty($object->socpeopleassigned)) {
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
}
$result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid'));
if ($result > 0) {
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
@ -431,6 +435,10 @@ if ($action == 'update')
$object->socpeopleassigned = array();
foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid);
$object->contactid = GETPOST("contactid", 'int');
if (empty($object->contactid) && !empty($object->socpeopleassigned)) {
reset($object->socpeopleassigned);
$object->contactid = key($object->socpeopleassigned);
}
$object->fk_project = GETPOST("projectid", 'int');
$object->note = GETPOST("note", "none"); // deprecated
$object->note_private= GETPOST("note", "none");
@ -682,7 +690,7 @@ if ($action == 'create')
dol_fiche_head();
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Type of event
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@ -849,7 +857,7 @@ if ($action == 'create')
print '<br><hr><br>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
if ($conf->societe->enabled)
{
@ -1078,7 +1086,7 @@ if ($id > 0)
dol_fiche_head($head, 'card', $langs->trans("Action"), 0, 'action');
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Ref
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
@ -1259,7 +1267,7 @@ if ($id > 0)
print '<br><hr><br>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
if ($conf->societe->enabled)
{
@ -1455,7 +1463,7 @@ if ($id > 0)
print '<div class="underbanner clearboth"></div>';
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
print '<table class="border tableforfield" width="100%">';
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@ -1558,7 +1566,7 @@ if ($id > 0)
print '<br>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
if ($conf->societe->enabled)
{

View File

@ -270,7 +270,7 @@ class ActionComm extends CommonObject
$this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency);
}
if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
//if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated
$userownerid=$this->userownerid;
@ -656,7 +656,7 @@ class ActionComm extends CommonObject
$this->fk_project = $obj->fk_project; // To have fetch_project method working
$this->societe->id = $obj->fk_soc; // deprecated
$this->contact->id = $obj->fk_contact; // deprecated
//$this->contact->id = $obj->fk_contact; // deprecated
$this->fk_element = $obj->elementid;
$this->elementid = $obj->elementid;
@ -867,7 +867,7 @@ class ActionComm extends CommonObject
}
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0));
$contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0));
$contactid=($this->contactid?$this->contactid:0);
$userownerid=($this->userownerid?$this->userownerid:0);
$userdoneid=($this->userdoneid?$this->userdoneid:0);

View File

@ -313,15 +313,16 @@ class AgendaEvents extends DolibarrApi
return $event;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->usermod);

View File

@ -166,7 +166,7 @@ if ($object->id > 0)
print '<div class="underbanner clearboth"></div>';
// Affichage fiche action en mode visu
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Type
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
@ -237,7 +237,7 @@ if ($object->id > 0)
print '</table>';
print '<table class="border" width="100%">';
print '<table class="border tableforfield centpercent">';
// Build file list
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);

View File

@ -782,15 +782,16 @@ class Proposals extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->note);

View File

@ -3526,13 +3526,13 @@ class Propal extends CommonObject
if ($option == '') {
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params;
}
if ($option == 'compta') { // deprecated
elseif ($option == 'compta') { // deprecated
$url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params;
}
if ($option == 'expedition') {
elseif ($option == 'expedition') {
$url = DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params;
}
if ($option == 'document') {
elseif ($option == 'document') {
$url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params;
}
@ -3646,68 +3646,68 @@ class PropaleLigne extends CommonObjectLine
*/
public $table_element='propaldet';
var $oldline;
public $oldline;
// From llx_propaldet
var $fk_propal;
var $fk_parent_line;
var $desc; // Description ligne
var $fk_product; // Id produit predefini
public $fk_propal;
public $fk_parent_line;
public $desc; // Description ligne
public $fk_product; // Id produit predefini
/**
* @deprecated
* @see product_type
*/
var $fk_product_type;
public $fk_product_type;
/**
* Product type.
* @var int
* @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE
*/
var $product_type = Product::TYPE_PRODUCT;
public $product_type = Product::TYPE_PRODUCT;
var $qty;
var $tva_tx;
var $subprice;
var $remise_percent;
var $fk_remise_except;
public $qty;
public $tva_tx;
public $subprice;
public $remise_percent;
public $fk_remise_except;
var $rang = 0;
public $rang = 0;
var $fk_fournprice;
var $pa_ht;
var $marge_tx;
var $marque_tx;
public $fk_fournprice;
public $pa_ht;
public $marge_tx;
public $marque_tx;
var $special_code; // Tag for special lines (exlusive tags)
public $special_code; // Tag for special lines (exlusive tags)
// 1: frais de port
// 2: ecotaxe
// 3: option line (when qty = 0)
var $info_bits = 0; // Liste d'options cumulables:
public $info_bits = 0; // Liste d'options cumulables:
// Bit 0: 0 si TVA normal - 1 si TVA NPR
// Bit 1: 0 ligne normale - 1 si ligne de remise fixe
var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne
public $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne
public $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
/**
* @deprecated
* @see $remise_percent, $fk_remise_except
*/
var $remise;
public $remise;
/**
* @deprecated
* @see subprice
*/
var $price;
public $price;
// From llx_product
/**
* @deprecated
* @see product_ref
*/
var $ref;
public $ref;
/**
* Product reference
* @var string
@ -3717,7 +3717,7 @@ class PropaleLigne extends CommonObjectLine
* @deprecated
* @see product_label
*/
var $libelle;
public $libelle;
/**
* Product label
* @var string
@ -3729,25 +3729,25 @@ class PropaleLigne extends CommonObjectLine
*/
public $product_desc;
var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2
var $localtax1_type; // Local tax 1 type
var $localtax2_type; // Local tax 2 type
var $total_localtax1; // Line total local tax 1
var $total_localtax2; // Line total local tax 2
public $localtax1_tx; // Local tax 1
public $localtax2_tx; // Local tax 2
public $localtax1_type; // Local tax 1 type
public $localtax2_type; // Local tax 2 type
public $total_localtax1; // Line total local tax 1
public $total_localtax2; // Line total local tax 2
var $date_start;
var $date_end;
public $date_start;
public $date_end;
var $skip_update_total; // Skip update price total for special lines
public $skip_update_total; // Skip update price total for special lines
// Multicurrency
var $fk_multicurrency;
var $multicurrency_code;
var $multicurrency_subprice;
var $multicurrency_total_ht;
var $multicurrency_total_tva;
var $multicurrency_total_ttc;
public $fk_multicurrency;
public $multicurrency_code;
public $multicurrency_subprice;
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
/**
* Class line Contructor

View File

@ -16,9 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Luracast\Restler\RestException;
use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
/**
* API class for orders
@ -544,7 +544,7 @@ class Orders extends DolibarrApi
}
if( ! $this->commande->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete order : '.$this->commande->error);
throw new RestException(500, 'Error when deleting order : '.$this->commande->error);
}
return array(
@ -838,15 +838,16 @@ class Orders extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->note);

View File

@ -248,14 +248,16 @@ class BankAccounts extends DolibarrApi
return $account;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->rowid);

View File

@ -25,15 +25,14 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$langs->loadLangs(array("accountancy","bills"));
$langs->loadLangs(array("accountancy", "bills", "companies"));
$date_start =GETPOST('date_start', 'alpha');
$date_startDay= GETPOST('date_startday', 'int');
@ -49,7 +48,7 @@ $date_stop=($date_stopDay)?dol_mktime(0, 0, 0, $date_stopMonth, $date_stopDay, $
$action =GETPOST('action', 'alpha');
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('comptafileslist','globallist'));
$hookmanager->initHooks(array('comptafileslist', 'globallist'));
// Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
@ -92,7 +91,7 @@ $filesarray=array();
$result=false;
if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) {
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
$sql="SELECT rowid as id, ref as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
$sql="SELECT rowid as id, ref as ref, paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
$sql.=" WHERE datef between ".$wheretail;
$sql.=" AND entity IN (".($entity==1?'0,1':$entity).')';
$sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT;
@ -189,6 +188,7 @@ if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) {
//var_dump($upload_dir);
if (count($files) < 1)
{
$nofile['id']=$objd->id;
$nofile['date']=$db->idate($objd->date);
$nofile['paid']=$objd->paid;
$nofile['amount']=$objd->total_ttc;
@ -202,6 +202,7 @@ if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) {
{
foreach ($files as $key => $file)
{
$file['id']=$objd->id;
$file['date']=$db->idate($objd->date);
$file['paid']=$objd->paid;
$file['amount']=$objd->total_ttc;
@ -236,6 +237,12 @@ if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) {
if ($result && $action == "dl")
{
if (! extension_loaded('zip'))
{
setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors');
exit;
}
$dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp);
dol_mkdir($dirfortmpfile);

View File

@ -1131,7 +1131,7 @@ if (empty($reshook))
// Source facture
$object->fac_rec = GETPOST('fac_rec', 'int');
$id = $object->create($user); // This include recopy of links from recurring invoice and invoice lines
$id = $object->create($user); // This include recopy of links from recurring invoice and recurring invoice lines
}
}

View File

@ -1417,15 +1417,16 @@ class Invoices extends DolibarrApi
return $paiement_id;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->note);

View File

@ -723,7 +723,7 @@ class Facture extends CommonInvoice
}
/*
* Insert lines of predefined invoices
* Insert lines of template invoices
*/
if (! $error && $this->fac_rec > 0)
{
@ -749,7 +749,32 @@ class Facture extends CommonInvoice
$localtax1_tx = $_facrec->lines[$i]->localtax1_tx;
$localtax2_tx = $_facrec->lines[$i]->localtax2_tx;
$result_insert = $this->addline(
$fk_product_fournisseur_price = empty($_facrec->lines[$i]->fk_product_fournisseur_price)?null:$_facrec->lines[$i]->fk_product_fournisseur_price;
$buyprice = empty($_facrec->lines[$i]->buyprice)?0:$_facrec->lines[$i]->buyprice;
// If buyprice not defined from template invoice, we try to guess the best value
if (! $buyprice && $_facrec->lines[$i]->fk_product > 0)
{
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
$producttmp = new ProductFournisseur($this->db);
$producttmp->fetch($_facrec->lines[$i]->fk_product);
// If margin module defined on costprice, we try the costprice
// If not defined or if module margin defined and pmp and stock module enabled, we try pmp price
// else we get the best supplier price
if ($conf->global->MARGIN_TYPE == 'costprice' && ! empty($producttmp->cost_price)) $buyprice = $producttmp->cost_price;
elseif (! empty($conf->stock->enabled) && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && ! empty($producttmp->pmp)) $buyprice = $producttmp->pmp;
else {
if ($producttmp->find_min_price_product_fournisseur($_facrec->lines[$i]->fk_product) > 0)
{
if ($producttmp->product_fourn_price_id > 0)
{
$buyprice = price2num($producttmp->fourn_unitprice * (1 - $producttmp->fourn_remise_percent/100) + $producttmp->fourn_remise, 'MU');
}
}
}
}
$result_insert = $this->addline(
$_facrec->lines[$i]->desc,
$_facrec->lines[$i]->subprice,
$_facrec->lines[$i]->qty,
@ -771,8 +796,8 @@ class Facture extends CommonInvoice
'',
0,
0,
null,
0,
$fk_product_fournisseur_price,
$buyprice,
$_facrec->lines[$i]->label,
empty($_facrec->lines[$i]->array_options)?null:$_facrec->lines[$i]->array_options,
$_facrec->lines[$i]->situation_percent,
@ -4273,9 +4298,9 @@ class Facture extends CommonInvoice
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)

View File

@ -633,15 +633,16 @@ class Contracts extends DolibarrApi
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->address);

View File

@ -29,7 +29,7 @@
// Submit file/link
if (GETPOST('sendit', 'alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
if (! empty($_FILES))
if (! empty($_FILES))
{
if (is_array($_FILES['userfile']['tmp_name'])) $userfiles=$_FILES['userfile']['tmp_name'];
else $userfiles=array($_FILES['userfile']['tmp_name']);

View File

@ -1,11 +1,12 @@
<?php
/**
* Copyright (C) Dan Potter
* Copyright (C) Eric Seigne
* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) Dan Potter
* Copyright (C) Eric Seigne
* Copyright (C) 2000-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1429,7 +1430,7 @@ class CMailFile
* Return a formatted address string for SMTP protocol
*
* @param string $address Example: 'John Doe <john@doe.com>, Alan Smith <alan@smith.com>' or 'john@doe.com, alan@smith.com'
* @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between "
* @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between ", 4 label or email, 5 mailto link
* @param int $encode 0=No encode name, 1=Encode name to RFC2822
* @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more.
* @return string If format 0: '<john@doe.com>' or 'John Doe <john@doe.com>' or '=?UTF-8?B?Sm9obiBEb2U=?= <john@doe.com>'
@ -1437,6 +1438,7 @@ class CMailFile
* If format 2: 'john@doe.com'
* If format 3: '<john@doe.com>' or '"John Doe" <john@doe.com>' or '"=?UTF-8?B?Sm9obiBEb2U=?=" <john@doe.com>'
* If format 4: 'John Doe' or 'john@doe.com' if no label exists
* If format 5: <a href="mailto:john@doe.com">John Doe</a> or <a href="mailto:john@doe.com">john@doe.com</a> if no label exists
*/
public static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0)
{
@ -1466,6 +1468,10 @@ class CMailFile
$i++;
$newemail='';
if ($format == 5) {
$newemail = $name?$name:$email;
$newemail = '<a href="mailto:'.$email.'">'.$newemail.'</a>';
}
if ($format == 4)
{
$newemail = $name?$name:$email;

View File

@ -6378,6 +6378,7 @@ abstract class CommonObject
}
if (($mode == 'create' || $mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
elseif($mode == 'view' && empty($visibility)) continue;
if (empty($perms)) continue;
// Load language if required

View File

@ -82,7 +82,7 @@ abstract class CommonOrderLine extends CommonObjectLine
* @deprecated
* @see subprice
*/
var $price;
public $price;
/**
* Unit price before taxes

View File

@ -2747,23 +2747,23 @@ class Form
}
if ($objp->quantity == 1)
{
$opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
$outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
$opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
$outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/";
$opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
$outval.=$langs->transnoentities("Unit");
}
else
{
$opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
$opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.= ' '.$langs->transnoentities("Units");
}
if ($objp->quantity >= 1)
{
$opt.=" (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$outval.=" (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$opt.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
$outval.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
}
if ($objp->remise_percent >= 1)
{
@ -2854,7 +2854,7 @@ class Form
$langs->load('stocks');
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
@ -2914,7 +2914,7 @@ class Form
}
if ($objp->quantity == 1)
{
$opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
$opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/";
}
$opt.= $objp->quantity.' ';
@ -2930,7 +2930,7 @@ class Form
if ($objp->quantity > 1)
{
$opt.=" - ";
$opt.= price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
$opt.= price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit");
}
if ($objp->duration) $opt .= " - ".$objp->duration;
$opt .= "</option>\n";

View File

@ -62,7 +62,9 @@ class FormAdmin
public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0)
{
// phpcs:enable
global $langs;
global $conf, $langs;
if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1;
$langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);

View File

@ -77,9 +77,10 @@ class FormFile
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
* @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')
* @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be)
* @param int $usewithoutform 0=Default, 1=Disable <form> and style to use in existing area
* @return int <0 if KO, >0 if OK
*/
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '')
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0)
{
// phpcs:enable
global $conf,$langs, $hookmanager;
@ -114,10 +115,13 @@ class FormFile
if (empty($title)) $title=$langs->trans("AttachANewFile");
if ($title != 'none') $out.=load_fiche_titre($title, null, null);
$out .= '<form name="'.$htmlname.'" id="'.$htmlname.'" action="'.$url.'" enctype="multipart/form-data" method="POST">';
$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="token" value="'.$_SESSION['newtoken'].'">';
if (empty($usewithoutform))
{
$out .= '<form name="'.$htmlname.'" id="'.$htmlname.'" action="'.$url.'" enctype="multipart/form-data" method="POST">';
$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="token" value="'.$_SESSION['newtoken'].'">';
}
$out .= '<table width="100%" class="nobordernopadding">';
$out .= '<tr>';
@ -176,13 +180,7 @@ class FormFile
if ($savingdocmask)
{
//add a global variable for disable the auto renaming on upload
if (! empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT))
{
$rename='';
}
else {
$rename='checked';
}
$rename=(empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT)?'checked':'');
$out .= '<tr>';
if (! empty($options)) $out .= '<td>'.$options.'</td>';
@ -194,8 +192,11 @@ class FormFile
$out .= "</table>";
$out .= '</form>';
if (empty($sectionid)) $out .= '<br>';
if (empty($usewithoutform))
{
$out .= '</form>';
if (empty($sectionid)) $out .= '<br>';
}
$out .= "\n<!-- End form attach new file -->\n";
@ -205,12 +206,16 @@ class FormFile
$langs->load('link');
$title = $langs->trans("LinkANewFile");
$out .= load_fiche_titre($title, null, null);
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<div class="valignmiddle" >';
if (empty($usewithoutform))
{
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">';
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
$out .= '<div class="valignmiddle">';
$out .= '<div class="inline-block" style="padding-right: 10px;">';
if (! empty($conf->global->OPTIMIZEFORTEXTBROWSER)) $out .= '<label for="link">'.$langs->trans("URLToLink") . ':</label> ';
$out .= '<input type="text" name="link" class="flat minwidth400imp" id="link" placeholder="'.dol_escape_htmltag($langs->trans("URLToLink")).'">';
@ -227,8 +232,11 @@ class FormFile
$out .= '>';
$out .= '</div>';
$out .= '</div>';
$out .= '<div class="clearboth"></div>';
$out .= '</form><br>';
if (empty($usewithoutform))
{
$out .= '<div class="clearboth"></div>';
$out .= '</form><br>';
}
$out .= "\n<!-- End form link new url -->\n";
}
@ -237,7 +245,7 @@ class FormFile
$res = $hookmanager->executeHooks('formattachOptions', $parameters, $object);
if (empty($res))
{
print '<div class="attacharea attacharea'.$htmlname.'">';
print '<div class="'.($usewithoutform?'inline-block valignmiddle':'attacharea attacharea'.$htmlname).'">';
print $out;
print '</div>';
}
@ -682,6 +690,7 @@ class FormFile
// Model
if (! empty($modellist))
{
asort($modellist);
$out.= '<span class="hideonsmartphone">'.$langs->trans('Model').' </span>';
if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{

View File

@ -60,7 +60,7 @@ class FormProjets
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode

View File

@ -24,6 +24,7 @@
*/
require_once DOL_DOCUMENT_ROOT . "/core/class/html.form.class.php";
require_once DOL_DOCUMENT_ROOT . "/core/class/html.formmail.class.php";
require_once DOL_DOCUMENT_ROOT . "/core/class/html.formprojet.class.php";
if (!class_exists('FormCompany')) {
include DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
@ -103,7 +104,7 @@ class FormTicket
{
$this->db = $db;
$this->action = 'add_ticket';
$this->action = 'add';
$this->withcompany = 1;
$this->withfromsocid = 0;
@ -258,6 +259,14 @@ class FormTicket
print '<td><input type="hidden" name="contactid" value="' . $user->contactid . '"/></td>';
print '<td><input type="hidden" name="type" value="Z"/></td></tr>';
}
// Notify thirdparty at creation
if (empty($this->ispublic))
{
print '<tr><td><label for="notify_tiers_at_create">' . $langs->trans("TicketNotifyTiersAtCreation") . '</label></td><td>';
print '<input type="checkbox" id="notify_tiers_at_create" name="notify_tiers_at_create"'.($this->withnotifytiersatcreate?' checked="checked"':'').'>';
print '</td></tr>';
}
}
// TITLE
@ -305,14 +314,6 @@ class FormTicket
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2');
print '</td></tr>';
// Notify thirdparty at creation
if (empty($this->ispublic))
{
print '<tr><td><label for="notify_tiers_at_create">' . $langs->trans("TicketNotifyTiersAtCreation") . '</label></td><td>';
print '<input type="checkbox" id="notify_tiers_at_create" name="notify_tiers_at_create"'.($this->withnotifytiersatcreate?' checked="checked"':'').'>';
print '</td></tr>';
}
// TITLE
if ($this->withtitletopic) {
print '<tr><td><label for="subject"><span class="fieldrequired">' . $langs->trans("Subject") . '</span></label></td><td>';
@ -331,19 +332,30 @@ class FormTicket
}
// MESSAGE
$msg = GETPOST('message', 'alpha') ? GETPOST('message', 'alpha') : '';
$msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : '';
print '<tr><td><label for="message"><span class="fieldrequired">' . $langs->trans("Message") . '</span></label></td><td>';
// If public form, display more information
if ($this->ispublic) {
$toolbarname = 'dolibarr_notes';
if ($this->ispublic)
{
$toolbarname = 'dolibarr_details';
print '<div class="warning">' . ($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')) . '</div>';
}
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$uselocalbrowser = true;
$doleditor = new DolEditor('message', GETPOST('message', 'alpha'), '100%', 230, 'dolibarr_details', 'In', true, $uselocalbrowser);
$doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser);
$doleditor->Create();
print '</td></tr>';
if (! empty($conf->projet->enabled) && ! $this->ispublic)
{
$formproject=new FormProjets($this->db);
print '<tr><td><label for="project"><span class="">' . $langs->trans("Project") . '</span></label></td><td>';
print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1);
print '</td></tr>';
}
// Attached files
if (!empty($this->withfile)) {
// Define list of attached files
@ -408,7 +420,7 @@ class FormTicket
if ($withdolfichehead) dol_fiche_end();
print '<center>';
print '<input class="button" type="submit" name="add_ticket" value="' . $langs->trans(($this->withthreadid > 0 ? "SendResponse" : "NewTicket")) . '" />';
print '<input class="button" type="submit" name="add" value="' . $langs->trans(($this->withthreadid > 0 ? "SendResponse" : "NewTicket")) . '" />';
if ($this->withcancel) {
print " &nbsp; &nbsp; ";
@ -724,7 +736,7 @@ class FormTicket
/**
* Show the form to add message on ticket
*
* @param string $width Width of form
* @param string $width Width of form
* @return void
*/
public function showMessageForm($width = '40%')
@ -818,7 +830,6 @@ class FormTicket
print '<table class="border" width="' . $width . '">';
// External users can't send message email
if ($user->rights->ticket->write && !$user->socid) {
print '<tr><td width="30%"></td><td colspan="2">';
@ -952,9 +963,11 @@ class FormTicket
$defaultmessage=preg_replace("/^\n+/", "", $defaultmessage);
}
print '<tr><td><label for="message"><span class="fieldrequired">' . $langs->trans("Message") . '</span></label></td><td>';
print '<tr><td class="tdtop"><label for="message"><span class="fieldrequired">' . $langs->trans("Message") . '</span></label></td><td>';
//$toolbarname = 'dolibarr_details';
$toolbarname = 'dolibarr_notes';
include_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('message', $defaultmessage, '100%', 350, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor = new DolEditor('message', $defaultmessage, '100%', 200, $toolbarname, '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, 70);
$doleditor->Create();
print '</td><td align="center">';
if ($user->rights->ticket->write && !$user->socid) {
@ -1014,17 +1027,15 @@ class FormTicket
print $out;
}
print '<tr><td colspan="3">';
print '<center>';
print '<input class="button" type="submit" name="btn_add_message" value="' . $langs->trans("AddMessage") . '" />';
print '</table>';
print '<center><br>';
print '<input class="button" type="submit" name="btn_add_message" value="' . $langs->trans("AddMessage") . '" />';
if ($this->withcancel) {
print " &nbsp; &nbsp; ";
print "<input class=\"button\" type=\"submit\" name=\"cancel\" value=\"" . $langs->trans("Cancel") . "\">";
}
print "</center>\n";
print '</td></tr>';
print '</table>';
print "</form>\n";
print "<!-- End form TICKET -->\n";

View File

@ -29,9 +29,9 @@
*/
abstract class Stats
{
protected $db;
var $_lastfetchdate=array(); // Dates of cache file read by methods
var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts)
protected $db;
private $_lastfetchdate=array(); // Dates of cache file read by methods
public $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts)
/**
* Return nb of elements by month for several years

View File

@ -257,6 +257,7 @@ class DoliDBMysqli extends DoliDB
$query = trim($query);
if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG);
if (empty($query)) return false; // Return false = error if empty request
if (! $this->database_name)
{

View File

@ -40,11 +40,17 @@ function ticketAdminPrepareHead()
$head[$h][1] = $langs->trans("TicketSettings");
$head[$h][2] = 'settings';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/ticket_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsTicket");
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/ticket_public.php';
$head[$h][1] = $langs->trans("PublicInterface");
$head[$h][2] = 'public';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(

View File

@ -22,7 +22,6 @@
*/
/**
* Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content.
* Used to ouput the page on the Preview from backoffice.
@ -661,7 +660,7 @@ function dolSavePageContent($filetpl, $object, $objectpage)
$tplcontent ='';
$tplcontent.= "<?php // BEGIN PHP\n";
$tplcontent.= '$websitekey=basename(dirname(__FILE__)); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$tplcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Not already loaded"."\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n";
@ -731,7 +730,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper)
dol_delete_file($fileindex);
$indexcontent = '<?php'."\n";
$indexcontent.= "// BEGIN PHP File generated to provide an index.php as Home Page or alias redirector - DO NOT MODIFY - It is just a generated wrapper.\n";
$indexcontent.= '$websitekey=basename(dirname(__FILE__)); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$indexcontent.= '$websitekey=basename(__DIR__); if (empty($websitepagefile)) $websitepagefile=__FILE__;'."\n";
$indexcontent.= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) { require_once './master.inc.php'; } // Load master if not already loaded\n";
$indexcontent.= 'if (! empty($_GET[\'pageref\']) || ! empty($_GET[\'pagealiasalt\']) || ! empty($_GET[\'pageid\'])) {'."\n";
$indexcontent.= " require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";

View File

@ -109,8 +109,8 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes
}
else
{
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'");
sleep(2); // Anti brut force protection
sleep(2); // Anti brut force protection
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."', cryptType=".$cryptType);
// Load translation files required by the page
$langs->loadLangs(array('main', 'errors'));

View File

@ -5,7 +5,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -65,265 +65,403 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
}
$menu_arr = array();
// Home
$showmode=1;
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='home';
$titlehome = $langs->trans("Home");
if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '&nbsp; <span class="fa fa-home"></span> &nbsp;';
$menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname);
$menu_arr[] = array(
'name' => 'Home',
'link' => '/index.php?mainmenu=home&amp;leftmenu=home',
'title' => (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)? '&nbsp; <span class="fa fa-home"></span> &nbsp;' : "Home") ,
'level' => 0,
'enabled' => $showmode = 1,
'target' => $atarget,
'mainmenu' => "home",
'leftmenu' => '',
'position' => 10,
'id' => $id,
'idsel' => 'home',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home" ) ? 0 : 1 ),
'loadLangs' => array(),
'submenus' => array(),
);
// Members
$tmpentry = array(
'enabled'=>(! empty($conf->adherent->enabled)),
'perms'=>(! empty($user->rights->adherent->lire)),
'module'=>'adherent',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='members';
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 18, $id, $idsel, $classname);
}
$menu_arr[] = array(
'name' => 'Members',
'link' => '/adherents/index.php?mainmenu=members&amp;leftmenu=',
'title' => "MenuMembers",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled' => (! empty($conf->adherent->enabled) ) ,
'perms' => (! empty($user->rights->adherent->lire) ),
'module' => 'adherent',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "members",
'leftmenu' => '',
'position' => 18,
'id' => $id,
'idsel' => 'members',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 0 : 1 ),
'loadLangs' => array(),
'submenus' => array(),
);
// Third parties
$tmpentry = array(
'enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)),
'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)),
'module'=>'societe|fournisseur',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
// Load translation files required by the page
$langs->loadLangs(array("companies","suppliers"));
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='companies';
$menu->add('/societe/index.php?mainmenu=companies&amp;leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '', 20, $id, $idsel, $classname);
}
$menu_arr[] = array(
'name' => 'Companies',
'link' => '/societe/index.php?mainmenu=companies&amp;leftmenu=',
'title' => "ThirdParties",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=> ( ( ! empty($conf->societe->enabled) &&
( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) )
)
|| ! empty($conf->fournisseur->enabled)
),
'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)),
'module'=>'societe|fournisseur',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "companies",
'leftmenu' => '',
'position' => 20,
'id' => $id,
'idsel' => 'companies',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies" ) ? 0 : 1 ),
'loadLangs' => array("companies","suppliers"),
'submenus' => array(),
);
// Products-Services
$tmpentry = array(
'enabled'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)),
'perms'=>(! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)),
'module'=>'product|service',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("products");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='products';
$chaine="";
if (! empty($conf->product->enabled)) {
$chaine.=$langs->trans("TMenuProducts");
}
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) {
$chaine.=" | ";
}
if (! empty($conf->service->enabled)) {
$chaine.=$langs->trans("TMenuServices");
}
$menu->add('/product/index.php?mainmenu=products&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "products", '', 30, $id, $idsel, $classname);
}
$menu_arr[] = array(
'name' => 'Products',
'link' => '/product/index.php?mainmenu=products&amp;leftmenu=',
'title' => (! empty($conf->product->enabled) && ! empty($conf->service->enabled))
? ( array("TMenuProducts" , " | " ,"TMenuServices") )
: (! empty($conf->product->enabled)? "TMenuProducts" : "TMenuServices" ),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=> (( ! empty($conf->societe->enabled) &&
( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) )
)
|| ! empty($conf->fournisseur->enabled)
),
'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)),
'module'=>'product|service',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "products",
'leftmenu' => '',
'position' => 30,
'id' => $id,
'idsel' => 'products',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products" ) ? 0 : 1 ),
'loadLangs' => array("products"),
'submenus' => array(),
);
// MRP
$tmpentry = array(
'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)),
'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)),
'module'=>'bom|mrp',
$menu_arr[] = array(
'name' => 'TMenuMRP',
'link' => '/bom/bom_list.php?mainmenu=mrp&amp;leftmenu=',
'title' => $langs->trans("TMenuMRP"),
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)),
'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)),
'module'=>'bom|mrp',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "mrp",
'leftmenu' => '',
'position' => 30,
'id' => $id,
'idsel' => 'mrp',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 0 : 1 ),
'loadLangs' => array("projects"),
'submenus' => array(),
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='products';
$chaine=$langs->trans("TMenuMRP");
$menu->add('/bom/bom_list.php?mainmenu=mrp&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "bom", '', 30, $id, $idsel, $classname);
}
// Projects
$tmpentry=array('enabled'=>(! empty($conf->projet->enabled)),
'perms'=>(! empty($user->rights->projet->lire)),
'module'=>'projet');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("projects");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='project';
$title = $langs->trans("LeadsOrProjects"); // Leads and opportunities by default
$showmodel = $showmodep = $showmode;
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
$title = $langs->trans("Projects");
$showmodel = 0;
}
if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) {
$title = $langs->trans("Leads");
$showmodep = 0;
}
$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=', $title, 0, $showmode, $atarget, "project", '', 35, $id, $idsel, $classname);
//$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=&search_opp_status=openedopp', $langs->trans("ListLeads"), 0, $showmodel & $conf->global->PROJECT_USE_OPPORTUNITIES, $atarget, "project", '', 70, $id, $idsel, $classname);
//$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=&search_opp_status=notopenedopp', $langs->trans("ListProjects"), 0, $showmodep, $atarget, "project", '', 70, $id, $idsel, $classname);
}
$menu_arr[] = array(
'name' => 'Projet',
'link' => '/projet/index.php?mainmenu=project&amp;leftmenu=',
'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2 )
? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2)?"Leads":"Projects")
: "LeadsOrProjects",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0),
'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0),
'module'=>'projet',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "project",
'leftmenu' => '',
'position' => 35,
'id' => $id,
'idsel' => 'project',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 0 : 1 ),
'loadLangs' => array("projects"),
'submenus' => array(),
);
// Commercial
$menuqualified=0;
if (! empty($conf->propal->enabled)) $menuqualified++;
if (! empty($conf->commande->enabled)) $menuqualified++;
if (! empty($conf->supplier_order->enabled)) $menuqualified++;
if (! empty($conf->supplier_proposal->enabled)) $menuqualified++;
if (! empty($conf->contrat->enabled)) $menuqualified++;
if (! empty($conf->ficheinter->enabled)) $menuqualified++;
$tmpentry = array(
'enabled'=>$menuqualified,
'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)),
'module'=>'propal|commande|supplier_order|contrat|ficheinter',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("commercial");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='commercial';
$menu->add('/comm/index.php?mainmenu=commercial&amp;leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "", 40, $id, $idsel, $classname);
}
$menu_arr[] = array(
'name' => 'Commercial',
'link' => '/comm/index.php?mainmenu=commercial&amp;leftmenu=',
'title' => "Commercial",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=>(! empty($conf->propal->enabled) ||
! empty($conf->commande->enabled) ||
! empty($conf->supplier_order->enabled) ||
! empty($conf->supplier_proposal->enabled) ||
! empty($conf->contrat->enabled) ||
! empty($conf->ficheinter->enabled)
)?1:0,
'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)),
'module'=>'propal|commande|supplier_order|contrat|ficheinter',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "commercial",
'leftmenu' => '',
'position' => 40,
'id' => $id,
'idsel' => 'commercial',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial" ) ? 0 : 1 ),
'loadLangs' => array("commercial"),
'submenus' => array(),
);
// Billing - Financial
$menuqualified=0;
if (! empty($conf->facture->enabled)) $menuqualified++;
if (! empty($conf->don->enabled)) $menuqualified++;
if (! empty($conf->tax->enabled)) $menuqualified++;
if (! empty($conf->salaries->enabled)) $menuqualified++;
if (! empty($conf->supplier_invoice->enabled)) $menuqualified++;
if (! empty($conf->loan->enabled)) $menuqualified++;
$tmpentry = array(
'enabled'=>$menuqualified,
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
'module'=>'facture|supplier_invoice|don|tax|salaries|loan',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("compta");
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='billing';
$menu->add('/compta/index.php?mainmenu=billing&amp;leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "billing", '', 50, $id, $idsel, $classname);
}
$menu_arr[] = array(
'name' => 'Compta',
'link' => '/compta/index.php?mainmenu=billing&amp;leftmenu=',
'title' => "MenuFinancial",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=>(! empty($conf->facture->enabled) ||
! empty($conf->don->enabled) ||
! empty($conf->tax->enabled) ||
! empty($conf->salaries->enabled) ||
! empty($conf->supplier_invoice->enabled) ||
! empty($conf->loan->enabled)
)?1:0,
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->contact->lire)
|| ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read)
|| ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
'module'=>'facture|supplier_invoice|don|tax|salaries|loan',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "billing",
'leftmenu' => '',
'position' => 50,
'id' => $id,
'idsel' => 'billing',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing" ) ? 0 : 1 ),
'loadLangs' => array("compta"),
'submenus' => array(),
);
// Bank
$tmpentry = array(
'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)),
'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)),
'module'=>'banque|prelevement',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
// Load translation files required by the page
$langs->loadLangs(array("compta","banks"));
$menu_arr[] = array(
'name' => 'Bank',
'link' => '/compta/bank/list.php?mainmenu=bank&amp;leftmenu=',
'title' => "MenuBankCash",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)),
'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)),
'module'=>'banque|prelevement',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "bank",
'leftmenu' => '',
'position' => 52,
'id' => $id,
'idsel' => 'bank',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='bank';
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 0 : 1 ),
$menu->add('/compta/bank/list.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 52, $id, $idsel, $classname);
}
'loadLangs' => array("compta","banks"),
'submenus' => array(),
);
// Accounting
$menuqualified=0;
if (! empty($conf->comptabilite->enabled)) $menuqualified++;
if (! empty($conf->accounting->enabled)) $menuqualified++;
if (! empty($conf->asset->enabled)) $menuqualified++;
$tmpentry = array(
'enabled'=>$menuqualified,
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)),
'module'=>'comptabilite|accounting',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("compta");
$menu_arr[] = array(
'name' => 'Accounting',
'link' => '/accountancy/index.php?mainmenu=accountancy&amp;leftmenu=',
'title' => "MenuAccountancy",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)),
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)),
'comptabilite|accounting',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "accountancy",
'leftmenu' => '',
'position' => 54,
'id' => $id,
'idsel' => 'accountancy',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='accountancy';
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 0 : 1 ),
$menu->add('/accountancy/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("MenuAccountancy"), 0, $showmode, $atarget, "accountancy", '', 54, $id, $idsel, $classname);
}
'loadLangs' => array("compta"),
'submenus' => array(),
);
// HRM
$tmpentry = array(
'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)),
'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)),
'module'=>'hrm|holiday|deplacement|expensereport',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{
$langs->load("holiday");
$menu_arr[] = array(
'name' => 'HRM',
'link' => '/hrm/index.php?mainmenu=hrm&amp;leftmenu=',
'title' => "HRM",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)),
'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)),
'module'=>'hrm|holiday|deplacement|expensereport',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "hrm",
'leftmenu' => '',
'position' => 80,
'id' => $id,
'idsel' => 'hrm',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='hrm';
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 0 : 1 ),
$menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname);
}
'loadLangs' => array("holiday"),
'submenus' => array(),
);
// Tools
$tmpentry = array(
'enabled'=>1,
'perms'=>1,
'module'=>'',
);
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
$menu_arr[] = array(
'name' => 'Tools',
'link' => '/core/tools.php?mainmenu=tools&amp;leftmenu=',
'title' => "Tools",
'level' => 0,
'enabled' => $showmode = isVisibleToUserType(
$type_user,
$tmpentry = array(
'enabled'=>1,
'perms'=>1,
'module'=>'',
),
$listofmodulesforexternal
),
'target' => $atarget,
'mainmenu' => "tools",
'leftmenu' => '',
'position' => 90,
'id' => $id,
'idsel' => 'tools',
'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 'class="tmenusel"' : 'class="tmenu"',
'prefix' => '',
'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 0 : 1 ),
'loadLangs' => array("other"),
'submenus' => array(),
);
// Add menus
foreach($menu_arr as $key => $smenu)
{
$langs->load("other");
$smenu = (object) $smenu;
$classname="";
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; }
else $classname = 'class="tmenu"';
$idsel='tools';
if( $smenu->enabled )
{
if($langs->session)
{
$_SESSION['idmenu']='';
}
$menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname);
// Load Langue
if(! empty($smenu->loadLangs))
{
$langs->loadLangs($smenu->loadLangs);
}
// Trans title
$mtitle = '';
if(is_array($smenu->title))
{
foreach($smenu->title as $item)
{
$mtitle .= $langs->trans($item);
}
}
else
{
$mtitle = $langs->trans($smenu->title);
}
// Add item
$menu->add($smenu->link, $mtitle, $smenu->level, $smenu->enabled, $smenu->target, $smenu->mainmenu, $smenu->leftmenu, $smenu->position, $smenu->id, $smenu->idsel, $smenu->classname, $smenu->prefix);
}
}
// Show personalized menus

View File

@ -915,21 +915,26 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
/**
* Gives the last date of activation
*
* @return timestamp Date of last activation
* @return timestamp|string Date of last activation
*/
public function getLastActivationDate()
{
global $conf;
$err = 0;
$sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
$sql.= " AND entity IN (0, ".$conf->entity.")";
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) {
if (! $resql)
{
$err++;
} else {
}
else
{
$obj=$this->db->fetch_object($resql);
if ($obj) {
return $this->db->jdate($obj->tms);
@ -949,15 +954,20 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
{
global $conf;
$sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
$sql.= " AND entity IN (0, ".$conf->entity.")";
$err = 0;
$sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
$sql.= " AND entity IN (0, ".$conf->entity.")";
dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) {
if (! $resql)
{
$err++;
} else {
}
else
{
$obj=$this->db->fetch_object($resql);
$tmp=array();
if ($obj->note) {
@ -972,6 +982,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Insert constants for module activation
*
@ -979,6 +990,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*/
protected function _active()
{
// phpcs:enable
global $conf, $user;
$err = 0;
@ -1013,6 +1025,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Module deactivation
*
@ -1020,6 +1033,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*/
protected function _unactive()
{
// phpcs:enable
global $conf;
$err = 0;
@ -1038,7 +1052,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Create tables and keys required by module.
* Files module.sql and module.key.sql with create table and create keys
@ -1152,7 +1166,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
if (! $dirfound) { dol_syslog("A module ask to load sql files into ".$reldir." but this directory was not found.", LOG_WARNING);
if (! $dirfound) {
dol_syslog("A module ask to load sql files into ".$reldir." but this directory was not found.", LOG_WARNING);
}
return $ok;
}

View File

@ -24,6 +24,8 @@
require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php';
// avoid timeout for big export
set_time_limit(0);
/**
* Class to build export files with format CSV

View File

@ -103,9 +103,10 @@ class modTicket extends DolibarrModules
// List of particular constants to add when module is enabled
// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example:
$this->const = array();
$this->const[1] = array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '1', 'Enable ticket public interface');
$this->const[2] = array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module');
$this->const = array(
1 => array('TICKET_ENABLE_PUBLIC_INTERFACE', 'chaine', '0', 'Enable ticket public interface', 0),
2 => array('TICKET_ADDON', 'chaine', 'mod_ticket_simple', 'Ticket ref module', 0)
);
$this->tabs = array(
'thirdparty:+ticket:Tickets:@ticket:$user->rights->ticket->read:/ticket/list.php?socid=__ID__',
@ -217,7 +218,7 @@ class modTicket extends DolibarrModules
'type' => 'left',
'titre' => 'NewTicket',
'mainmenu' => 'ticket',
'url' => '/ticket/new.php?action=create_ticket',
'url' => '/ticket/card.php?action=create',
'langs' => 'ticket',
'position' => 102,
'enabled' => '$conf->ticket->enabled',

View File

@ -54,6 +54,12 @@ if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/com
class pdf_beluga extends ModelePDFProjects
{
/**
* Page orientation
* @var string 'P' or 'Portait' (default), 'L' or 'Landscape'
*/
private $orientation = '';
/**
* Issuer
* @var Societe
@ -79,8 +85,14 @@ class pdf_beluga extends ModelePDFProjects
// Dimension page pour format A4
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->orientation = 'L';
if ($this->orientation == 'L' || $this->orientation == 'Landscape') {
$this->page_largeur = $formatarray['height'];
$this->page_hauteur = $formatarray['width'];
} else {
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
}
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
@ -95,13 +107,22 @@ class pdf_beluga extends ModelePDFProjects
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined
// Defini position des colonnes
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+25;
$this->posxsociety=$this->marge_gauche+45;
$this->posxamountht=$this->marge_gauche+110;
$this->posxamountttc=$this->marge_gauche+135;
$this->posxstatut=$this->marge_gauche+165;
// Defini position des colonnes
if ($this->orientation == 'L' || $this->orientation == 'Landscape') {
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+105;
$this->posxsociety=$this->marge_gauche+125;
$this->posxamountht=$this->marge_gauche+190;
$this->posxamountttc=$this->marge_gauche+215;
$this->posxstatut=$this->marge_gauche+245;
} else {
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+25;
$this->posxsociety=$this->marge_gauche+45;
$this->posxamountht=$this->marge_gauche+110;
$this->posxamountttc=$this->marge_gauche+135;
$this->posxstatut=$this->marge_gauche+165;
}
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxref-=20;
@ -217,7 +238,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// New page
$pdf->AddPage();
$pdf->AddPage($this->orientation);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
@ -433,7 +454,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->SetTextColor(0, 0, 0);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation($this->orientation, 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of line
@ -469,7 +490,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
// Label
$pdf->SetXY($this->posxref, $curY);
$posybefore=$pdf->GetY();
@ -480,7 +501,7 @@ class pdf_beluga extends ModelePDFProjects
{
if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page
{
$pdf->AddPage('', '', true);
$pdf->AddPage($this->orientation, '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
@ -495,9 +516,9 @@ class pdf_beluga extends ModelePDFProjects
{
$pdf->rollbackTransaction(true);
$pageposafter=$pageposbefore;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->AddPage('', '', true);
$pdf->AddPage($this->orientation, '', true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pageposafter+1);
@ -505,7 +526,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0, 0, 0);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
$curY = $tab_top_newpage + $heightoftitleline + 1;
// Label
@ -528,7 +549,7 @@ class pdf_beluga extends ModelePDFProjects
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it.
// We suppose that a too long description is moved completely on next page
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
@ -628,7 +649,7 @@ class pdf_beluga extends ModelePDFProjects
$this->_pagefoot($pdf, $object, $outputlangs, 1);
$pagenb++;
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
}
}

View File

@ -7,7 +7,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
*/
class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
{
var $code = 'chromephp';
public $code = 'chromephp';
/**
* Return name of logger
@ -50,7 +50,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php');
}
/**
* Is the module active ?
*
@ -159,7 +159,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface
$res = @include_once 'ChromePhp.php';
if (! $res) $res=@include_once 'ChromePhp.class.php';
set_include_path($oldinclude);
ob_start(); // To be sure headers are not flushed until all page is completely processed
if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']);
elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']);

View File

@ -7,8 +7,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
*/
class mod_syslog_file extends LogHandler implements LogHandlerInterface
{
var $code = 'file';
var $lastTime = 0;
public $code = 'file';
public $lastTime = 0;
/**
* Return name of logger

View File

@ -7,7 +7,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
*/
class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
{
var $code = 'syslog';
public $code = 'syslog';
/**
* Return name of logger

View File

@ -263,15 +263,17 @@ else {
if ($senderissupplier != 2)
{
$ajaxoptions=array(
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
);
$alsoproductwithnosupplierprice=0;
}
else
{
$ajaxoptions = array();
$ajaxoptions = array(
'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key
);
$alsoproductwithnosupplierprice=1;
}
@ -596,6 +598,28 @@ if (! empty($usemargins) && $user->rights->margins->creer)
/* JQuery for product free or predefined select */
jQuery(document).ready(function() {
jQuery("#price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#price_ttc").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
}
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
});
$("#prod_entry_mode_free").on( "click", function() {
setforfree();
});
@ -662,10 +686,7 @@ jQuery(document).ready(function() {
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) {
if (data && data.length > 0)
{
var options = '';
var defaultkey = '';
var defaultprice = '';
var bestpricefound = 0;
var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0;
var bestpriceid = 0; var bestpricevalue = 0;
var pmppriceid = 0; var pmppricevalue = 0;
@ -796,61 +817,29 @@ jQuery(document).ready(function() {
<?php if (GETPOST('prod_entry_mode') == 'predef') { // When we submit with a predef product and it fails we must start with predef ?>
setforpredef();
<?php } ?>
});
/* Function to set fields from choice */
function setforfree() {
console.log("Call setforfree. We show most fields");
jQuery("#search_idprod").val('');
jQuery("#idprod").val('');
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
jQuery("#search_idprodfournprice").val('');
jQuery("#prod_entry_mode_free").prop('checked',true).change();
jQuery("#prod_entry_mode_predef").prop('checked',false).change();
jQuery("#price_ht").show();
jQuery("#multicurrency_price_ht").show();
jQuery("#price_ttc").show(); // May not exist
jQuery("#fourn_ref").show();
jQuery("#tva_tx").show();
jQuery("#buying_price").val('').show();
jQuery("#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val('');
jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show();
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show();
jQuery("#fournprice_predef").hide();
jQuery("#title_vat").show();
jQuery("#title_up_ht").show();
jQuery("#title_up_ht_currency").show();
jQuery("#title_up_ttc").show();
jQuery("#title_up_ttc_currency").show();
jQuery("#np_marginRate").show(); // May not exist
jQuery("#np_markRate").show(); // May not exist
jQuery(".np_marginRate").show(); // May not exist
jQuery(".np_markRate").show(); // May not exist
jQuery("#units, #title_units").show();
}
function setforpredef() {
console.log("Call setforpredef. We hide some fields and show dates");
jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").prop('checked',false).change();
jQuery("#prod_entry_mode_predef").prop('checked',true).change();
jQuery("#price_ht").val('').hide();
jQuery("#multicurrency_price_ht").hide();
jQuery("#price_ttc").hide(); // May not exist
jQuery("#fourn_ref").hide();
jQuery("#tva_tx").hide();
jQuery("#price_ht").val('')
jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide();
jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide();
jQuery("#buying_price").show();
jQuery("#title_vat").hide();
jQuery("#title_up_ht").hide();
jQuery("#title_up_ht_currency").hide();
jQuery("#title_up_ttc").hide();
jQuery("#title_up_ttc_currency").hide();
jQuery("#np_marginRate").hide(); // May not exist
jQuery("#np_markRate").hide(); // May not exist
jQuery(".np_marginRate").hide(); // May not exist
jQuery(".np_markRate").hide(); // May not exist
jQuery("#units, #title_units").hide();
jQuery('#trlinefordates').show();
jQuery('.divlinefordates').show();
jQuery('#trlinefordates, .divlinefordates').show();
}
</script>

View File

@ -13,30 +13,23 @@ $form= new Form($db);
print '<div class="tagtable centpercent noborder allwidth">';
if($mode == 'edit' )
{
print '<form class="tagtr liste_titre">';
print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
print '<div class="tagtd liste_titre center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd liste_titre center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd liste_titre"></div>';
print '</form>';
}
else
{
print '<form class="tagtr liste_titre">';
print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
print '<div class="tagtd liste_titre center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd liste_titre center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd liste_titre"></div>';
print '</form>';
}
print '<form method="POST" class="tagtable centpercent noborder allwidth">';
print '<div class="tagtr liste_titre">';
print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd liste_titre">'.$langs->trans('Type').'</div>';
print '<div class="tagtd liste_titre center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd liste_titre center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd liste_titre"></div>';
print '</div>';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="id" value="'.$element_id.'" />';
print '<input type="hidden" name="action" value="update_linked_resource" />';
print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
if( (array) $linked_resources && count($linked_resources) > 0)
{
foreach ($linked_resources as $linked_resource)
{
@ -46,20 +39,17 @@ if( (array) $linked_resources && count($linked_resources) > 0)
if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid'))
{
print '<form class="tagtr oddeven" action="'.$_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="id" value="'.$object->id.'" />';
print '<input type="hidden" name="action" value="update_linked_resource" />';
print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
print '<div class="tagtr oddeven">';
print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
print '<input type="hidden" name="element" value="'.$element.'" />';
print '<input type="hidden" name="element_id" value="'.$element_id.'" />';
print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
print '<div class="tagtd">'.$object_resource->type_label.'</div>';
print '<div class="tagtd center">'.$form->selectyesno('busy', $linked_resource['busy']?1:0, 1).'</div>';
print '<div class="tagtd center">'.$form->selectyesno('mandatory', $linked_resource['mandatory']?1:0, 1).'</div>';
print '<div class="tagtd right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
print '</form>';
print '</div>';
}
else
{
@ -67,7 +57,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
if ($linked_resource['rowid'] == GETPOST('lineid'))
$style='style="background: orange;"';
print '<form class="tagtr oddeven" '.$style.'>';
print '<div class="tagtr oddeven" '.$style.'>';
print '<div class="tagtd">';
print $object_resource->getNomUrl(1);
@ -95,20 +85,22 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '</a>';
print '</div>';
print '</form>';
print '</div>';
}
}
}
else {
print '<form class="tagtr oddeven">';
print '<div class="tagtr oddeven">';
print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
print '<div class="tagtd opacitymedium"></div>';
print '<div class="tagtd opacitymedium"></div>';
print '<div class="tagtd opacitymedium"></div>';
print '<div class="tagtd opacitymedium"></div>';
print '</form>';
print '</div>';
}
print '</form>';
print '</div>';
?>

View File

@ -761,7 +761,6 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0;
}
elseif($action == 'TASK_MODIFY')
{
// Load translation files required by the page
@ -773,7 +772,6 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0;
}
elseif($action == 'TASK_DELETE')
{
// Load translation files required by the page

View File

@ -187,7 +187,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
// Send email to notification email
if (empty($conf->global->TICKET_DISABLE_ALL_MAILS) && empty($object->context['disableticketemail']))
if (! empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail']))
{
$sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
@ -227,6 +227,8 @@ class InterfaceTicketEmail extends DolibarrTriggers
$message_admin = dol_nl2br($message_admin);
$trackid = 'tic'.$object->id;
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
@ -246,7 +248,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
// Send email to customer
if (empty($conf->global->TICKET_DISABLE_ALL_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create)
if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create)
{
$sendto = '';
if (empty($user->socid) && empty($user->email)) {
@ -301,12 +303,14 @@ class InterfaceTicketEmail extends DolibarrTriggers
$message_customer = dol_nl2br($message_customer);
$trackid = 'tic'.$object->id;
if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
$mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid);
if ($mailfile->error) {
dol_syslog($mailfile->error, LOG_DEBUG);
} else {
@ -317,6 +321,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
}
}
}
$ok = 1;
break;
@ -328,10 +333,6 @@ class InterfaceTicketEmail extends DolibarrTriggers
dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
break;
case 'TICKET_MARK_READ':
dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
break;
case 'TICKET_CLOSE':
dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
break;

View File

@ -326,15 +326,16 @@ class Donations extends DolibarrApi
return $this->_cleanObjectDatas($this->don);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->note);

View File

@ -610,15 +610,16 @@ class Shipments extends DolibarrApi
}
*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->thirdparty); // id already returned

View File

@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/modules/expensereport/modules_expensereport.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
@ -106,6 +107,8 @@ $permissiondellink = $user->rights->expensereport->creer; // Used by the includ
$permissionedit = $user->rights->expensereport->creer; // Used by the include of actions_lineupdown.inc.php
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
/*
@ -133,11 +136,16 @@ if (empty($reshook))
$date='';
$comments='';
$vatrate='';
$value_unit_ht='';
$value_unit='';
$qty=1;
$fk_c_type_fees=-1;
}
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if (GETPOST('sendit', 'alpha')) $action='';
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
@ -215,7 +223,7 @@ if (empty($reshook))
if ($ret < 0) $error++;
}
if (empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin))
if (! $error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin))
{
$error++;
setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors');
@ -671,10 +679,6 @@ if (empty($reshook))
$action='';
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == "confirm_refuse" && GETPOST('confirm', 'alpha')=="yes" && $id > 0 && $user->rights->expensereport->approve)
{
@ -794,10 +798,6 @@ if (empty($reshook))
$action='';
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
//var_dump($user->id == $object->fk_user_validator);exit;
if ($action == "confirm_cancel" && GETPOST('confirm', 'alpha')=="yes" && $id > 0 && $user->rights->expensereport->creer)
@ -1084,21 +1084,29 @@ if (empty($reshook))
$action='';
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == "addline" && $user->rights->expensereport->creer)
{
$error = 0;
// First save uploaded file
if (! empty($_FILES))
{
}
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
if (empty($vatrate)) $vatrate = "0.000";
$vatrate = price2num($vatrate);
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate));
$value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU');
$value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int');
if (empty($value_unit))
{
$value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU');
}
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int');
$qty = GETPOST('qty', 'int');
if (empty($qty)) $qty=1;
@ -1110,23 +1118,13 @@ if (empty($reshook))
$action='';
}
if ($vatrate < 0 || $vatrate == '')
if ((int) $tmpvat < 0 || $tmpvat == '')
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors');
$action='';
}
/* Projects are never required. To force them, check module forceproject
if ($conf->projet->enabled)
{
if (empty($object_ligne->fk_projet) || $object_ligne->fk_projet==-1)
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors');
}
}*/
// Si aucune date n'est rentrée
if (empty($date) || $date=="--")
{
@ -1134,7 +1132,7 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
// Si aucun prix n'est rentré
if ($value_unit==0)
if ($value_unit == 0)
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors');
@ -1153,7 +1151,8 @@ if (empty($reshook))
// Insert line
$result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_projet, $fk_c_exp_tax_cat, $type);
if ($result > 0) {
if ($result > 0)
{
$ret = $object->fetch($object->id); // Reload to get new records
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@ -1171,6 +1170,7 @@ if (empty($reshook))
}
unset($qty);
unset($value_unit_ht);
unset($value_unit);
unset($vatrate);
unset($comments);
@ -1240,12 +1240,18 @@ if (empty($reshook))
$projet_id = $fk_projet;
$comments = GETPOST('comments', 'none');
$qty = GETPOST('qty', 'int');
$value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU');
$vatrate = GETPOST('vatrate', 'alpha');
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
if (empty($vatrate)) $vatrate = "0.000";
$vatrate = price2num($vatrate);
// if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary.
if (empty($vatrate)) $vatrate = "0.000";
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate));
$value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU');
$value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU');
if (empty($value_unit))
{
$value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU');
}
if (! GETPOST('fk_c_type_fees', 'int') > 0)
{
@ -1253,7 +1259,7 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$action='';
}
if ((int) $vatrate < 0 || $vatrate == '')
if ((int) $tmpvat < 0 || $tmpvat == '')
{
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');
@ -1742,7 +1748,7 @@ else
print '</tr>';
// User to inform for approval
if ($object->fk_statut < 3) // informed
if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) // informed
{
print '<tr>';
print '<td>'.$langs->trans("VALIDATOR").'</td>'; // approver
@ -1760,7 +1766,7 @@ else
}
print '</td></tr>';
}
elseif($object->fk_statut == 4)
elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED)
{
print '<tr>';
print '<td>'.$langs->trans("CANCEL_USER").'</span></td>';
@ -1854,11 +1860,11 @@ else
print '<td class="titlefieldmiddle">'.$langs->trans("AmountHT").'</td>';
print '<td class="nowrap amountcard">'.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'</td>';
$rowspan = 5;
if ($object->fk_statut < 3) $rowspan++;
elseif($object->fk_statut == 4) $rowspan+=2;
if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) $rowspan++;
elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED) $rowspan+=2;
else $rowspan+=2;
if ($object->fk_statut==99 || !empty($object->detail_refuse)) $rowspan+=2;
if($object->fk_statut==6) $rowspan+=2;
if ($object->fk_statut == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan+=2;
if ($object->fk_statut == ExpenseReport::STATUS_CLOSED) $rowspan+=2;
print "</td>";
print '</tr>';
@ -1994,7 +2000,7 @@ else
$actiontouse='updateline';
if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline') $actiontouse='addline';
print '<form name="expensereport" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<form name="expensereport" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data" method="post" >';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="'.$actiontouse.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
@ -2016,6 +2022,7 @@ else
print '<td style="text-align:center;">'.$langs->trans('Type').'</td>';
print '<td style="text-align:left;">'.$langs->trans('Description').'</td>';
print '<td style="text-align:right;">'.$langs->trans('VAT').'</td>';
print '<td style="text-align:right;">'.$langs->trans('PriceUHT').'</td>';
print '<td style="text-align:right;">'.$langs->trans('PriceUTTC').'</td>';
print '<td style="text-align:right;">'.$langs->trans('Qty').'</td>';
if ($action != 'editline')
@ -2071,7 +2078,22 @@ else
print '</td>';
print '<td style="text-align:left;">'.dol_escape_htmltag($line->comments).'</td>';
print '<td style="text-align:right;">'.vatrate($line->vatrate, true).'</td>';
// Unit price HT
print '<td style="text-align:right;">';
if (! empty($line->value_unit_ht))
{
print price($line->value_unit_ht);
}
else
{
$tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $line->vatrate));
$pricenettoshow = price2num($line->value_unit / (1 + $tmpvat / 100), 'MU');
print $pricenettoshow;
}
print '</td>';
print '<td style="text-align:right;">'.price($line->value_unit).'</td>';
print '<td style="text-align:right;">'.dol_escape_htmltag($line->qty).'</td>';
if ($action != 'editline')
@ -2081,7 +2103,7 @@ else
}
// Ajout des boutons de modification/suppression
if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer)
if (($object->fk_statut < ExpenseReport::STATUS_VALIDATED || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer)
{
print '<td style="text-align:right;" class="nowrap">';
@ -2137,17 +2159,22 @@ else
// VAT
print '<td style="text-align:right;">';
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '');
print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1);
print '</td>';
// Unit price
print '<td style="text-align:right;">';
print '<input type="text" min="0" class="maxwidth100" name="value_unit" value="'.dol_escape_htmltag($line->value_unit).'" />';
print '<input type="text" min="0" class="right maxwidth50" id="value_unit_ht" name="value_unit_ht" value="'.dol_escape_htmltag(price2num($line->value_unit_ht)).'" />';
print '</td>';
// Unit price with tax
print '<td style="text-align:right;">';
print '<input type="text" min="0" class="right maxwidth50" id="value_unit" name="value_unit" value="'.dol_escape_htmltag(price2num($line->value_unit)).'" />';
print '</td>';
// Quantity
print '<td style="text-align:right;">';
print '<input type="number" min="0" class="maxwidth100" name="qty" value="'.dol_escape_htmltag($line->qty).'" />';
print '<input type="number" min="0" class="right maxwidth50" name="qty" value="'.dol_escape_htmltag($line->qty).'" />';
print '</td>';
if ($action != 'editline')
@ -2168,8 +2195,62 @@ else
}
// Add a line
if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline' && $user->rights->expensereport->creer)
if (($object->fk_statut == ExpenseReport::STATUS_DRAFT || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $action != 'editline' && $user->rights->expensereport->creer)
{
$colspan = 10;
if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++;
if (! empty($conf->projet->enabled)) $colspan++;
if ($action != 'editline') $colspan++;
print '<tr class="liste_titre">';
print '<td colspan="'.$colspan.'" class="liste_titre">';
print $langs->trans("UploadANewFileNow");
print '</td></tr>';
print '<tr class="oddeven">';
print '<td colspan="'.$colspan.'">';
$modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer;
$formfile=new FormFile($db);
// We define var to enable the feature to add prefix of uploaded files
$savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
{
//var_dump($modulepart);
if (in_array($modulepart, array('facture_fournisseur','commande_fournisseur','facture','commande','propal','supplier_proposal','ficheinter','contract','expedition','project','project_task','expensereport','tax', 'produit', 'product_batch')))
{
$savingdocmask=dol_sanitizeFileName($object->ref).'-__file__';
}
/*if (in_array($modulepart,array('member')))
{
$savingdocmask=$object->login.'___file__';
}*/
}
// Show upload form (document and links)
$formfile->form_attach_new_file(
$_SERVER["PHP_SELF"].'?id='.$object->id,
'none',
0,
0,
$permission,
$conf->browser->layout == 'phone' ? 40 : 60,
$object,
'',
1,
$savingdocmask,
0,
'formuserfile',
'accept',
'',
1
);
print '</td></tr>';
print '<tr class="liste_titre">';
print '<td></td>';
print '<td align="center">'.$langs->trans('Date').'</td>';
@ -2178,6 +2259,7 @@ else
print '<td align="center">'.$langs->trans('Type').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td colspan="3"></td>';
@ -2185,11 +2267,12 @@ else
print '<tr class="oddeven">';
// Line number
print '<td></td>';
// Select date
print '<td align="center">';
print $form->selectDate($date?$date:-1, 'date');
print $form->selectDate($date?$date:-1, 'date', 0, 0, 0, '', 1, 1);
print '</td>';
// Select project
@ -2200,7 +2283,7 @@ else
print '</td>';
}
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
if (! empty($conf->global->MAIN_USE_EXPENSE_IK))
{
print '<td class="fk_c_exp_tax_cat">';
$params = array('fk_expense' => $object->id);
@ -2215,7 +2298,7 @@ else
// Add comments
print '<td>';
print '<textarea class="flat_ndf centpercent" name="comments">'.dol_escape_htmltag($comments).'</textarea>';
print '<textarea class="flat_ndf centpercent" name="comments" rows="'.ROWS_2.'">'.dol_escape_htmltag($comments).'</textarea>';
print '</td>';
// Select VAT
@ -2225,9 +2308,14 @@ else
print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1);
print '</td>';
// Unit price
// Unit price net
print '<td align="right">';
print '<input type="text" class="right maxwidth50" name="value_unit" value="'.dol_escape_htmltag($value_unit).'">';
print '<input type="text" class="right maxwidth50" id="value_unit_ht" name="value_unit_ht" value="'.dol_escape_htmltag($value_unit_ht).'">';
print '</td>';
// Unit price with tax
print '<td align="right">';
print '<input type="text" class="right maxwidth50" id="value_unit" name="value_unit" value="'.dol_escape_htmltag($value_unit).'">';
print '</td>';
// Quantity
@ -2244,11 +2332,41 @@ else
print '<td align="center"><input type="submit" value="'.$langs->trans("Add").'" name="bouton" class="button"></td>';
print '</tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="oddeven"><td colspan="'.$colspan.'">';
print $langs->trans("AttachTheNewLineToTheDocument");
print '...';
print '</td></tr>';
}
} // Fin si c'est payé/validé
print '</table>';
print '</div>';
print '<script javascript>
/* JQuery for product free or predefined select */
jQuery(document).ready(function() {
jQuery("#value_unit_ht").keyup(function(event) {
console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#value_unit_ht").val() != "") {
jQuery("#value_unit").val("");
}
});
jQuery("#value_unit").keyup(function(event) {
console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#value_unit").val() != "") {
jQuery("#value_unit_ht").val("");
}
});
});
</script>';
print '</form>';
dol_fiche_end();
@ -2286,7 +2404,7 @@ if ($action != 'create' && $action != 'edit')
* ET fk_user_author == user courant
* Afficher : "Enregistrer" / "Modifier" / "Supprimer"
*/
if ($user->rights->expensereport->creer && $object->fk_statut==0)
if ($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_DRAFT)
{
if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance))
{
@ -2306,7 +2424,7 @@ if ($action != 'create' && $action != 'edit')
* ET fk_user_author == user courant
* Afficher : "Enregistrer" / "Modifier" / "Supprimer"
*/
if($user->rights->expensereport->creer && $object->fk_statut==99)
if($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_REFUSED)
{
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid)
{
@ -2320,7 +2438,7 @@ if ($action != 'create' && $action != 'edit')
}
}
if ($user->rights->expensereport->to_paid && $object->fk_statut==5)
if ($user->rights->expensereport->to_paid && $object->fk_statut == ExpenseReport::STATUS_APPROVED)
{
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid)
{
@ -2334,7 +2452,7 @@ if ($action != 'create' && $action != 'edit')
* ET fk_user_validator == user courant
* Afficher : "Valider" / "Refuser" / "Supprimer"
*/
if ($object->fk_statut == 2)
if ($object->fk_statut == ExpenseReport::STATUS_VALIDATED)
{
if (in_array($object->fk_user_author, $user->getAllChildIds(1)))
{
@ -2343,7 +2461,7 @@ if ($action != 'create' && $action != 'edit')
}
}
if ($user->rights->expensereport->approve && $object->fk_statut == 2)
if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_VALIDATED)
{
//if($object->fk_user_validator==$user->id)
//{
@ -2364,13 +2482,13 @@ if ($action != 'create' && $action != 'edit')
// If status is Appoved
// --------------------
if ($user->rights->expensereport->approve && $object->fk_statut == 5)
if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_APPROVED)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=refuse&id='.$object->id.'">'.$langs->trans('Deny').'</a></div>';
}
// If bank module is used
if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == 5)
if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == ExpenseReport::STATUS_APPROVED)
{
// Pay
if ($remaintopay == 0)
@ -2384,7 +2502,7 @@ if ($action != 'create' && $action != 'edit')
}
// If bank module is not used
if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5)
if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == ExpenseReport::STATUS_APPROVED)
{
//if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0)
if ($object->paid == 0)
@ -2393,14 +2511,14 @@ if ($action != 'create' && $action != 'edit')
}
}
if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == 5)
if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == ExpenseReport::STATUS_APPROVED)
{
// Cancel
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=cancel&id='.$object->id.'">'.$langs->trans('Cancel').'</a></div>';
}
// TODO Replace this. It should be SetUnpaid and should go back to status unpaid not canceled.
if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == 6)
if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == ExpenseReport::STATUS_CLOSED)
{
// Cancel
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=cancel&id='.$object->id.'">'.$langs->trans('Cancel').'</a></div>';
@ -2412,12 +2530,12 @@ if ($action != 'create' && $action != 'edit')
}
/* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */
if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut <= 4)
if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut < ExpenseReport::STATUS_APPROVED)
{
// Delete
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
}
elseif($user->rights->expensereport->supprimer && $object->fk_statut != 6)
elseif($user->rights->expensereport->supprimer && $object->fk_statut != ExpenseReport::STATUS_CLOSED)
{
// Delete
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';

View File

@ -489,15 +489,16 @@ class ExpenseReports extends DolibarrApi
);
}*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->barcode_type);

View File

@ -115,6 +115,11 @@ class ExpenseReport extends CommonObject
*/
const STATUS_VALIDATED = 2;
/**
* Classified canceled
*/
const STATUS_CANCELED = 4;
/**
* Classified approved
*/
@ -160,7 +165,7 @@ class ExpenseReport extends CommonObject
*/
public function create($user, $notrigger = 0)
{
global $conf;
global $conf, $langs;
$now = dol_now();
@ -169,7 +174,7 @@ class ExpenseReport extends CommonObject
// Check parameters
if (empty($this->date_debut) || empty($this->date_fin))
{
$this->error='ErrorFieldRequired';
$this->error=$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Date'));
return -1;
}
@ -1442,12 +1447,12 @@ class ExpenseReport extends CommonObject
// phpcs:enable
$error = 0;
$this->date_cancel = $this->db->idate(gmmktime());
if ($this->fk_statut != 4)
if ($this->fk_statut != ExpenseReport::STATUS_CANCELED)
{
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_statut = 4, fk_user_cancel = ".$fuser->id;
$sql.= " SET fk_statut = ".ExpenseReport::STATUS_CANCELED.", fk_user_cancel = ".$fuser->id;
$sql.= ", date_cancel='".$this->db->idate($this->date_cancel)."'";
$sql.= " ,detail_cancel='".$this->db->escape($detail)."'";
$sql.= ' WHERE rowid = '.$this->id;
@ -1676,10 +1681,10 @@ class ExpenseReport extends CommonObject
/**
* addline
*
* @param real $qty Qty
* @param float $qty Qty
* @param double $up Value init
* @param int $fk_c_type_fees Type payment
* @param double $vatrate Vat rate
* @param string $vatrate Vat rate (Can be '10' or '10 (ABC)')
* @param string $date Date
* @param string $comments Description
* @param int $fk_project Project id
@ -1703,8 +1708,8 @@ class ExpenseReport extends CommonObject
if (empty($fk_project)) $fk_project = 0;
$qty = price2num($qty);
if (!preg_match('/\((.*)\)/', $vatrate)) {
$vatrate = price2num($vatrate); // $txtva can have format '5.0(XXX)' or '5'
if (! preg_match('/\s*\((.*)\)/', $vatrate)) {
$vatrate = price2num($vatrate); // $txtva can have format '5.0 (XXX)' or '5'
}
$up = price2num($up);
@ -1715,7 +1720,7 @@ class ExpenseReport extends CommonObject
$localtaxes_type=getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty);
$vat_src_code = '';
if (preg_match('/\((.*)\)/', $vatrate, $reg))
if (preg_match('/\s*\((.*)\)/', $vatrate, $reg))
{
$vat_src_code = $reg[1];
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
@ -1727,6 +1732,7 @@ class ExpenseReport extends CommonObject
$tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type);
$this->line->value_unit = $up;
$this->line->vat_src_code = $vat_src_code;
$this->line->vatrate = price2num($vatrate);
$this->line->total_ttc = $tmp[2];
$this->line->total_ht = $tmp[0];
@ -1928,9 +1934,9 @@ class ExpenseReport extends CommonObject
* @param int $rowid Line to edit
* @param int $type_fees_id Type payment
* @param int $projet_id Project id
* @param double $vatrate Vat rate. Can be '8.5* (8.5NPROM...)'
* @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)'
* @param string $comments Description
* @param real $qty Qty
* @param float $qty Qty
* @param double $value_unit Value init
* @param int $date Date
* @param int $expensereport_id Expense report id

View File

@ -35,12 +35,12 @@ class ExpenseReportStats extends Stats
*/
public $table_element;
var $socid;
var $userid;
public $socid;
public $userid;
var $from;
var $field;
var $where;
public $from;
public $field;
public $where;
/**
* Constructor

View File

@ -73,7 +73,7 @@ $modulepart='trip';
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
include DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
/*

View File

@ -743,9 +743,11 @@ if ($step == 3 && $datatoexport)
// un formulaire en plus pour recuperer les filtres
print '<form action="'.$_SERVER["PHP_SELF"].'?step=4&action=submitFormField&datatoexport='.$datatoexport.'" name="FilterField" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Entities").'</td>';
//print '<td>'.$langs->trans("ExportableFields").'</td>';

View File

@ -417,15 +417,16 @@ class Interventions extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->statuts_short);

View File

@ -333,15 +333,16 @@ class SupplierInvoices extends DolibarrApi
);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param Object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->rowid);

View File

@ -330,15 +330,16 @@ class SupplierOrders extends DolibarrApi
);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param Object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->rowid);

View File

@ -1555,9 +1555,10 @@ class FactureFournisseur extends CommonInvoice
* @param int $origin_id id origin document
* @param double $pu_ht_devise Amount in currency
* @param string $ref_supplier Supplier ref
* @param string $special_code Special code
* @return int >0 if OK, <0 if KO
*/
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '')
public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '')
{
global $langs, $mysoc, $conf;
@ -1727,7 +1728,7 @@ class FactureFournisseur extends CommonInvoice
$this->line->rang=$rang;
$this->line->info_bits=$info_bits;
$this->line->special_code=$this->special_code;
$this->line->special_code=((string) $special_code != '' ? $special_code : $this->special_code);
$this->line->fk_parent_line=$this->fk_parent_line;
$this->line->origin=$this->origin;
$this->line->origin_id=$origin_id;

View File

@ -949,7 +949,8 @@ if (empty($reshook))
$lines[$i]->fk_unit,
$lines[$i]->id,
0,
$lines[$i]->ref_supplier
$lines[$i]->ref_supplier,
$lines[$i]->special_code
);
if ($result < 0)

View File

@ -23,7 +23,7 @@
* \brief Common load of data
*/
require_once realpath(dirname(__FILE__)).'/../main.inc.php';
require_once realpath(__DIR__).'/../main.inc.php';
if (! class_exists('Holiday')) {
require_once DOL_DOCUMENT_ROOT. '/holiday/class/holiday.class.php';
}

View File

@ -58,6 +58,8 @@ CREATE TABLE llx_pos_cash_fence(
-- For 10.0
DROP TABLE llx_cotisation;
ALTER TABLE llx_loan ADD COLUMN insurance_amount double(24,8) DEFAULT 0;
ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber;
@ -230,3 +232,13 @@ ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product);
ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom);
ALTER TABLE llx_facturedet_rec ADD COLUMN buy_price_ht double(24,8) DEFAULT 0;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_product_fournisseur_price integer DEFAULT NULL;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_author integer;
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_expensereport_det MODIFY COLUMN value_unit double(24,8) NOT NULL;
ALTER TABLE llx_expensereport_det ADD COLUMN subprice double(24,8) NOT NULL after qty;

View File

@ -27,7 +27,8 @@ CREATE TABLE llx_expensereport_det
comments text NOT NULL,
product_type integer DEFAULT -1,
qty real NOT NULL,
value_unit real NOT NULL,
subprice double(24,8), -- P.U. HT (example 100)
value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120)
remise_percent real,
vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here.
tva_tx double(6,3), -- Vat rate

View File

@ -55,16 +55,16 @@ create table llx_facturedet
buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it).
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line
special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...)
rang integer DEFAULT 0, -- position of line
fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines
fk_unit integer DEFAULT NULL, -- id of the unit code
import_key varchar(14),
fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line
situation_percent real, -- % progression of lines invoicing
fk_prev_id integer, -- id of the line in the previous situation,
fk_unit integer DEFAULT NULL, -- id of the unit code¡
fk_prev_id integer, -- id of the line in the previous situation
fk_user_author integer, -- user making creation
fk_user_modif integer, -- user making last change

View File

@ -48,11 +48,18 @@ create table llx_facturedet_rec
date_start_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__
date_end_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__
info_bits integer DEFAULT 0, -- TVA NPR ou non
buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it).
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
rang integer DEFAULT 0, -- ordre d'affichage
fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines
fk_unit integer DEFAULT NULL,
import_key varchar(14),
fk_user_author integer, -- user making creation
fk_user_modif integer, -- user making last change
fk_multicurrency integer,
multicurrency_code varchar(255),

View File

@ -88,7 +88,7 @@ if (! $versionfrom && ! $versionto)
// Test if batch mode
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
$path=__DIR__.'/';
if (substr($sapi_type, 0, 3) == 'cli')
{
print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n";

View File

@ -96,7 +96,7 @@ if ((! $versionfrom || preg_match('/version/', $versionfrom)) && (! $versionto |
// Test if batch mode
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
$path=__DIR__.'/';
if (substr($sapi_type, 0, 3) == 'cli')
{
print 'Syntax from command line: '.$script_file." x.y.z a.b.c [MAIN_MODULE_NAME1_TO_ENABLE,MAIN_MODULE_NAME2_TO_ENABLE...]\n";
@ -186,7 +186,7 @@ if (! GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'a
{
// Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE
// Version to install is DOL_VERSION
$dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:$conf->global->MAIN_VERSION_LAST_INSTALL);
$dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:(isset($conf->global->MAIN_VERSION_LAST_INSTALL)?$conf->global->MAIN_VERSION_LAST_INSTALL:''));
// Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec
// dans la 1ere colonne, la description de l'action a faire

View File

@ -14,9 +14,9 @@ OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to prev
AddedByAuthority=Stored into remote authority
NotAddedByAuthorityYet=Not yet stored into remote authority
ShowDetails=Show stored details
logPAYMENT_VARIOUS_CREATE=Payment (not assigned to invoice) created
logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to invoice) modified
logPAYMENT_VARIOUS_DELETE=Payment (not assigned to invoice) logical deletion
logPAYMENT_VARIOUS_CREATE=Payment (not assigned to an invoice) created
logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to an invoice) modified
logPAYMENT_VARIOUS_DELETE=Payment (not assigned to an invoice) logical deletion
logPAYMENT_ADD_TO_BANK=Payment added to bank
logPAYMENT_CUSTOMER_CREATE=Customer payment created
logPAYMENT_CUSTOMER_DELETE=Customer payment logical deletion

View File

@ -87,14 +87,14 @@ TicketEmailNotificationFrom=Notification email from
TicketEmailNotificationFromHelp=Used into ticket message answer by example
TicketEmailNotificationTo=Notifications email to
TicketEmailNotificationToHelp=Send email notifications to this address.
TicketNewEmailBodyLabel=Text message sent after creating a ticket (public interface)
TicketNewEmailBodyLabel=Text message sent after creating a ticket
TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added.
TicketParamPublicInterface=Public interface setup
TicketsEmailMustExist=Require an existing email address to create a ticket
TicketsEmailMustExistHelp=In the public interface, the email address should already be filled in the database to create a new ticket.
PublicInterface=Public interface
TicketUrlPublicInterfaceLabelAdmin=Public interface URL
TicketUrlPublicInterfaceHelpAdmin=It is possible to define an alias to the web server and thus make available the public interface to another IP address.
TicketUrlPublicInterfaceLabelAdmin=Alternative URL for public interface
TicketUrlPublicInterfaceHelpAdmin=It is possible to define an alias to the web server and thus make available the public interface with another URL (the server must act as a proxy on this new URL)
TicketPublicInterfaceTextHomeLabelAdmin=Welcome text of the public interface
TicketPublicInterfaceTextHome=You can create a support ticket or view existing from its identifier tracking ticket.
TicketPublicInterfaceTextHomeHelpAdmin=The text defined here will appear on the home page of the public interface.
@ -124,7 +124,7 @@ TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automaticall
TicketNumberingModules=Tickets numbering module
TicketNotifyTiersAtCreation=Notify third party at creation
TicketGroup=Group
TicketsDisableCustomerEmail=Alsways disable emails when a ticket is created from public interface
#
# Index & list page
#
@ -154,7 +154,6 @@ TicketMarkedAsRead=Ticket has been marked as read
TicketReadOn=Read on
TicketCloseOn=Clotured on
MarkAsRead=Mark ticket as read
TicketMarkedAsReadButLogActionNotSaved=Ticket marked as closed but no action saved
TicketHistory=Ticket history
AssignUser=Assign to user
TicketAssigned=Ticket is now assigned
@ -179,7 +178,6 @@ ConfirmCloseAticket=Confirm ticket closing
ConfirmDeleteTicket=Please confirm ticket deleting
TicketDeletedSuccess=Ticket deleted with success
TicketMarkedAsClosed=Ticket marked as closed
TicketMarkedAsClosedButLogActionNotSaved=Ticket marked as closed but no log saved !
TicketDurationAuto=Calculated duration
TicketDurationAutoInfos=Duration calculated automatically from intervention related
TicketUpdated=Ticket updated
@ -226,14 +224,12 @@ Unread=Unread
#
# Logs
#
TicketLogMesgReadBy=Ticket read by %s
TicketLogMesgReadBy=Ticket %s read by %s
NoLogForThisTicket=No log for this ticket yet
TicketLogAssignedTo=Ticket assigned to %s
TicketAssignedButLogActionNotSaved=Ticket assigned but no log saved !
TicketLogPropertyChanged=Change classification: from %s to %s
TicketLogClosedBy=Ticket closed by %s
TicketLogProgressSetTo=Progress change to %s percent
TicketLogReopen=Ticket re-opened
TicketLogAssignedTo=Ticket %s assigned to %s
TicketLogPropertyChanged=Ticket %s modified: classification from %s to %s
TicketLogClosedBy=Ticket %s closed by %s
TicketLogReopen=Ticket %s re-opened
#
# Public pages
@ -267,7 +263,7 @@ ErrorEmailMustExistToCreateTicket=Error: email address not found in our database
TicketNewEmailSubjectAdmin=New ticket created
TicketNewEmailBodyAdmin=<p>Ticket has just been created with ID #%s, see information:</p>
SeeThisTicketIntomanagementInterface=See ticket in management interface
TicketPublicInterfaceForbidden=Access for this area: forbidden
TicketPublicInterfaceForbidden=The public interface for the tickets was not enabled
# notifications
TicketNotificationEmailSubject=Ticket %s updated

View File

@ -73,23 +73,19 @@ EX_PAR_VP=Parking PV
EX_CAM_VP=PV maintenance and repair
DefaultCategoryCar=Default transportation mode
DefaultRangeNumber=Default range number
UploadANewFileNow=Upload a new document now
Error_EXPENSEREPORT_ADDON_NotDefined=Error, the rule for expense report numbering ref was not defined into setup of module 'Expense Report'
ErrorDoubleDeclaration=You have declared another expense report into a similar date range.
AucuneLigne=There is no expense report declared yet
ModePaiement=Payment mode
VALIDATOR=User responsible for approval
VALIDOR=Approved by
AUTHOR=Recorded by
AUTHORPAIEMENT=Paid by
REFUSEUR=Denied by
CANCEL_USER=Deleted by
MOTIF_REFUS=Reason
MOTIF_CANCEL=Reason
DATE_REFUS=Deny date
DATE_SAVE=Validation date
DATE_CANCEL=Cancelation date
@ -140,7 +136,6 @@ OnExpense=Expense line
ExpenseReportRuleSave=Expense report rule saved
ExpenseReportRuleErrorOnSave=Error: %s
RangeNum=Range %d
ExpenseReportConstraintViolationError=Constraint violation id [%s]: %s is superior to %s %s
byEX_DAY=by day (limitation to %s)
byEX_MON=by month (limitation to %s)
@ -151,7 +146,6 @@ nolimitbyEX_DAY=by day (no limitation)
nolimitbyEX_MON=by month (no limitation)
nolimitbyEX_YEA=by year (no limitation)
nolimitbyEX_EXP=by line (no limitation)
CarCategory=Category of car
ExpenseRangeOffset=Offset amount: %s
RangeIk=Mileage range

View File

@ -109,4 +109,4 @@ UserLogoff=User logout
UserLogged=User logged
DateEmployment=Employment Start Date
DateEmploymentEnd=Employment End Date
CantDisableYourself=You can disable your own user record
CantDisableYourself=You can't disable your own user record

View File

@ -95,3 +95,4 @@ InternalURLOfPage=Internal URL of page
ThisPageIsTranslationOf=This page/container is a translation of
ThisPageHasTranslationPages=This page/container has translation
NoWebSiteCreateOneFirst=No website has been created yet. Create one first.
GoTo=Go to

View File

@ -395,6 +395,7 @@ if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf->
{
dol_syslog("Invalid token, so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING);
//print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers.
if ($conf->global->MAIN_FEATURES_LEVEL>1) setEventMessages('Unset POST by CSRF protection in main.inc.php.', null, 'warnings');
unset($_POST);
unset($_GET['confirm']);
}

View File

@ -132,6 +132,8 @@ dol_fiche_end();
print '</form>';
$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED);
$sql = "SELECT";
$sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
$sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,";
@ -153,7 +155,7 @@ if (! empty($conf->global->AGENT_CONTACT_TYPE))
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))";
else
$sql .= " AND sc.fk_user = u.rowid";
$sql.= " AND f.fk_statut > 0";
$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")";
$sql.= ' AND s.entity IN ('.getEntity('societe').')';
$sql.= " AND d.fk_facture = f.rowid";
if ($agentid > 0) {

View File

@ -183,6 +183,7 @@ dol_fiche_end();
$arrayfields=array();
$massactionbutton='';
$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED);
$sql = "SELECT";
$sql .= " f.ref, f.rowid as invoiceid, d.rowid as invoicedetid, d.buy_price_ht, d.total_ht, d.subprice, d.label, d.description , d.qty";
@ -190,7 +191,7 @@ $sql .= " ,d.fk_product";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as d ON d.fk_facture = f.rowid";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON d.fk_product = p.rowid";
$sql .= " WHERE f.fk_statut > 0";
$sql .= " WHERE f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")";
$sql .= " AND f.entity IN (" . getEntity('invoice') . ") ";
if (! empty($startdate)) $sql .= " AND f.datef >= '" . $db->idate($startdate) . "'";
if (! empty($enddate)) $sql .= " AND f.datef <= '" . $db->idate($enddate) . "'";

View File

@ -200,6 +200,8 @@ dol_fiche_end();
print '</form>';
$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED);
$sql = "SELECT";
$sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
if ($client) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
@ -218,7 +220,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PRE
$sql.= " WHERE f.fk_soc = s.rowid";
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " AND f.fk_statut > 0";
$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")";
$sql.= ' AND s.entity IN ('.getEntity('societe').')';
$sql.= " AND d.fk_facture = f.rowid";
$sql.= " AND (d.product_type = 0 OR d.product_type = 1)";

View File

@ -174,6 +174,8 @@ dol_fiche_end();
print '</form>';
$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED);
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
if ($id > 0) $sql.= " d.fk_product,";
if ($id > 0) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
@ -190,7 +192,7 @@ if (! empty($TSelectedCats)) {
}
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= ' AND f.entity IN ('.getEntity('invoice').')';
$sql.= " AND f.fk_statut > 0";
$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")";
$sql.= " AND d.fk_facture = f.rowid";
if ($id > 0)
$sql.= " AND d.fk_product =".$id;

View File

@ -31,7 +31,6 @@ dol_include_once('/mymodule/class/myobject.class.php');
/**
* API class for mymodule myobject
*
* @smart-auto-routing false
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
@ -205,7 +204,7 @@ class MyModuleApi extends DolibarrApi
$this->myobject->$field = $value;
}
if( ! $this->myobject->create(DolibarrApiAccess::$user)) {
throw new RestException(500);
throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors));
}
return $this->myobject->id;
}
@ -235,13 +234,18 @@ class MyModuleApi extends DolibarrApi
}
foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->myobject->$field = $value;
}
if($this->myobject->update($id, DolibarrApiAccess::$user))
if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0)
{
return $this->get($id);
return false;
}
else
{
throw new RestException(500, $this->myobject->error);
}
}
/**
@ -254,21 +258,21 @@ class MyModuleApi extends DolibarrApi
*/
public function delete($id)
{
if(! DolibarrApiAccess::$user->rights->myobject->delete) {
if (! DolibarrApiAccess::$user->rights->myobject->delete) {
throw new RestException(401);
}
$result = $this->myobject->fetch($id);
if( ! $result ) {
if (! $result) {
throw new RestException(404, 'MyObject not found');
}
if( ! DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id)) {
if (! DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( !$this->myobject->delete(DolibarrApiAccess::$user, 0))
if (! $this->myobject->delete(DolibarrApiAccess::$user))
{
throw new RestException(500);
throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error);
}
return array(
@ -280,14 +284,16 @@ class MyModuleApi extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
/*unset($object->note);
@ -303,10 +309,10 @@ class MyModuleApi extends DolibarrApi
/**
* Validate fields before create or update object
*
* @param array $data Data to validate
* @return array
* @param array $data Array of data to validate
* @return array
*
* @throws RestException
* @throws RestException
*/
private function _validate($data)
{

View File

@ -186,7 +186,7 @@ class mymodulewidget1 extends ModeleBoxes
'tr' => 'class="left"',
'text' => ''
),
0 => array( // TR
1 => array( // TR
'tr' => 'class="left"',
'text' => ''
)

View File

@ -97,9 +97,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
* This is the main function that returns the array of emails
*
* @param int $mailing_id Id of emailing
* @param array $cibles Array with targets
* @return int <0 if error, number of emails added if ok
*/
public function add_to_target($mailing_id)
public function add_to_target($mailing_id, $cibles)
{
// phpcs:enable
$target = array();

View File

@ -25,7 +25,7 @@
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
$path=__DIR__.'/';
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi') {

View File

@ -468,15 +468,16 @@ class Products extends DolibarrApi
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
private function _cleanObjectDatas($object)
protected function _cleanObjectDatas($object)
{
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->regeximgext);

View File

@ -1561,7 +1561,7 @@ class Product extends CommonObject
* @param Societe $thirdparty_buyer Buyer
* @param int $pqp Id of product per price if a selection was done of such a price
* @return array Array of price information
* @see get_buyprice()
* @see get_buyprice(), find_min_price_product_fournisseur()
*/
public function getSellPrice($thirdparty_seller, $thirdparty_buyer, $pqp = 0)
{
@ -1672,8 +1672,8 @@ class Product extends CommonObject
* @param int $product_id Filter on a particular product id
* @param string $fourn_ref Filter on a supplier price ref. 'none' to exclude ref in search.
* @param int $fk_soc If of supplier
* @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
* @see getSellPrice()
* @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
* @see getSellPrice(), find_min_price_product_fournisseur()
*/
public function get_buyprice($prodfournprice, $qty, $product_id = 0, $fourn_ref = '', $fk_soc = 0)
{

View File

@ -818,7 +818,7 @@ if ($resql)
// Duration
if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked']))
{
print '<td class="center">';
print '<td class="center nowraponall">';
if (preg_match('/([^a-z]+)[a-z]$/i', $obj->duration))
{

Some files were not shown because too many files have changed in this diff Show More