Merge branch 'develop' into FIX_inventory

This commit is contained in:
Laurent Destailleur 2017-05-04 13:50:53 +02:00 committed by GitHub
commit c196e79bf4
16 changed files with 663 additions and 171 deletions

View File

@ -757,8 +757,7 @@ if ($id)
{
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
$tmp=$formmail->getAvailableSubstitKey('form');
$tmp=FormMail::getAvailableSubstitKey('formemail');
print implode(', ', $tmp);
print '</td></tr>';
}

View File

@ -89,14 +89,14 @@ if ($rowid)
$caneditfieldmember=$user->rights->adherent->creer;
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('subscription'));
// PDF
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
/*
* Actions
*/

View File

@ -118,17 +118,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$tmp=$formmail->getAvailableSubstitKey('form');
$tmp=FormMail::getAvailableSubstitKey('formemail');
$tmp['__(AnyTransKey)__']='__(AnyTransKey)__';
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
}
else
{
$tmp=$formmail->getAvailableSubstitKey('formwithlines');
$tmp=FormMail::getAvailableSubstitKey('formemailwithlines');
$tmp['__(AnyTransKey)__']='__(AnyTransKey)__';
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
$tmp=$formmail->getAvailableSubstitKey('formforlines');
$tmp=FormMail::getAvailableSubstitKey('formemailforlines');
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
}
@ -484,7 +484,11 @@ if ($action != 'edit')
{
print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else if (! empty($tabhelp[$id][$value]))
{
if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
}
else print $valuetoshow;
print '</td>';
}
@ -539,8 +543,8 @@ if ($action != 'edit')
foreach ($fieldsforcontent as $tmpfieldlist)
{
print '<tr class="impair nodrag nodrop nohover"><td colspan="5">';
if ($tmpfieldlist == 'content') print '<strong>'.$form->textwithpicto($langs->trans("Content"),$tabhelp[$id][$tmpfieldlist]).'</strong><br>';
if ($tmpfieldlist == 'content_lines') print '<strong>'.$form->textwithpicto($langs->trans("ContentForLines"),$tabhelp[$id][$tmpfieldlist]).'</strong><br>';
if ($tmpfieldlist == 'content') print '<strong>'.$form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>';
if ($tmpfieldlist == 'content_lines') print '<strong>'.$form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong><br>';
if ($context != 'hide')
{
@ -624,7 +628,11 @@ if ($resql)
// Affiche nom du champ
if ($showfield)
{
if (! empty($tabhelp[$id][$value])) $valuetoshow = $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
if (! empty($tabhelp[$id][$value]))
{
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
}
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
}
}

View File

@ -161,6 +161,7 @@ if ($_POST["button_removefilter"])
$search_lastname='';
$search_firstname='';
$search_email='';
$search_dest_status='';
}
@ -399,7 +400,7 @@ if ($object->fetch($id) >= 0)
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'";
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
if (!empty($search_dest_status)) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
if ($search_dest_status != '' && $search_dest_status >= -1) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
$sql .= $db->order($sortfield,$sortorder);
// Count total nb of records
@ -411,7 +412,7 @@ if ($object->fetch($id) >= 0)
}
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
$sql .= $db->plimit($limit+1, $offset);
$resql=$db->query($sql);
if ($resql)
{
@ -446,29 +447,12 @@ if ($object->fetch($id) >= 0)
print '<input type="hidden" name="limit" value="'.$limit.'">';
if ($page) $param.= "&amp;page=".$page;
if ($page) $param.= "&amp;page=".$page;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
print_liste_field_titre('');
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
// Ligne des champs de filtres
print '<tr class="liste_titre">';
print '<tr class="liste_titre_filter">';
// EMail
print '<td class="liste_titre">';
print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
@ -489,7 +473,7 @@ if ($object->fetch($id) >= 0)
print '<td class="liste_titre">';
print '&nbsp';
print '</td>';
// Date sending
print '<td class="liste_titre">';
print '&nbsp';
@ -504,6 +488,25 @@ if ($object->fetch($id) >= 0)
print $searchpitco;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
print_liste_field_titre('');
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
$i = 0;

View File

@ -80,8 +80,8 @@ class Mailing extends CommonObject
$this->statuts[2] = 'MailingStatusSentPartialy';
$this->statuts[3] = 'MailingStatusSentCompletely';
$this->statut_dest[0] = 'MailingStatusNotSent';
$this->statut_dest[-1] = 'MailingStatusError';
$this->statut_dest[0] = 'MailingStatusNotSent';
$this->statut_dest[1] = 'MailingStatusSent';
$this->statut_dest[2] = 'MailingStatusRead';
$this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore

View File

@ -260,12 +260,9 @@ class Proposals extends DolibarrApi
$request_data->localtax2_tx,
$request_data->fk_product,
$request_data->remise_percent,
$request_data->info_bits,
$request_data->fk_remise_except,
'HT',
0,
$request_data->date_start,
$request_data->date_end,
$request_data->info_bits,
$request_data->product_type,
$request_data->rang,
$request_data->special_code,
@ -273,10 +270,14 @@ class Proposals extends DolibarrApi
$request_data->fk_fournprice,
$request_data->pa_ht,
$request_data->label,
$request_data->date_start,
$request_data->date_end,
$request_data->array_options,
$request_data->fk_unit,
$this->element,
$request_data->id
// not used anymore ?
// $request_data->fk_remise_except
);
if ($updateRes > 0) {

View File

@ -0,0 +1,500 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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 resource/ctyperesource.class.php
* \ingroup resource
*/
/**
* Class Ctyperesource
*
* Put here description of your class
*
* @see CommonObject
*/
class Ctyperesource
{
/**
* @var string Id to identify managed objects
*/
public $element = 'ctyperesource';
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element = 'c_type_resource';
/**
* @var CtyperesourceLine[] Lines
*/
public $lines = array();
/**
*/
public $code;
public $label;
public $active;
/**
*/
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
}
/**
* Create object into database
*
* @param User $user User that creates
* @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, Id of created object if OK
*/
public function create(User $user, $notrigger = false)
{
dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0;
// Clean parameters
if (isset($this->code)) {
$this->code = trim($this->code);
}
if (isset($this->label)) {
$this->label = trim($this->label);
}
if (isset($this->active)) {
$this->active = trim($this->active);
}
// Check parameters
// Put here code to add control on parameters values
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
$sql.= 'code,';
$sql.= 'label';
$sql.= 'active';
$sql .= ') VALUES (';
$sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").',';
$sql .= ' '.(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").',';
$sql .= ' '.(! isset($this->active)?'NULL':$this->active);
$sql .= ')';
$this->db->begin();
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
}
if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action to call a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
//if ($result < 0) $error++;
//// End call triggers
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return - 1 * $error;
} else {
$this->db->commit();
return $this->id;
}
}
/**
* Load object in memory from the database
*
* @param int $id Id object
* @param string $code code
* @param string $label Label
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id,$code='',$label='')
{
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if ($id) $sql.= " WHERE t.id = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'";
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows($resql);
if ($numrows) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->code = $obj->code;
$this->label = $obj->label;
$this->active = $obj->active;
}
// Retrieve all extrafields for invoice
// fetch optionals attributes and labels
/*
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
*/
// $this->fetch_lines();
$this->db->free($resql);
if ($numrows) {
return 1;
} else {
return 0;
}
} else {
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
return - 1;
}
}
/**
* Load object in memory from the database
*
* @param string $sortorder Sort Order
* @param string $sortfield Sort field
* @param int $limit offset limit
* @param int $offset offset limit
* @param array $filter filter array
* @param string $filtermode filter mode (AND or OR)
*
* @return int <0 if KO, >0 if OK
*/
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
{
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.code,";
$sql .= " t.label,";
$sql .= " t.active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
}
if (!empty($sortfield)) {
$sql .= $this->db->order($sortfield,$sortorder);
}
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit, $offset);
}
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) {
$line = new self($this->db);
$line->id = $obj->rowid;
$line->code = $obj->code;
$line->label = $obj->label;
$line->active = $obj->active;
}
$this->db->free($resql);
return $num;
} else {
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
return - 1;
}
}
/**
* Update object into database
*
* @param User $user User that modifies
* @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, >0 if OK
*/
public function update(User $user, $notrigger = false)
{
$error = 0;
dol_syslog(__METHOD__, LOG_DEBUG);
// Clean parameters
if (isset($this->code)) {
$this->code = trim($this->code);
}
if (isset($this->label)) {
$this->label = trim($this->label);
}
if (isset($this->active)) {
$this->active = trim($this->active);
}
// Check parameters
// Put here code to add a control on parameters values
// Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
$sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").',';
$sql .= ' label = '.(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").',';
$sql .= ' active = '.(isset($this->active)?$this->active:"null");
$sql .= ' WHERE rowid=' . $this->id;
$this->db->begin();
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
}
if (!$error && !$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return - 1 * $error;
} else {
$this->db->commit();
return 1;
}
}
/**
* Delete object in database
*
* @param User $user User that deletes
* @param bool $notrigger false=launch triggers after, true=disable triggers
*
* @return int <0 if KO, >0 if OK
*/
public function delete(User $user, $notrigger = false)
{
dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0;
$this->db->begin();
if (!$error) {
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
//// Call triggers
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
}
// If you need to delete child tables to, you can insert them here
if (!$error) {
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' WHERE rowid=' . $this->id;
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return - 1 * $error;
} else {
$this->db->commit();
return 1;
}
}
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
*
* @return int New id of clone
*/
public function createFromClone($fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new Ctyperesource($this->db);
$this->db->begin();
// Load source object
$object->fetch($fromid);
// Reset object
$object->id = 0;
// Clear fields
// ...
// Create clone
$result = $object->create($user);
// Other options
if ($result < 0) {
$error ++;
$this->errors = $object->errors;
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
}
// End
if (!$error) {
$this->db->commit();
return $object->id;
} else {
$this->db->rollback();
return - 1;
}
}
/**
* Initialise object with example values
* Id must be 0 if object instance is a specimen
*
* @return void
*/
public function initAsSpecimen()
{
$this->id = 0;
$this->code = '';
$this->label = '';
$this->active = '';
}
}
/**
* Class CtyperesourceLine
*/
class CtyperesourceLine
{
/**
* @var int ID
*/
public $id;
/**
* @var mixed Sample line property 1
*/
public $code;
public $label;
public $active;
/**
* @var mixed Sample line property 2
*/
}

