Merge remote-tracking branch 'refs/remotes/Dolibarr/5.0' into 5.0_fix_fourn_commande_class

This commit is contained in:
fappels 2017-03-16 10:06:20 +01:00
commit c1b21db407
43 changed files with 448 additions and 319 deletions

View File

@ -81,14 +81,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Standing orders management (European SEPA) - Standing orders management (European SEPA)
- Bank accounts management - Bank accounts management
- Shared calendar/agenda (with ical and vcal export for third party tools integration) - Shared calendar/agenda (with ical and vcal export for third party tools integration)
- Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...) - Opportunities and/or project management
- Projects management - Projects management
- Contracts management - Contracts management
- Stock management - Stock management
- Shipping management - Shipping management
- Interventions management - Interventions management
- Employee's leave requests management - Employee's leave requests management
- Expense report management - Expense reports
- Timesheets
- Electronic Document Management (EDM) - Electronic Document Management (EDM)
- Foundations members management - Foundations members management
- Mass emailing - Mass emailing

View File

@ -628,12 +628,6 @@ if ($id)
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
if ($id == 2) // Special cas for state page
{
if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; }
if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
}
if ($valuetoshow != '') if ($valuetoshow != '')
{ {
print '<td align="'.$align.'">'; print '<td align="'.$align.'">';
@ -675,36 +669,15 @@ if ($id)
if (empty($reshook)) if (empty($reshook))
{ {
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit') fieldList($fieldlist,$obj,$tabname[$id],'add');
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
} }
print '<td colspan="4" align="right">'; print '<td colspan="4" align="right">';
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit') print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
{
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
{
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');
print implode(', ', $tmp);
print '</td></tr>';
}
$colspan=count($fieldlist)+3; $colspan=count($fieldlist)+3;
if ($id == 4) $colspan++;
if (! empty($alabelisused)) // If there is one label among fields, we show legend of * if (! empty($alabelisused)) // If there is one label among fields, we show legend of *
{ {
@ -1175,7 +1148,7 @@ $db->close();
function fieldList($fieldlist, $obj='', $tabname='', $context='') function fieldList($fieldlist, $obj='', $tabname='', $context='')
{ {
global $conf,$langs,$db; global $conf,$langs,$db;
global $form; global $form, $mysoc;
global $region_id; global $region_id;
global $elementList,$sourceList,$localtax_typeList; global $elementList,$sourceList,$localtax_typeList;
global $bc; global $bc;
@ -1197,7 +1170,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
} // For state page, we do not show the country input (we link to region, not country) } // For state page, we do not show the country input (we link to region, not country)
print '<td>'; print '<td>';
$fieldname='country'; $fieldname='country';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>'; print '</td>';
} }
elseif ($fieldlist[$field] == 'country_id') elseif ($fieldlist[$field] == 'country_id')

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -87,7 +87,8 @@ if ($action == 'update') {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
foreach ($list as $constname) { foreach ($list as $constname)
{
$constvalue = GETPOST($constname, 'alpha'); $constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
@ -278,13 +279,17 @@ foreach ($list as $key)
$var = ! $var; $var = ! $var;
print '<tr ' . $bc[$var] . ' class="value">'; print '<tr ' . $bc[$var] . ' class="value">';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue;
// Param // Param
$label = $langs->trans($key); $label = $langs->trans($key);
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
// Value // Value
print '<td align="right">'; print '<td align="right">';
print '<input type="text" size="20" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">'; print '<input type="text" class="maxwidth100" id="' . $key . '" name="' . $key . '" value="' . $conf->global->$key . '">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -301,7 +306,7 @@ print '<div class="center"><input type="submit" class="button" value="' . $langs
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")); print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy"));
print '<br>'; print '<br>';
print '</form>'; print '</form>';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
@ -1926,27 +1926,28 @@ class Adherent extends CommonObject
$this->fullname=$this->getFullName($langs); $this->fullname=$this->getFullName($langs);
// Member // Member
if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname; if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname; if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname;
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email; if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
// Subscriptions // Subscriptions
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -390,6 +390,7 @@ if ($mode != 'marketplace')
// Check filters // Check filters
$modulename=$objMod->getName(); $modulename=$objMod->getName();
$moduletechnicalname=$objMod->name;
$moduledesc=$objMod->getDesc(); $moduledesc=$objMod->getDesc();
$moduledesclong=$objMod->getDescLong(); $moduledesclong=$objMod->getDescLong();
$moduleauthor=$objMod->getPublisher(); $moduleauthor=$objMod->getPublisher();
@ -399,6 +400,7 @@ if ($mode != 'marketplace')
{ {
$qualified=0; $qualified=0;
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname)
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)

View File

@ -125,6 +125,8 @@ if ($socid > 0)
print load_fiche_titre($langs->trans("NewRelativeDiscount"),'',''); print load_fiche_titre($langs->trans("NewRelativeDiscount"),'','');
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// New value // New value

View File

@ -83,6 +83,8 @@ class box_services_expired extends ModeleBoxes
$i = 0; $i = 0;
$thirdpartytmp = new Societe($this->db);
while ($i < $num) while ($i < $num)
{ {
$late=''; $late='';
@ -100,13 +102,13 @@ class box_services_expired extends ModeleBoxes
'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid);
$this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', $thirdpartytmp->id = $objp->socid;
'logo' => 'company', $thirdpartytmp->name = $objp->name;
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
$this->info_box_contents[$i][3] = array('td' => 'class="tdoverflow maxwidth100onsmartphone" align="left"', $this->info_box_contents[$i][2] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone" align="left"',
'text' => $objp->name, 'text' => $thirdpartytmp->getNomUrl(1, 'customer'),
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); 'asis' => 1
);
$this->info_box_contents[$i][4] = array('td' => 'align="center"', $this->info_box_contents[$i][4] = array('td' => 'align="center"',
'text' => dol_print_date($dateline,'day'), 'text' => dol_print_date($dateline,'day'),

View File

@ -243,7 +243,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
$out.= '>'; $out.= '>';
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
$out.= '<table summary="" class="nobordernopadding" width="100%"><tr><td class="tdoverflow maxwidth300onsmartphone">'; $out.= '<table summary="" class="nobordernopadding" width="100%"><tr><td class="tdoverflowmax100 maxwidth100onsmartphone">';
} }
if (! empty($head['text'])) if (! empty($head['text']))
{ {

View File

@ -304,11 +304,13 @@ abstract class CommonDocGenerator
$now=dol_now('gmt'); // gmt $now=dol_now('gmt'); // gmt
$array_other = array( $array_other = array(
'current_date'=>dol_print_date($now,'day','tzuser'), // Date in default language
'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), 'current_date'=>dol_print_date($now,'day','tzuser'),
'current_datehour'=>dol_print_date($now,'dayhour','tzuser'),
'current_server_date'=>dol_print_date($now,'day','tzserver'), 'current_server_date'=>dol_print_date($now,'day','tzserver'),
'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'),
'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs), // Date in requested output language
'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs),
'current_datehour_locale'=>dol_print_date($now,'dayhour','tzuser',$outputlangs), 'current_datehour_locale'=>dol_print_date($now,'dayhour','tzuser',$outputlangs),
'current_server_date_locale'=>dol_print_date($now,'day','tzserver',$outputlangs), 'current_server_date_locale'=>dol_print_date($now,'day','tzserver',$outputlangs),
'current_server_datehour_locale'=>dol_print_date($now,'dayhour','tzserver',$outputlangs), 'current_server_datehour_locale'=>dol_print_date($now,'dayhour','tzserver',$outputlangs),
@ -350,6 +352,7 @@ abstract class CommonDocGenerator
$array_key.'_ref_customer'=>$object->ref_client, $array_key.'_ref_customer'=>$object->ref_client,
$array_key.'_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''), $array_key.'_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''),
$array_key.'_source_invoice_ref'=>$invoice_source->ref, $array_key.'_source_invoice_ref'=>$invoice_source->ref,
// Dates
$array_key.'_hour'=>dol_print_date($object->date,'hour'), $array_key.'_hour'=>dol_print_date($object->date,'hour'),
$array_key.'_date'=>dol_print_date($object->date,'day'), $array_key.'_date'=>dol_print_date($object->date,'day'),
$array_key.'_date_rfc'=>dol_print_date($object->date,'dayrfc'), $array_key.'_date_rfc'=>dol_print_date($object->date,'dayrfc'),
@ -360,6 +363,7 @@ abstract class CommonDocGenerator
$array_key.'_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''), $array_key.'_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''),
$array_key.'_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''), $array_key.'_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''),
$array_key.'_date_close'=>(! empty($object->date_cloture)?dol_print_date($object->date_cloture,'dayhour'):''), $array_key.'_date_close'=>(! empty($object->date_cloture)?dol_print_date($object->date_cloture,'dayhour'):''),
$array_key.'_payment_mode_code'=>$object->mode_reglement_code, $array_key.'_payment_mode_code'=>$object->mode_reglement_code,
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), $array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
$array_key.'_payment_term_code'=>$object->cond_reglement_code, $array_key.'_payment_term_code'=>$object->cond_reglement_code,
@ -444,10 +448,13 @@ abstract class CommonDocGenerator
'line_price_ht_locale'=>price($line->total_ht, 0, $outputlangs), 'line_price_ht_locale'=>price($line->total_ht, 0, $outputlangs),
'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs), 'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs),
'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs), 'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs),
'line_date_start'=>$line->date_start, // Dates
'line_date_start_rfc'=>dol_print_date($line->date_start,'dayrfc'), 'line_date_start'=>dol_print_date($line->date_start, 'day', 'tzuser'),
'line_date_end'=>$line->date_end, 'line_date_start_locale'=>dol_print_date($line->date_start, 'day', 'tzuser', $outputlangs),
'line_date_end_rfc'=>dol_print_date($line->date_end,'dayrfc') 'line_date_start_rfc'=>dol_print_date($line->date_start, 'dayrfc', 'tzuser'),
'line_date_end'=>dol_print_date($line->date_end, 'day', 'tzuser'),
'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzuser', $outputlangs),
'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc', 'tzuser'),
); );
// Retrieve extrafields // Retrieve extrafields