View File

@ -492,10 +492,11 @@ class Form
*/
function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2, $tooltiptrigger='')
{
global $conf;
global $conf, $langs;
$alt = '';
if ($tooltiptrigger) $alt=$langs->trans("ClickToShowHelp");
//For backwards compatibility
if ($type == '0') $type = 'info';
elseif ($type == '1') $type = 'help';

View File

@ -1059,18 +1059,18 @@ class FormMail extends Form
}
/**
* Set substit array from object
* Get list of substition keys available.
*
* @param string $mode 'form', 'formwithlines', 'formforlines' or 'emailing'
* @param string $mode 'formemail', 'formemailwithlines', 'formemailforlines', 'emailing', ...
* @return void
*/
function getAvailableSubstitKey($mode='form')
static function getAvailableSubstitKey($mode='formemail')
{
global $conf;
global $conf, $langs;
$vars=array();
if ($mode == 'form' || $mode == 'formwithlines' || $mode == 'formforlines')
if ($mode == 'formemail' || $mode == 'formemailwithlines' || $mode == 'formemailforlines')
{
$vars=array(
'__REF__',
@ -1133,6 +1133,15 @@ class FormMail extends Form
$vars['__SECUREKEYPAYPAL_MEMBER__']='';
}
}
$tmparray=array();
$parameters=array('mode'=>$mode);
complete_substitutions_array($tmparray, $langs, null, $parameters);
foreach($tmparray as $key => $val)
{
$vars[$key]=$key;
}
return $vars;
}

View File

@ -32,9 +32,9 @@ class FormMailing extends Form
/**
* Output a select with destinaries status
*
* @param string $selectedid the selected id
* @param string $htmlname name of controm
* @param integer $show_empty show empty option
* @param string $selectedid The selected id
* @param string $htmlname Name of controm
* @param integer $show_empty Show empty option
* @return string HTML select
*/
public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) {
@ -46,13 +46,13 @@ class FormMailing extends Form
$mailing = new Mailing($this->db);
$options = array();
if ($show_empty) {
$options[''] = '';
$options[-2] = ''; // Note -1 is used for error
}
$options = array_merge($options, $mailing->statut_dest);
$options = $options + $mailing->statut_dest;
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
}
}

View File

@ -4953,7 +4953,8 @@ function make_substitutions($text, $substitutionarray, $outputlangs=null)
}
/**
* Complete the $substitutionarray with more entries
* Complete the $substitutionarray with more entries.
* Can also add substitution keys coming from external module that had set the "substitutions=1" into module_part array. In this case, method completesubstitutionarray provided by module is called.
*
* @param array $substitutionarray Array substitution old value => new value value
* @param Translate $outputlangs Output language

View File

@ -1808,8 +1808,17 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
}
if (empty($reshook))
{
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) $result.=$object->lines[$i]->situation_percent . '%';
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1)
{
if($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
{
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
$result = ( $object->lines[$i]->situation_percent - $prev_progress) . '%';
}
else
$result = $object->lines[$i]->situation_percent . '%';
}
}
return $result;
}
@ -1844,7 +1853,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
if(!empty($hookmanager->resPrint)) $result.=$hookmanager->resPrint;
}
if (empty($reshook))
{
{
if ($object->lines[$i]->special_code == 3)
{
return $outputlangs->transnoentities("Option");
@ -1852,9 +1861,16 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
if (empty($hidedetails) || $hidedetails > 1)
{
$total_ht = ($conf->multicurrency->enabled && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht);
if ($object->lines[$i]->situation_percent > 0 )
{
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
$progress = ( $object->lines[$i]->situation_percent - $prev_progress) /100;
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
}
else
$result.=price($sign * $total_ht, 0, $outputlangs);
}
}
}
return $result;
}

View File

@ -201,22 +201,6 @@ class modResource extends DolibarrModules
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Add here list of permission defined by
// an id, a label, a boolean and two constant strings.
// Example:
//// Permission id (must not be already used)
//$this->rights[$r][0] = 2000;
//// Permission label
//$this->rights[$r][1] = 'Permision label';
//// Permission by default for new user (0/1)
//$this->rights[$r][3] = 0;
//// In php code, permission will be checked by test
//// if ($user->rights->permkey->level1->level2)
//$this->rights[$r][4] = 'level1';
//// In php code, permission will be checked by test
//// if ($user->rights->permkey->level1->level2)
//$this->rights[$r][5] = 'level2';
//$r++;
// Main menu entries
$this->menu = array(); // List of menus to add
$r = 0;
@ -267,98 +251,63 @@ class modResource extends DolibarrModules
'user'=> 0
);
// Exports
$r = 1;
// Example:
//$this->export_code[$r]=$this->rights_class.'_'.$r;
//// Translation key (used only if key ExportDataset_xxx_z not found)
//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
//// Condition to show export in list (ie: '$user->id==3').
//// Set to 1 to always show when module is enabled.
//$this->export_enabled[$r]='1';
//$this->export_permission[$r]=array(array("facture","facture","export"));
//$this->export_fields_array[$r]=array(
// 's.rowid'=>"IdCompany",
// 's.nom'=>'CompanyName',
// 's.address'=>'Address',
// 's.cp'=>'Zip',
// 's.ville'=>'Town',
// 's.fk_pays'=>'Country',
// 's.tel'=>'Phone',
// 's.siren'=>'ProfId1',
// 's.siret'=>'ProfId2',
// 's.ape'=>'ProfId3',
// 's.idprof4'=>'ProfId4',
// 's.code_compta'=>'CustomerAccountancyCode',
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode',
// 'f.rowid'=>"InvoiceId",
// 'f.facnumber'=>"InvoiceRef",
// 'f.datec'=>"InvoiceDateCreation",
// 'f.datef'=>"DateInvoice",
// 'f.total'=>"TotalHT",
// 'f.total_ttc'=>"TotalTTC",
// 'f.tva'=>"TotalVAT",
// 'f.paye'=>"InvoicePaid",
// 'f.fk_statut'=>'InvoiceStatus',
// 'f.note'=>"InvoiceNote",
// 'fd.rowid'=>'LineId',
// 'fd.description'=>"LineDescription",
// 'fd.price'=>"LineUnitPrice",
// 'fd.tva_tx'=>"LineVATRate",
// 'fd.qty'=>"LineQty",
// 'fd.total_ht'=>"LineTotalHT",
// 'fd.total_tva'=>"LineTotalTVA",
// 'fd.total_ttc'=>"LineTotalTTC",
// 'fd.date_start'=>"DateStart",
// 'fd.date_end'=>"DateEnd",
// 'fd.fk_product'=>'ProductId',
// 'p.ref'=>'ProductRef'
//);
//$this->export_entities_array[$r]=array('s.rowid'=>"company",
// 's.nom'=>'company',
// 's.address'=>'company',
// 's.cp'=>'company',
// 's.ville'=>'company',
// 's.fk_pays'=>'company',
// 's.tel'=>'company',
// 's.siren'=>'company',
// 's.siret'=>'company',
// 's.ape'=>'company',
// 's.idprof4'=>'company',
// 's.code_compta'=>'company',
// 's.code_compta_fournisseur'=>'company',
// 'f.rowid'=>"invoice",
// 'f.facnumber'=>"invoice",
// 'f.datec'=>"invoice",
// 'f.datef'=>"invoice",
// 'f.total'=>"invoice",
// 'f.total_ttc'=>"invoice",
// 'f.tva'=>"invoice",
// 'f.paye'=>"invoice",
// 'f.fk_statut'=>'invoice',
// 'f.note'=>"invoice",
// 'fd.rowid'=>'invoice_line',
// 'fd.description'=>"invoice_line",
// 'fd.price'=>"invoice_line",
// 'fd.total_ht'=>"invoice_line",
// 'fd.total_tva'=>"invoice_line",
// 'fd.total_ttc'=>"invoice_line",
// 'fd.tva_tx'=>"invoice_line",
// 'fd.qty'=>"invoice_line",
// 'fd.date_start'=>"invoice_line",
// 'fd.date_end'=>"invoice_line",
// 'fd.fk_product'=>'product',
// 'p.ref'=>'product'
//);
//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
// . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
// . 'product as p on (fd.fk_product = p.rowid)';
//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
// . 'AND f.rowid = fd.fk_facture';
//$r++;
// Exports
//--------
$r=0;
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]="ResourceSingular"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r]=array(array("resource","read"));
$this->export_fields_array[$r]=array('r.rowid'=>'IdResource','r.ref'=>'ResourceFormLabel_ref','c.code'=>'ResourceTypeCode','c.label'=>'ResourceType','r.description'=>'ResourceFormLabel_description','r.note_private'=>"NotePrivate",'r.note_public'=>"NotePublic",'r.asset_number'=>'AssetNumber','r.datec'=>"DateCreation",'r.tms'=>"DateLastModification");
$this->export_TypeFields_array[$r]=array('r.rowid'=>'List:resource:ref','r.ref'=>'Text','r.asset_number'=>'Text','r.description'=>'Text','c.code'=>'Text','c.label'=>'List:c_type_resource:label','r.datec'=>'Date','r.tms'=>'Date','r.note_private'=>'Text','r.note_public'=>'Text');
$this->export_entities_array[$r]=array('r.rowid'=>'resource','r.ref'=>'resource','c.code'=>'resource','c.label'=>'resource','r.description'=>'resource','r.note_private'=>"resource",'r.resource'=>"resource",'r.asset_number'=>'resource','r.datec'=>"resource",'r.tms'=>"resource");
$keyforselect='resource'; $keyforelement='resource'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_dependencies_array[$r]=array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'resource as r ';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid';
$this->export_sql_end[$r] .=' AND r.entity IN ('.getEntity('resource',1).')';
// Imports
//--------
$r=0;
// Import list of third parties and attributes
$r++;
$this->import_code[$r]=$this->rights_class.'_'.$r;
$this->import_label[$r]='ImportDataset_resource_1';
$this->import_icon[$r]='resource';
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('r'=>MAIN_DB_PREFIX.'resource','extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order)
$this->import_fields_array[$r]=array('r.ref'=>"ResourceFormLabel_ref*",'r.fk_code_type_resource'=>'ResourceTypeCode','r.description'=>'ResourceFormLabel_description','r.note_private'=>"NotePrivate",'r.note_public'=>"NotePublic",'r.asset_number'=>'AssetNumber','r.datec'=>'DateCreation');
// Add extra fields
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity = ".$conf->entity;
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':'');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r]=array('r.fk_user_author'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'resource'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent)
$this->import_convertvalue_array[$r]=array(
'r.fk_code_type_resource'=>array('rule'=>'fetchidfromcodeorlabel','classfile'=>'/core/class/ctyperesource.class.php','class'=>'Ctyperesource','method'=>'fetch','dict'=>'DictionaryResourceType'),
);
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
$this->import_regex_array[$r]=array('s.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$');
$this->import_examplevalues_array[$r]=array('r.ref'=>"REF1",'r.fk_code_type_resource'=>"Code from dictionnary resource type",'r.datec'=>"2017-01-01 or 2017-01-01 12:30:00");
$this->import_updatekeys_array[$r]=array('r.rf'=>'ResourceFormLabel_ref');
}
/**

View File

@ -766,6 +766,9 @@ Download=Download
ActualizeCurrency=Update currency rate
Fiscalyear=Fiscal year
ModuleBuilder=Module Builder
SetMultiCurrencyCode=Set currency
BulkActions=Bulk actions
ClickToShowHelp=Click to show tooltip help
# Week day
Monday=Monday
Tuesday=Tuesday
@ -822,6 +825,4 @@ SearchIntoInterventions=Interventions
SearchIntoContracts=Contracts
SearchIntoCustomerShipments=Customer shipments
SearchIntoExpenseReports=Expense reports
SearchIntoLeaves=Leaves
SetMultiCurrencyCode=Set currency
BulkActions=Bulk actions
SearchIntoLeaves=Leaves

View File

@ -29,3 +29,8 @@ RessourceSuccessfullyDeleted=Resource successfully deleted
DictionaryResourceType=Type of resources
SelectResource=Select resource
IdResource=Id resource
AssetNumber=Serial number
ResourceTypeCode=Resource type code
ImportDataset_resource_1=Resources

View File

@ -127,7 +127,6 @@ if (empty($reshook))
header('Location: '.dol_buildpath('/product/inventory/card.php?action=create', 1));
exit;
}
}
switch($action) {