View File

@ -1223,11 +1223,11 @@ abstract class CommonObject
* @param int $id To force other object id (should not be used) * @param int $id To force other object id (should not be used)
* @param string $format Data format ('text', 'date'). 'text' is used if not defined * @param string $format Data format ('text', 'date'). 'text' is used if not defined
* @param string $id_field To force rowid field name. 'rowid' is used if not defined * @param string $id_field To force rowid field name. 'rowid' is used if not defined
* @param User|string $user Update last update fields also if user object provided * @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none'
* @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY') * @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY')
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='', $trigkey='') function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='')
{ {
global $user,$langs,$conf; global $user,$langs,$conf;
@ -1247,7 +1247,8 @@ abstract class CommonObject
if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'";
else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value);
else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null");
if (is_object($user)) $sql.=", fk_user_modif = ".$user->id; if (! empty($fuser) && is_object($fuser)) $sql.=", fk_user_modif = ".$fuser->id;
elseif (empty($fuser) || $fuser != 'none') $sql.=", fk_user_modif = ".$user->id;
$sql.= " WHERE ".$id_field." = ".$id; $sql.= " WHERE ".$id_field." = ".$id;
dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG);
@ -1256,7 +1257,7 @@ abstract class CommonObject
{ {
if ($trigkey) if ($trigkey)
{ {
$result=$this->call_trigger($trigkey, $user); // This may set this->errors $result=$this->call_trigger($trigkey, (! empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors
if ($result < 0) $error++; if ($result < 0) $error++;
} }

View File

@ -5745,7 +5745,13 @@ class Form
{ {
$ret.=dol_htmlentities($object->getFullName($langs)); $ret.=dol_htmlentities($object->getFullName($langs));
} }
else if (in_array($object->element, array('action', 'agenda')))
{
$ret.=$object->ref.'<br>'.$object->label;
}
else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref);
if ($morehtmlref) if ($morehtmlref)
{ {
$ret.=' '.$morehtmlref; $ret.=' '.$morehtmlref;

View File

@ -153,7 +153,14 @@ class FormProjets
$sql.= " WHERE p.entity IN (".getEntity('project', 1).")"; $sql.= " WHERE p.entity IN (".getEntity('project', 1).")";
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if ($socid > 0)
{
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
else if ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
{
$sql.= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)";
}
}
if (!empty($filterkey)) { if (!empty($filterkey)) {
$sql .= ' AND ('; $sql .= ' AND (';
$sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"'; $sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"';
@ -586,7 +593,7 @@ class FormProjets
if ($num > 0) if ($num > 0)
{ {
$sellist = '<select class="flat oppstatus'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">'; $sellist = '<select class="flat oppstatus'.($morecss?' '.$morecss:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) $sellist.= '<option value="-1"></option>'; if ($showempty) $sellist.= '<option value="-1">&nbsp;</option>'; // Without &nbsp, strange move of screen when switching value
if ($showallnone) $sellist.= '<option value="all"'.($preselected == 'all'?' selected="selected"':'').'>--'.$langs->trans("OnlyOpportunitiesShort").'--</option>'; if ($showallnone) $sellist.= '<option value="all"'.($preselected == 'all'?' selected="selected"':'').'>--'.$langs->trans("OnlyOpportunitiesShort").'--</option>';
if ($showallnone) $sellist.= '<option value="openedopp"'.($preselected == 'openedopp'?' selected="selected"':'').'>--'.$langs->trans("OpenedOpportunitiesShort").'--</option>'; if ($showallnone) $sellist.= '<option value="openedopp"'.($preselected == 'openedopp'?' selected="selected"':'').'>--'.$langs->trans("OpenedOpportunitiesShort").'--</option>';
if ($showallnone) $sellist.= '<option value="none"'.($preselected == 'none'?' selected="selected"':'').'>--'.$langs->trans("NotAnOpportunityShort").'--</option>'; if ($showallnone) $sellist.= '<option value="none"'.($preselected == 'none'?' selected="selected"':'').'>--'.$langs->trans("NotAnOpportunityShort").'--</option>';

View File

@ -195,7 +195,7 @@ interface Database
* Execute a SQL request and return the resultset * Execute a SQL request and return the resultset
* *
* @param string $query SQL query string * @param string $query SQL query string
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions). * @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints. * Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...) * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return resource Resultset of answer * @return resource Resultset of answer

View File

@ -116,8 +116,9 @@ function length_accountg($account)
if ($account < 0 || empty($account)) return ''; if ($account < 0 || empty($account)) return '';
$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
if (! empty($g)) { if (! empty($g)) {
// Clean parameters // Clean parameters
$i = strlen($account); $i = strlen($account);
@ -150,8 +151,9 @@ function length_accounta($accounta)
if ($accounta < 0 || empty($accounta)) return ''; if ($accounta < 0 || empty($accounta)) return '';
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
if (! empty($a)) { if (! empty($a)) {
// Clean parameters // Clean parameters
$i = strlen($accounta); $i = strlen($accounta);

View File

@ -531,6 +531,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
print "\n"; print "\n";
print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"),$buttoncreate,''); print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"),$buttoncreate,'');
print '<div class="div-table-responsive">';
print "\n".'<table class="noborder" width=100%>'; print "\n".'<table class="noborder" width=100%>';
$sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status"; $sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status";
@ -597,6 +598,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin
dol_print_error($db); dol_print_error($db);
} }
print "</table>"; print "</table>";
print '</div>';
print "<br>\n"; print "<br>\n";
} }

View File

@ -634,7 +634,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
} }
// Security: // Security:
// On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. // We refuse cache files/dirs, upload using .. and pipes into filenames.
if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file))
{ {
dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING);
@ -707,6 +707,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
* @param int $nohook Disable all hooks * @param int $nohook Disable all hooks
* @param object $object Current object in use * @param object $object Current object in use
* @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error * @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error
* @see dol_delete_dir
*/ */
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null)
{ {
@ -718,6 +719,14 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook); dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook);
// Security:
// We refuse transversal using .. and pipes into filenames.
if (preg_match('/\.\./',$file) || preg_match('/[<>|]/',$file))
{
dol_syslog("Refused to delete file ".$file, LOG_WARNING);
return False;
}
if (empty($nohook)) if (empty($nohook))
{ {
$hookmanager->initHooks(array('fileslib')); $hookmanager->initHooks(array('fileslib'));
@ -782,9 +791,18 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
* @param string $dir Directory to delete * @param string $dir Directory to delete
* @param int $nophperrors Disable all PHP output errors * @param int $nophperrors Disable all PHP output errors
* @return boolean True if success, false if error * @return boolean True if success, false if error
* @see dol_delete_file
*/ */
function dol_delete_dir($dir,$nophperrors=0) function dol_delete_dir($dir,$nophperrors=0)
{ {
// Security:
// We refuse transversal using .. and pipes into filenames.
if (preg_match('/\.\./',$dir) || preg_match('/[<>|]/',$dir))
{
dol_syslog("Refused to delete dir ".$dir, LOG_WARNING);
return False;
}
$dir_osencoded=dol_osencode($dir); $dir_osencoded=dol_osencode($dir);
return ($nophperrors?@rmdir($dir_osencoded):rmdir($dir_osencoded)); return ($nophperrors?@rmdir($dir_osencoded):rmdir($dir_osencoded));
} }
@ -1355,6 +1373,7 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta
function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='') function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='')
{ {
global $user, $conf, $db; global $user, $conf, $db;
global $dolibarr_main_data_root;
if (! is_object($fuser)) $fuser=$user; if (! is_object($fuser)) $fuser=$user;
@ -1369,141 +1388,140 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
// find the subdirectory name as the reference // find the subdirectory name as the reference
if (empty($refname)) $refname=basename(dirname($original_file)."/"); if (empty($refname)) $refname=basename(dirname($original_file)."/");
$relative_original_file = $original_file;
// Wrapping for some images // Wrapping for some images
if ($modulepart == 'companylogo') if ($modulepart == 'companylogo' && !empty($conf->mycompany->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; $original_file=$conf->mycompany->dir_output.'/logos/'.$original_file;
} }
// Wrapping for users photos // Wrapping for users photos
elseif ($modulepart == 'userphoto') elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->user->dir_output.'/'.$original_file; $original_file=$conf->user->dir_output.'/'.$original_file;
} }
// Wrapping for members photos // Wrapping for members photos
elseif ($modulepart == 'memberphoto') elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->adherent->dir_output.'/'.$original_file; $original_file=$conf->adherent->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu factures // Wrapping pour les apercu factures
elseif ($modulepart == 'apercufacture') elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output))
{ {
if ($fuser->rights->facture->lire) $accessallowed=1; if ($fuser->rights->facture->lire) $accessallowed=1;
$original_file=$conf->facture->dir_output.'/'.$original_file; $original_file=$conf->facture->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu propal // Wrapping pour les apercu propal
elseif ($modulepart == 'apercupropal') elseif ($modulepart == 'apercupropal' && !empty($conf->propal->dir_output))
{ {
if ($fuser->rights->propale->lire) $accessallowed=1; if ($fuser->rights->propale->lire) $accessallowed=1;
$original_file=$conf->propal->dir_output.'/'.$original_file; $original_file=$conf->propal->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu commande // Wrapping pour les apercu commande
elseif ($modulepart == 'apercucommande') elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output))
{ {
if ($fuser->rights->commande->lire) $accessallowed=1; if ($fuser->rights->commande->lire) $accessallowed=1;
$original_file=$conf->commande->dir_output.'/'.$original_file; $original_file=$conf->commande->dir_output.'/'.$original_file;
} }
// Wrapping pour les apercu intervention // Wrapping pour les apercu intervention
elseif ($modulepart == 'apercufichinter') elseif ($modulepart == 'apercufichinter' && !empty($conf->ficheinter->dir_output))
{ {
if ($fuser->rights->ficheinter->lire) $accessallowed=1; if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file; $original_file=$conf->ficheinter->dir_output.'/'.$original_file;
} }
// Wrapping pour les images des stats propales // Wrapping pour les images des stats propales
elseif ($modulepart == 'propalstats') elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp))
{ {
if ($fuser->rights->propale->lire) $accessallowed=1; if ($fuser->rights->propale->lire) $accessallowed=1;
$original_file=$conf->propal->dir_temp.'/'.$original_file; $original_file=$conf->propal->dir_temp.'/'.$original_file;
} }
// Wrapping pour les images des stats commandes // Wrapping pour les images des stats commandes
elseif ($modulepart == 'orderstats') elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp))
{ {
if ($fuser->rights->commande->lire) $accessallowed=1; if ($fuser->rights->commande->lire) $accessallowed=1;
$original_file=$conf->commande->dir_temp.'/'.$original_file; $original_file=$conf->commande->dir_temp.'/'.$original_file;
} }
elseif ($modulepart == 'orderstatssupplier') elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output))
{ {
if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1; if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1;
$original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file; $original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file;
} }
// Wrapping pour les images des stats factures // Wrapping pour les images des stats factures
elseif ($modulepart == 'billstats') elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp))
{ {
if ($fuser->rights->facture->lire) $accessallowed=1; if ($fuser->rights->facture->lire) $accessallowed=1;
$original_file=$conf->facture->dir_temp.'/'.$original_file; $original_file=$conf->facture->dir_temp.'/'.$original_file;
} }
elseif ($modulepart == 'billstatssupplier') elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output))
{ {
if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1; if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1;
$original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file; $original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file;
} }
// Wrapping pour les images des stats expeditions // Wrapping pour les images des stats expeditions
elseif ($modulepart == 'expeditionstats') elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp))
{ {
if ($fuser->rights->expedition->lire) $accessallowed=1; if ($fuser->rights->expedition->lire) $accessallowed=1;
$original_file=$conf->expedition->dir_temp.'/'.$original_file; $original_file=$conf->expedition->dir_temp.'/'.$original_file;
} }
// Wrapping pour les images des stats expeditions // Wrapping pour les images des stats expeditions
elseif ($modulepart == 'tripsexpensesstats') elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp))
{ {
if ($fuser->rights->deplacement->lire) $accessallowed=1; if ($fuser->rights->deplacement->lire) $accessallowed=1;
$original_file=$conf->deplacement->dir_temp.'/'.$original_file; $original_file=$conf->deplacement->dir_temp.'/'.$original_file;
} }
// Wrapping pour les images des stats expeditions // Wrapping pour les images des stats expeditions
elseif ($modulepart == 'memberstats') elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp))
{ {
if ($fuser->rights->adherent->lire) $accessallowed=1; if ($fuser->rights->adherent->lire) $accessallowed=1;
$original_file=$conf->adherent->dir_temp.'/'.$original_file; $original_file=$conf->adherent->dir_temp.'/'.$original_file;
} }
// Wrapping pour les images des stats produits // Wrapping pour les images des stats produits
elseif (preg_match('/^productstats_/i',$modulepart)) elseif (preg_match('/^productstats_/i',$modulepart) && !empty($conf->product->dir_temp))
{ {
if ($fuser->rights->produit->lire || $fuser->rights->service->lire) $accessallowed=1; if ($fuser->rights->produit->lire || $fuser->rights->service->lire) $accessallowed=1;
$original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file;
} }
// Wrapping for products or services // Wrapping for products or services
elseif ($modulepart == 'tax') elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output))
{ {
if ($fuser->rights->tax->charges->lire) $accessallowed=1; if ($fuser->rights->tax->charges->lire) $accessallowed=1;
$original_file=$conf->tax->dir_output.'/'.$original_file; $original_file=$conf->tax->dir_output.'/'.$original_file;
} }
// Wrapping for products or services // Wrapping for products or services
elseif ($modulepart == 'actions') elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output))
{ {
if ($fuser->rights->agenda->myactions->read) $accessallowed=1; if ($fuser->rights->agenda->myactions->read) $accessallowed=1;
$original_file=$conf->agenda->dir_output.'/'.$original_file; $original_file=$conf->agenda->dir_output.'/'.$original_file;
} }
// Wrapping for categories // Wrapping for categories
elseif ($modulepart == 'category') elseif ($modulepart == 'category' && !empty($conf->categorie->dir_output))
{ {
if ($fuser->rights->categorie->lire) $accessallowed=1; if ($fuser->rights->categorie->lire) $accessallowed=1;
$original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file; $original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file;
} }
// Wrapping pour les prelevements // Wrapping pour les prelevements
elseif ($modulepart == 'prelevement') elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output))
{ {
if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) $accessallowed=1;
{
$accessallowed=1;
}
$original_file=$conf->prelevement->dir_output.'/'.$original_file; $original_file=$conf->prelevement->dir_output.'/'.$original_file;
} }
// Wrapping pour les graph energie // Wrapping pour les graph energie
elseif ($modulepart == 'graph_stock') elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->stock->dir_temp.'/'.$original_file; $original_file=$conf->stock->dir_temp.'/'.$original_file;
} }
// Wrapping pour les graph fournisseurs // Wrapping pour les graph fournisseurs
elseif ($modulepart == 'graph_fourn') elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->fournisseur->dir_temp.'/'.$original_file; $original_file=$conf->fournisseur->dir_temp.'/'.$original_file;
} }
// Wrapping pour les graph des produits // Wrapping pour les graph des produits
elseif ($modulepart == 'graph_product') elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->product->multidir_temp[$entity].'/'.$original_file; $original_file=$conf->product->multidir_temp[$entity].'/'.$original_file;
@ -1512,32 +1530,31 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
elseif ($modulepart == 'barcode') elseif ($modulepart == 'barcode')
{ {
$accessallowed=1; $accessallowed=1;
// If viewimage is called for barcode, we try to output an image on the fly, // If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk.
// with not build of file on disk.
//$original_file=$conf->barcode->dir_temp.'/'.$original_file; //$original_file=$conf->barcode->dir_temp.'/'.$original_file;
$original_file=''; $original_file='';
} }
// Wrapping pour les icones de background des mailings // Wrapping pour les icones de background des mailings
elseif ($modulepart == 'iconmailing') elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->mailing->dir_temp.'/'.$original_file; $original_file=$conf->mailing->dir_temp.'/'.$original_file;
} }
// Wrapping pour les icones de background des mailings // Wrapping pour le scanner
elseif ($modulepart == 'scanner_user_temp') elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
} }
// Wrapping pour les images fckeditor // Wrapping pour les images fckeditor
elseif ($modulepart == 'fckeditor') elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->fckeditor->dir_output.'/'.$original_file; $original_file=$conf->fckeditor->dir_output.'/'.$original_file;
} }
// Wrapping for third parties // Wrapping for third parties
else if ($modulepart == 'company' || $modulepart == 'societe') else if (($modulepart == 'company' || $modulepart == 'societe') && !empty($conf->societe->dir_output))
{ {
if ($fuser->rights->societe->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->societe->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1548,7 +1565,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping for contact // Wrapping for contact
else if ($modulepart == 'contact') else if ($modulepart == 'contact' && !empty($conf->societe->dir_output))
{ {
if ($fuser->rights->societe->lire) if ($fuser->rights->societe->lire)
{ {
@ -1558,7 +1575,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping for invoices // Wrapping for invoices
else if ($modulepart == 'facture' || $modulepart == 'invoice') else if (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output))
{ {
if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1567,7 +1584,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$original_file=$conf->facture->dir_output.'/'.$original_file; $original_file=$conf->facture->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }
else if ($modulepart == 'massfilesarea_proposals') else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->dir_output))
{ {
if ($fuser->rights->propal->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->propal->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1592,8 +1609,8 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; $original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} }
// Wrapping pour les fiches intervention // Wrapping for interventions
else if ($modulepart == 'ficheinter') else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output))
{ {
if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1604,7 +1621,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les deplacements et notes de frais // Wrapping pour les deplacements et notes de frais
else if ($modulepart == 'deplacement') else if ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output))
{ {
if ($fuser->rights->deplacement->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->deplacement->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1614,7 +1631,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }
// Wrapping pour les propales // Wrapping pour les propales
else if ($modulepart == 'propal') else if ($modulepart == 'propal' && !empty($conf->propal->dir_output))
{ {
if ($fuser->rights->propale->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->propale->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1626,7 +1643,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les commandes // Wrapping pour les commandes
else if ($modulepart == 'commande' || $modulepart == 'order') else if (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output))
{ {
if ($fuser->rights->commande->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->commande->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1637,7 +1654,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les projets // Wrapping pour les projets
else if ($modulepart == 'project') else if ($modulepart == 'project' && !empty($conf->projet->dir_output))
{ {
if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1646,7 +1663,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$original_file=$conf->projet->dir_output.'/'.$original_file; $original_file=$conf->projet->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }
else if ($modulepart == 'project_task') else if ($modulepart == 'project_task' && !empty($conf->projet->dir_output))
{ {
if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1655,19 +1672,9 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$original_file=$conf->projet->dir_output.'/'.$original_file; $original_file=$conf->projet->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} }
// Wrapping for interventions
else if ($modulepart == 'fichinter')
{
if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file))
{
$accessallowed=1;
}
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
}
// Wrapping pour les commandes fournisseurs // Wrapping pour les commandes fournisseurs
else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') else if (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output))
{ {
if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1678,7 +1685,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les factures fournisseurs // Wrapping pour les factures fournisseurs
else if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') else if (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output))
{ {
if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1689,7 +1696,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les rapport de paiements // Wrapping pour les rapport de paiements
else if ($modulepart == 'facture_paiement') else if ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output))
{ {
if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1700,7 +1707,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping for accounting exports // Wrapping for accounting exports
else if ($modulepart == 'export_compta') else if ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output))
{ {
if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i',$original_file))
{ {
@ -1710,7 +1717,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les expedition // Wrapping pour les expedition
else if ($modulepart == 'expedition') else if ($modulepart == 'expedition' && !empty($conf->expedition->dir_output))
{ {
if ($fuser->rights->expedition->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->expedition->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1720,7 +1727,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les bons de livraison // Wrapping pour les bons de livraison
else if ($modulepart == 'livraison') else if ($modulepart == 'livraison' && !empty($conf->livraison->dir_output))
{ {
if ($fuser->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1730,7 +1737,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les actions // Wrapping pour les actions
else if ($modulepart == 'actions') else if ($modulepart == 'actions' && !empty($conf->agenda->dir_output))
{ {
if ($fuser->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file))
{ {
@ -1740,7 +1747,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les actions // Wrapping pour les actions
else if ($modulepart == 'actionsreport') else if ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp))
{ {
if ($fuser->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file))
{ {
@ -1761,7 +1768,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les contrats // Wrapping pour les contrats
else if ($modulepart == 'contract') else if ($modulepart == 'contract' && !empty($conf->contrat->dir_output))
{ {
if ($fuser->rights->contrat->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->contrat->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1771,7 +1778,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les dons // Wrapping pour les dons
else if ($modulepart == 'donation') else if ($modulepart == 'donation' && !empty($conf->donation->dir_output))
{ {
if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1781,7 +1788,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour les remises de cheques // Wrapping pour les remises de cheques
else if ($modulepart == 'remisecheque') else if ($modulepart == 'remisecheque' && !empty($conf->banque->dir_output))
{ {
if ($fuser->rights->banque->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->banque->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1792,7 +1799,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping for bank // Wrapping for bank
else if ($modulepart == 'bank') else if ($modulepart == 'bank' && !empty($conf->bank->dir_output))
{ {
if ($fuser->rights->banque->lire) if ($fuser->rights->banque->lire)
{ {
@ -1802,7 +1809,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping for export module // Wrapping for export module
else if ($modulepart == 'export') else if ($modulepart == 'export' && !empty($conf->export->dir_temp))
{ {
// Aucun test necessaire car on force le rep de download sur // Aucun test necessaire car on force le rep de download sur
// le rep export qui est propre a l'utilisateur // le rep export qui est propre a l'utilisateur
@ -1811,47 +1818,42 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping for import module // Wrapping for import module
else if ($modulepart == 'import') else if ($modulepart == 'import' && !empty($conf->import->dir_temp))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->import->dir_temp.'/'.$original_file; $original_file=$conf->import->dir_temp.'/'.$original_file;
} }
// Wrapping pour l'editeur wysiwyg // Wrapping pour l'editeur wysiwyg
else if ($modulepart == 'editor') else if ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->fckeditor->dir_output.'/'.$original_file; $original_file=$conf->fckeditor->dir_output.'/'.$original_file;
} }
// Wrapping for miscellaneous medias files // Wrapping for miscellaneous medias files
elseif ($modulepart == 'medias') elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
{ {
$accessallowed=1; $accessallowed=1;
global $dolibarr_main_data_root;
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file; $original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
} }
// Wrapping for backups // Wrapping for backups
else if ($modulepart == 'systemtools') else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output))
{ {
if ($fuser->admin) if ($fuser->admin) $accessallowed=1;
{
$accessallowed=1;
}
$original_file=$conf->admin->dir_output.'/'.$original_file; $original_file=$conf->admin->dir_output.'/'.$original_file;
} }
// Wrapping for upload file test // Wrapping for upload file test
else if ($modulepart == 'admin_temp') else if ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp))
{ {
if ($fuser->admin) if ($fuser->admin) $accessallowed=1;
$accessallowed=1;
$original_file=$conf->admin->dir_temp.'/'.$original_file; $original_file=$conf->admin->dir_temp.'/'.$original_file;
} }
// Wrapping pour BitTorrent // Wrapping pour BitTorrent
else if ($modulepart == 'bittorrent') else if ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output))
{ {
$accessallowed=1; $accessallowed=1;
$dir='files'; $dir='files';
@ -1860,7 +1862,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping pour Foundation module // Wrapping pour Foundation module
else if ($modulepart == 'member') else if ($modulepart == 'member' && !empty($conf->adherent->dir_output))
{ {
if ($fuser->rights->adherent->lire || preg_match('/^specimen/i',$original_file)) if ($fuser->rights->adherent->lire || preg_match('/^specimen/i',$original_file))
{ {
@ -1870,7 +1872,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
// Wrapping for Scanner // Wrapping for Scanner
else if ($modulepart == 'scanner_user_temp') else if ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp))
{ {
$accessallowed=1; $accessallowed=1;
$original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
@ -1883,20 +1885,38 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
// If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart
else else
{ {
if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a file called specimen. Test must be done before changing $original_file int full path.
if ($fuser->admin) $accessallowed=1; // If user is admin
// Define $accessallowed // Define $accessallowed
if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg)) if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg))
{ {
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported
{
dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
exit;
}
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
$original_file=$conf->{$reg[1]}->dir_temp.'/'.$fuser->id.'/'.$original_file; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$fuser->id.'/'.$original_file;
} }
else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg)) else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg))
{ {
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported
{
dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
exit;
}
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
$original_file=$conf->{$reg[1]}->dir_temp.'/'.$original_file; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$original_file;
} }
else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg)) else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg))
{ {
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; if (empty($conf->{$reg[1]}->dir_output)) // modulepart not supported
{
dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
exit;
}
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
$original_file=$conf->{$reg[1]}->dir_output.'/'.$fuser->id.'/'.$original_file; $original_file=$conf->{$reg[1]}->dir_output.'/'.$fuser->id.'/'.$original_file;
} }
else else
@ -1920,8 +1940,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$original_file=$conf->$modulepart->dir_output.'/'.$original_file; $original_file=$conf->$modulepart->dir_output.'/'.$original_file;
} }
} }
if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a specimen
if ($fuser->admin) $accessallowed=1; // If user is admin
// For modules who wants to manage different levels of permissions for documents // For modules who wants to manage different levels of permissions for documents
$subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS'; $subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS';
@ -1953,7 +1971,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
} }
/** /**
* Store object in file * Store object in file.
* *
* @param string $directory Directory of cache * @param string $directory Directory of cache
* @param string $filename Name of filecache * @param string $filename Name of filecache
@ -1969,7 +1987,7 @@ function dol_filecache($directory, $filename, $object)
} }
/** /**
* Test if Refresh needed * Test if Refresh needed.
* *
* @param string $directory Directory of cache * @param string $directory Directory of cache
* @param string $filename Name of filecache * @param string $filename Name of filecache
@ -1985,7 +2003,7 @@ function dol_cache_refresh($directory, $filename, $cachetime)
} }
/** /**
* Read object from cachefile * Read object from cachefile.
* *
* @param string $directory Directory of cache * @param string $directory Directory of cache
* @param string $filename Name of filecache * @param string $filename Name of filecache

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2008-2017 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -74,7 +74,7 @@ function dol_decode($chain)
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt. * If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
* *
* @param string $chain String to hash * @param string $chain String to hash
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0. * @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5, 4:md5 for OpenLdap). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0.
* @return string Hash of string * @return string Hash of string
*/ */
function dol_hash($chain,$type=0) function dol_hash($chain,$type=0)
@ -87,6 +87,7 @@ function dol_hash($chain,$type=0)
if ($type == 1) return sha1($chain); if ($type == 1) return sha1($chain);
else if ($type == 2) return sha1(md5($chain)); else if ($type == 2) return sha1(md5($chain));
else if ($type == 3) return md5($chain); else if ($type == 3) return md5($chain);
else if ($type == 4) return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain);
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain)); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain));

View File

@ -47,7 +47,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
{ {
dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=".$usertotest." passwordtotest=".preg_replace('/./','*',$passwordtotest)." entitytotest=".$entitytotest); dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=".$usertotest." passwordtotest=".preg_replace('/./','*',$passwordtotest)." entitytotest=".$entitytotest);
// If test username/password asked, we define $test=false and $login var if ok, set $_SESSION["dol_loginmesg"] if ko // If test username/password asked, we define $test=false if ko and $login var to login if ok, set also $_SESSION["dol_loginmesg"] if ko
$table = MAIN_DB_PREFIX."user"; $table = MAIN_DB_PREFIX."user";
$usernamecol1 = 'login'; $usernamecol1 = 'login';
$usernamecol2 = 'email'; $usernamecol2 = 'email';
@ -59,6 +59,9 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'"; if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'";
$sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; $sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")";
$sql.=' AND statut = 1'; $sql.=' AND statut = 1';
// Required to first found the user into entity, then the superadmin.
// For the case (TODO and that we must avoid) a user has renamed its login with same value than a user in entity 0.
$sql.=' ORDER BY entity DESC';
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -588,9 +588,9 @@ class ImportCsv extends ModeleImports
{ {
$updatedone = false; $updatedone = false;
$insertdone = false; $insertdone = false;
if(!empty($updatekeys)) { if (!empty($updatekeys)) {
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
if(empty($lastinsertid)) { if (empty($lastinsertid)) {
$sqlSelect = 'SELECT rowid FROM '.$tablename; $sqlSelect = 'SELECT rowid FROM '.$tablename;
$data = array_combine($listfields, $listvalues); $data = array_combine($listfields, $listvalues);
@ -627,7 +627,7 @@ class ImportCsv extends ModeleImports
} }
} }
if(!empty($lastinsertid)) { if (!empty($lastinsertid)) {
// Build SQL UPDATE request // Build SQL UPDATE request
$sqlstart = 'UPDATE '.$tablename; $sqlstart = 'UPDATE '.$tablename;
@ -660,7 +660,7 @@ class ImportCsv extends ModeleImports
} }
// Update not done, we do insert // Update not done, we do insert
if(!$error && !$updatedone) { if (!$error && !$updatedone) {
// Build SQL INSERT request // Build SQL INSERT request
$sqlstart = 'INSERT INTO '.$tablename.'('.implode(', ', $listfields).', import_key'; $sqlstart = 'INSERT INTO '.$tablename.'('.implode(', ', $listfields).', import_key';
$sqlend = ') VALUES('.implode(', ', $listvalues).", '".$importid."'"; $sqlend = ') VALUES('.implode(', ', $listvalues).", '".$importid."'";
@ -679,10 +679,10 @@ class ImportCsv extends ModeleImports
if ($sql) if ($sql)
{ {
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
if ($resql) if ($resql)
{ {
$insertdone = true; $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
$insertdone = true;
} }
else else
{ {

View File

@ -44,7 +44,7 @@ class modNotification extends DolibarrModules
$this->family = "technic"; $this->family = "technic";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "Gestion des notifications (par mail) sur evenement Dolibarr"; $this->description = "EMail notifications (push) on business Dolibarr events";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 1; $this->special = 1;

View File

@ -6,9 +6,9 @@ require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
$form = new Form($db); $form = new Form($db);
$formresources = new FormResource($db); $formresources = new FormResource($db);
$out = '<div class="tagtable centpercent border allwidth nohover">'; $out = '<div class="tagtable centpercent noborder allwidth nohover">';
$out .= '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $out .= '<form class="tagtr nohover '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out .= '<input type="hidden" name="action" value="add_element_resource">'; $out .= '<input type="hidden" name="action" value="add_element_resource">';
$out .= '<input type="hidden" name="element" value="'.$element.'">'; $out .= '<input type="hidden" name="element" value="'.$element.'">';

View File

@ -31,7 +31,7 @@
*/ */
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('EURO')) define('EURO',chr(128)); if (! defined('EURO')) define('EURO',chr(128));

View File

@ -2950,7 +2950,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,'; $sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,';
$sql.= ' cd.total_localtax1, cd.total_localtax2,'; $sql.= ' cd.total_localtax1, cd.total_localtax2,';
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,';
$sql.= ' cd.date_start, cd.date_end, cd.fk_unit'; $sql.= ' cd.date_start, cd.date_end, cd.fk_unit,';
$sql.= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
$sql.= ' WHERE cd.rowid = '.$rowid; $sql.= ' WHERE cd.rowid = '.$rowid;
@ -2958,6 +2959,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
if ($result) if ($result)
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$this->rowid = $objp->rowid; $this->rowid = $objp->rowid;
$this->id = $objp->rowid; $this->id = $objp->rowid;
$this->fk_commande = $objp->fk_commande; $this->fk_commande = $objp->fk_commande;
@ -2985,9 +2987,14 @@ class CommandeFournisseurLigne extends CommonOrderLine
$this->product_libelle = $objp->product_libelle; $this->product_libelle = $objp->product_libelle;
$this->product_desc = $objp->product_desc; $this->product_desc = $objp->product_desc;
$this->date_start = $this->db->jdate($objp->date_start); $this->date_start = $this->db->jdate($objp->date_start);
$this->date_end = $this->db->jdate($objp->date_end); $this->date_end = $this->db->jdate($objp->date_end);
$this->fk_unit = $objp->fk_unit; $this->fk_unit = $objp->fk_unit;
$this->multicurrency_subprice = $objp->multicurrency_subprice;
$this->multicurrency_total_ht = $objp->multicurrency_total_ht;
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$this->db->free($result); $this->db->free($result);
return 1; return 1;

View File

@ -2385,8 +2385,9 @@ class SupplierInvoiceLine extends CommonObjectLine
{ {
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
$sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; $sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
$sql.= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
$sql.= ' WHERE f.rowid = '.$rowid; $sql.= ' WHERE f.rowid = '.$rowid;
@ -2407,6 +2408,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->rowid = $obj->rowid; $this->rowid = $obj->rowid;
$this->fk_facture_fourn = $obj->fk_facture_fourn;
$this->description = $obj->description; $this->description = $obj->description;
$this->product_ref = $obj->product_ref; $this->product_ref = $obj->product_ref;
$this->ref = $obj->product_ref; $this->ref = $obj->product_ref;
@ -2439,6 +2441,11 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->rang = $obj->rang; $this->rang = $obj->rang;
$this->fk_unit = $obj->fk_unit; $this->fk_unit = $obj->fk_unit;
$this->multicurrency_subprice = $obj->multicurrency_subprice;
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
return 1; return 1;
} }

View File

@ -2411,6 +2411,7 @@ else
print $langs->trans('AlreadyPaid'); print $langs->trans('AlreadyPaid');
print ' :</td><td align="right"'.(($totalpaye > 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . '</td><td>&nbsp;</td></tr>'; print ' :</td><td align="right"'.(($totalpaye > 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . '</td><td>&nbsp;</td></tr>';
$resteapayer = $object->total_ttc - $totalpaye;
$resteapayeraffiche = $resteapayer; $resteapayeraffiche = $resteapayer;
$cssforamountpaymentcomplete = 'amountpaymentcomplete'; $cssforamountpaymentcomplete = 'amountpaymentcomplete';

View File

@ -105,9 +105,9 @@ ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the page "Binding don
ACCOUNTING_LENGTH_DESCRIPTION=Truncate product & services description in listings after x chars (Best = 50) ACCOUNTING_LENGTH_DESCRIPTION=Truncate product & services description in listings after x chars (Best = 50)
ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Truncate product & services account description form in listings after x chars (Best = 50) ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Truncate product & services account description form in listings after x chars (Best = 50)
ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts (If you set value to 6 here, the account '706' will appear like '706000' on screen)
ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounting accounts ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounting accounts (If you set value to 6 here, the account '401' will appear like '401000' on screen)
ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disabled by default. If set to on, you must also set the 2 following parameters (or it is ignored) ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zero at the end of an accounting account. Needed by some countries (like switzerland). If keep to off (default), you can set the 2 following parameters to ask application to add virtual zero.
BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account
ACCOUNTING_SELL_JOURNAL=Sell journal ACCOUNTING_SELL_JOURNAL=Sell journal

View File

@ -13,7 +13,7 @@ MenuNewPrivateIndividual=New private individual
NewCompany=New company (prospect, customer, supplier) NewCompany=New company (prospect, customer, supplier)
NewThirdParty=New third party (prospect, customer, supplier) NewThirdParty=New third party (prospect, customer, supplier)
CreateDolibarrThirdPartySupplier=Create a third party (supplier) CreateDolibarrThirdPartySupplier=Create a third party (supplier)
CreateThirdPartyOnly=Create thirdpary CreateThirdPartyOnly=Create third party
CreateThirdPartyAndContact=Create a third party + a child contact CreateThirdPartyAndContact=Create a third party + a child contact
ProspectionArea=Prospection area ProspectionArea=Prospection area
IdThirdParty=Id third party IdThirdParty=Id third party
@ -397,7 +397,7 @@ LeopardNumRefModelDesc=The code is free. This code can be modified at any time.
ManagingDirectors=Manager(s) name (CEO, director, president...) ManagingDirectors=Manager(s) name (CEO, director, president...)
MergeOriginThirdparty=Duplicate third party (third party you want to delete) MergeOriginThirdparty=Duplicate third party (third party you want to delete)
MergeThirdparties=Merge third parties MergeThirdparties=Merge third parties
ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one. ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one? All linked objects (invoices, orders, ...) will be moved to current third party, then the thirdparty will be deleted.
ThirdpartiesMergeSuccess=Thirdparties have been merged ThirdpartiesMergeSuccess=Thirdparties have been merged
SaleRepresentativeLogin=Login of sales representative SaleRepresentativeLogin=Login of sales representative
SaleRepresentativeFirstname=First name of sales representative SaleRepresentativeFirstname=First name of sales representative

View File

@ -43,6 +43,7 @@ LoanCalcDesc=This <b>mortgage calculator</b> can be used to figure out monthly p
GoToInterest=%s will go towards INTEREST GoToInterest=%s will go towards INTEREST
GoToPrincipal=%s will go towards PRINCIPAL GoToPrincipal=%s will go towards PRINCIPAL
YouWillSpend=You will spend %s in year %s YouWillSpend=You will spend %s in year %s
AddLoan=Create loan
# Admin # Admin
ConfigLoan=Configuration of the module loan ConfigLoan=Configuration of the module loan
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default

View File

@ -60,16 +60,19 @@ DeStockOnShipment=Decrease real stocks on shipping validation
DeStockOnShipmentOnClosing=Decrease real stocks on shipping classification closed DeStockOnShipmentOnClosing=Decrease real stocks on shipping classification closed
ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation
ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation
ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receiving ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receipt of goods
OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses. OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses.
StockDiffPhysicTeoric=Explanation for difference between physical and theoretical stock StockDiffPhysicTeoric=Explanation for difference between physical and virtual stock
NoPredefinedProductToDispatch=No predefined products for this object. So no dispatching in stock is required. NoPredefinedProductToDispatch=No predefined products for this object. So no dispatching in stock is required.
DispatchVerb=Dispatch DispatchVerb=Dispatch
StockLimitShort=Limit for alert StockLimitShort=Limit for alert
StockLimit=Stock limit for alert StockLimit=Stock limit for alert
PhysicalStock=Physical stock PhysicalStock=Physical stock
RealStock=Real Stock RealStock=Real Stock
RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements.
RealStockWillAutomaticallyWhen=The real stock will automatically change according to this rules (see stock module setup to change this):
VirtualStock=Virtual stock VirtualStock=Virtual stock
VirtualStockDesc=Virtual stock is the stock you will get once all opened pending actions that affect stocks will be closed (supplier order received, customer order shipped, ...)
IdWarehouse=Id warehouse IdWarehouse=Id warehouse
DescWareHouse=Description warehouse DescWareHouse=Description warehouse
LieuWareHouse=Localisation warehouse LieuWareHouse=Localisation warehouse

View File

@ -126,10 +126,7 @@ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowi
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
if ($sall) if ($sall) $sql.=natural_search(array('p.ref','p.label','p.description','p.note'), $sall);
{
$sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
}
// if the type is not 1, we show all products (type = 0,2,3) // if the type is not 1, we show all products (type = 0,2,3)
if (dol_strlen($type)) if (dol_strlen($type))
{ {
@ -163,6 +160,12 @@ $sql.= " pb.batch, pb.eatby, pb.sellby,";
$sql.= " pl.eatby, pl.sellby"; $sql.= " pl.eatby, pl.sellby";
if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit + 1, $offset); $sql.= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
@ -193,11 +196,11 @@ if ($resql)
if ($sref || $snom || $sall || GETPOST('search')) if ($sref || $snom || $sall || GETPOST('search'))
{ {
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, 'title_products'); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;tosell=".$tosell."&amp;tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products');
} }
else else
{ {
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num, 0, 'title_products'); print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products');
} }
if (! empty($catid)) if (! empty($catid))

View File

@ -524,6 +524,35 @@ class Productlot extends CommonObject
} }
} }
/**
* Return label of status of object
*
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label of status
*/
function getLibStatut($mode=0)
{
return $this->LibStatut(0,$mode);
}
/**
* Return label of a given status
*
* @param int $statut Status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
* @return string Label of status
*/
function LibStatut($statut,$mode=0)
{
global $langs;
//$langs->load('stocks');
return '';
}
/** /**
* Return a link to the a lot card (with optionaly the picto) * Return a link to the a lot card (with optionaly the picto)
* Use this->id,this->lastname, this->firstname * Use this->id,this->lastname, this->firstname

View File

@ -89,7 +89,7 @@ $arrayfields=array(
'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))), 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))),
'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))),
'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(! empty($conf->productbatch->enabled))),
'm.warehouse'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it 'e.label'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it
'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0),
'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1),
'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1),
@ -640,6 +640,7 @@ if ($resql)
if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode);
if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref);
if ($search_product) $param.='&search_product='.urlencode($search_product); if ($search_product) $param.='&search_product='.urlencode($search_product);
if ($search_batch) $param.='&search_batch='.urlencode($search_batch);
if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse); if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse);
if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined
if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined
@ -710,7 +711,7 @@ if ($resql)
if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['m.warehouse']['checked'])) print_liste_field_titre($arrayfields['m.warehouse']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible if (! empty($arrayfields['e.label']['checked'])) print_liste_field_titre($arrayfields['e.label']['label'],$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible
if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder);
if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder);
@ -774,7 +775,7 @@ if ($resql)
// Batch // Batch
if (! empty($arrayfields['m.batch']['checked'])) if (! empty($arrayfields['m.batch']['checked']))
{ {
print '<td align="center"><input class="flat" type="text" size="5" name="search_batch" value="'.dol_escape_htmltag($search_batch).'"></td>'; print '<td class="liste_titre" align="center"><input class="flat" type="text" size="5" name="search_batch" value="'.dol_escape_htmltag($search_batch).'"></td>';
} }
if (! empty($arrayfields['pl.eatby']['checked'])) if (! empty($arrayfields['pl.eatby']['checked']))
{ {
@ -787,7 +788,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Warehouse // Warehouse
if (! empty($arrayfields['m.warehouse']['checked'])) if (! empty($arrayfields['e.label']['checked']))
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="left">'; print '<td class="liste_titre maxwidthonsmartphone" align="left">';
//print '<input class="flat" type="text" size="8" name="search_warehouse" value="'.($search_warehouse).'">'; //print '<input class="flat" type="text" size="8" name="search_warehouse" value="'.($search_warehouse).'">';
@ -949,7 +950,7 @@ if ($resql)
print '<td align="center">'. dol_print_date($objp->sellby,'day') .'</td>'; print '<td align="center">'. dol_print_date($objp->sellby,'day') .'</td>';
} }
// Warehouse // Warehouse
if (! empty($arrayfields['m.warehouse']['checked'])) if (! empty($arrayfields['e.label']['checked']))
{ {
print '<td>'; print '<td>';
print $warehousestatic->getNomUrl(1); print $warehousestatic->getNomUrl(1);

View File

@ -270,24 +270,6 @@ llxHeader('','ProductLot','');
$form=new Form($db); $form=new Form($db);
// Put here content of your page
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
// Part to create // Part to create
if ($action == 'create') if ($action == 'create')
{ {
@ -335,19 +317,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $formconfirm; print $formconfirm;
} }
print '<table class="border centpercent">'."\n";
$linkback = '<a href="' . DOL_URL_ROOT . '/product/stock/productlot_list.php' . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/product/stock/productlot_list.php' . '">' . $langs->trans("BackToList") . '</a>';
// Ref dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'batch');
print '<tr><td class="titlefield">' . $langs->trans('Batch') . '</td>';
print '<td colspan="3">'; print '<div class="fichecenter">';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'batch'); print '<div class="underbanner clearboth"></div>';
print '</td>';
print '</tr>'; print '<table class="border centpercent">'."\n";
// Product // Product
print '<tr><td>'.$langs->trans("Product").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Product").'</td><td>';
$producttmp = new Product($db); $producttmp = new Product($db);
$producttmp->fetch($object->fk_product); $producttmp->fetch($object->fk_product);
print $producttmp->getNomUrl(1, 'stock'); print $producttmp->getNomUrl(1, 'stock');
@ -356,7 +337,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Eat by // Eat by
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print $form->editfieldkey($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td colspan="5">'; print '</td><td>';
print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -364,7 +345,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Sell by // Sell by
print '<tr><td>'; print '<tr><td>';
print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
print '</td><td colspan="5">'; print '</td><td>';
print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -375,6 +356,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>'; print '</table>';
print '</div>';
dol_fiche_end(); dol_fiche_end();

View File

@ -591,6 +591,7 @@ if ($action == 'create' && $user->rights->projet->creer)
// Categories // Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PROJECT, '', 'parent', 64, 0, 1);
$arrayselected=GETPOST('categories', 'array');
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>"; print "</td></tr>";
} }

View File

@ -358,14 +358,16 @@ if ($socid && $action != 'edit' && $action != "create")
print load_fiche_titre($langs->trans("DefaultRIB"), '', ''); print load_fiche_titre($langs->trans("DefaultRIB"), '', '');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("LabelRIB").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("LabelRIB").'</td>';
print '<td colspan="4">'.$account->label.'</td></tr>'; print '<td>'.$account->label.'</td></tr>';
print '<tr><td>'.$langs->trans("BankName").'</td>'; print '<tr><td>'.$langs->trans("BankName").'</td>';
print '<td colspan="4">'.$account->bank.'</td></tr>'; print '<td>'.$account->bank.'</td></tr>';
// Show fields of bank account // Show fields of bank account
foreach($account->getFieldsToShow(1) as $val) foreach($account->getFieldsToShow(1) as $val)
@ -406,24 +408,24 @@ if ($socid && $action != 'edit' && $action != "create")
} }
print '<tr><td>'.$langs->trans($val).'</td>'; print '<tr><td>'.$langs->trans($val).'</td>';
print '<td colspan="4">'.$content.'</td>'; print '<td>'.$content.'</td>';
print '</tr>'; print '</tr>';
} }
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">'; print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
print $account->domiciliation; print $account->domiciliation;
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td colspan="4">'; print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td>';
print $account->proprio; print $account->proprio;
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="4">'; print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
print $account->owner_address; print $account->owner_address;
print "</td></tr>\n"; print "</td></tr>\n";
print '</table>'; print '</table>';
print '</div>';
print '<br>'; print '<br>';
@ -610,7 +612,7 @@ if ($socid && $action != 'edit' && $action != "create")
{ {
$colspan=8; $colspan=8;
if (! empty($conf->prelevement->enabled)) $colspan+=2; if (! empty($conf->prelevement->enabled)) $colspan+=2;
print '<tr '.$bc[0].'><td colspan="'.$colspan.'" align="center">'.$langs->trans("NoBANRecord").'</td></tr>'; print '<tr '.$bc[0].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoBANRecord").'</td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -123,15 +123,14 @@ if (empty($reshook))
$soc_origin_id = GETPOST('soc_origin', 'int'); $soc_origin_id = GETPOST('soc_origin', 'int');
$soc_origin = new Societe($db); $soc_origin = new Societe($db);
if ($soc_origin_id < 1) if ($soc_origin_id <= 0)
{ {
$langs->load('errors'); $langs->load('errors');
$langs->load('companies'); $langs->load('companies');
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors');
} }
else else
{ {
if (!$errors && $soc_origin->fetch($soc_origin_id) < 1) if (!$errors && $soc_origin->fetch($soc_origin_id) < 1)
{ {
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
@ -140,8 +139,44 @@ if (empty($reshook))
if (!$errors) if (!$errors)
{ {
// TODO Move the merge function into class of object.
$db->begin(); $db->begin();
// Recopy some data
$object->client = $object->client | $soc_origin->client;
$object->fournisseur = $object->fournisseur | $soc_origin->fournisseur;
$listofproperties=array(
'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6',
'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis',
'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency',
'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur',
'model_pdf', 'fk_projet'
);
foreach ($listofproperties as $property)
{
if (empty($object->$property)) $object->$property = $soc_origin->$property;
}
// Concat some data
$listofproperties=array(
'note_public', 'note_private'
);
foreach ($listofproperties as $property)
{
$object->$property = dol_concatdesc($object->$property, $soc_origin->$property);
}
// Merge extrafields
foreach ($soc_origin->array_options as $key => $val)
{
if (empty($object->array_options[$key])) $object->array_options[$key] = $val;
}
// TODO Merge categories
$object->update($object->id, $user);
// Move links
$objects = array( $objects = array(
'Adherent' => '/adherents/class/adherent.class.php', 'Adherent' => '/adherents/class/adherent.class.php',
'Societe' => '/societe/class/societe.class.php', 'Societe' => '/societe/class/societe.class.php',
@ -159,6 +194,7 @@ if (empty($reshook))
'Fichinter' => '/fichinter/class/fichinter.class.php', 'Fichinter' => '/fichinter/class/fichinter.class.php',
'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php',
'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php',
'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php',
'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php',
'Livraison' => '/livraison/class/livraison.class.php', 'Livraison' => '/livraison/class/livraison.class.php',
'Product' => '/product/class/product.class.php', 'Product' => '/product/class/product.class.php',
@ -451,6 +487,7 @@ if (empty($reshook))
if (empty($object->fournisseur)) $object->code_fournisseur=''; if (empty($object->fournisseur)) $object->code_fournisseur='';
$result = $object->create($user); $result = $object->create($user);
if ($result >= 0) if ($result >= 0)
{ {
if ($object->particulier) if ($object->particulier)

View File

@ -2532,6 +2532,24 @@ class SupplierProposal extends CommonObject
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
/**
* 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
* @return bool
*/
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
{
$tables = array(
'supplier_proposal'
);
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 326 B

View File

@ -577,13 +577,13 @@ div.myavailability {
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.tdoverflowmax100 { .tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */
max-width: 100px; max-width: 100px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.tdoverflowmax300 { .tdoverflowmax300 { /* For tdoverflow, the max-midth become a minimum ! */
max-width: 300px; max-width: 300px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@ -2742,11 +2742,12 @@ div.pagination li.paginationafterarrows {
} }
*/ */
/* Set the color for hover lines */ /* Set the color for hover lines */
.odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover, .box_pair:hover, .box_impair:hover .odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover, .box_pair:hover, .box_impair:hover
{ {
<?php if ($colorbacklinepairhover) { ?> <?php if ($colorbacklinepairhover) { ?>
background: rgb(<?php echo $colorbacklinepairhover; ?>) !important; background-color: rgb(<?php echo $colorbacklinepairhover; ?>) !important;
<?php } ?> <?php } ?>
} }
@ -2757,10 +2758,10 @@ div.pagination li.paginationafterarrows {
color: #202020; color: #202020;
min-height: 18px; /* seems to not be used */ min-height: 18px; /* seems to not be used */
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>; background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
} }
#GanttChartDIV { #GanttChartDIV {
background: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>; background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?>;
} }
.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { .even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover {
@ -2776,13 +2777,14 @@ table.dataTable tr.odd {
} }
/* For no hover style */ /* For no hover style */
table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td { table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important; background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
} }
tr.nohoverpair td { tr.nohoverpair td {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important; background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklinepair1)); ?> !important;
} }
table.dataTable td { table.dataTable td {
padding: 5px 2px 5px 3px !important; padding: 5px 2px 5px 3px !important;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 326 B

View File

@ -2648,7 +2648,7 @@ table.dataTable tr.odd {
} }
/* For no hover style */ /* For no hover style */
table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td { table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover {
background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important; background-color: #<?php echo colorArrayToHex(colorStringToArray($colorbacklineimpair1)); ?> !important;
} }
tr.nohoverpair td { tr.nohoverpair td {

View File

@ -4,7 +4,7 @@
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk> * Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
@ -2219,13 +2219,14 @@ class User extends CommonObject
$this->fullname=$this->getFullName($langs); $this->fullname=$this->getFullName($langs);
// Champs // Champs
if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname; if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname; if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname;
if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname; if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname;
if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login; if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login; if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login;
if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid; if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption
if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid;
if ($this->societe_id > 0) if ($this->societe_id > 0)
{ {
$soc = new Societe($this->db); $soc = new Societe($this->db);