Merge branch 'develop' of github.com:Dolibarr/dolibarr into fix-margin-agents

This commit is contained in:
Lionel VESSILLER 2019-02-05 17:03:12 +01:00
commit 4e08aa95bb
1550 changed files with 29725 additions and 29620 deletions

View File

@ -8,7 +8,8 @@ charset = utf-8
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
[*.php] [*.php]
indent_style = tab indent_style = space
trim_trailing_whitespace = true
[*.js] [*.js]
indent_style = tab indent_style = tab
[*.css] [*.css]

View File

@ -45,8 +45,7 @@ require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
$includecustom=0; $includecustom=0;
$includeconstants=array(); $includeconstants=array();
if (empty($argv[1])) if (empty($argv[1])) {
{
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n"; print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit -1; exit -1;
@ -54,14 +53,11 @@ if (empty($argv[1]))
parse_str($argv[1]); parse_str($argv[1]);
$i=0; $i=0;
while ($i < $argc) while ($i < $argc) {
{
if (! empty($argv[$i])) parse_str($argv[$i]); if (! empty($argv[$i])) parse_str($argv[$i]);
if (preg_match('/includeconstant=/',$argv[$i])) if (preg_match('/includeconstant=/', $argv[$i])) {
{
$tmp=explode(':', $includeconstant, 3); $tmp=explode(':', $includeconstant, 3);
if (count($tmp) != 3) if (count($tmp) != 3) {
{
print "Error: Bad parameter includeconstant ".$includeconstant."\n"; print "Error: Bad parameter includeconstant ".$includeconstant."\n";
exit -1; exit -1;
} }
@ -70,8 +66,7 @@ while ($i < $argc)
$i++; $i++;
} }
if (empty($release)) if (empty($release)) {
{
print "Error: Missing release paramater\n"; print "Error: Missing release paramater\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1; exit -1;
@ -81,39 +76,29 @@ $savrelease = $release;
// If release is auto, we take current version // If release is auto, we take current version
$tmpver=explode('-', $release, 2); $tmpver=explode('-', $release, 2);
if ($tmpver[0] == 'auto' || $tmpver[0] == 'autostable') if ($tmpver[0] == 'auto' || $tmpver[0] == 'autostable') {
{
$release=DOL_VERSION; $release=DOL_VERSION;
if ($tmpver[1] && $tmpver[0] == 'auto') $release.='-'.$tmpver[1]; if ($tmpver[1] && $tmpver[0] == 'auto') $release.='-'.$tmpver[1];
} }
if (empty($includecustom)) if (empty($includecustom)) {
{
$tmpverbis=explode('-', $release, 2); $tmpverbis=explode('-', $release, 2);
if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable') if (empty($tmpverbis[1]) || $tmpver[0] == 'autostable') {
{ if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto') {
if (DOL_VERSION != $tmpverbis[0] && $savrelease != 'auto')
{
print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n"; print 'Error: When parameter "includecustom" is not set and there is no suffix in release parameter, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1; exit -1;
} }
} } else {
else
{
$tmpverter=explode('-', DOL_VERSION, 2); $tmpverter=explode('-', DOL_VERSION, 2);
if ($tmpverter[0] != $tmpverbis[0]) if ($tmpverter[0] != $tmpverbis[0]) {
{
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n"; print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must have value without prefix ('.$tmpverter[0].') that is exact same value than "release" parameter ('.$tmpverbis[0].')'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1; exit -1;
} }
} }
} } else {
else if (! preg_match('/'.preg_quote(DOL_VERSION, '/').'-/', $release)) {
{
if (! preg_match('/'.preg_quote(DOL_VERSION,'/').'-/',$release))
{
print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n"; print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parameter (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n"; print "Usage: ".$script_file." release=autostable|auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
exit -1; exit -1;
@ -123,10 +108,8 @@ else
print "Release : ".$release."\n"; print "Release : ".$release."\n";
print "Include custom in signature : ".$includecustom."\n"; print "Include custom in signature : ".$includecustom."\n";
print "Include constants in signature : "; print "Include constants in signature : ";
foreach ($includeconstants as $countrycode => $tmp) foreach ($includeconstants as $countrycode => $tmp) {
{ foreach($tmp as $constname => $constvalue) {
foreach($tmp as $constname => $constvalue)
{
print $constname.'='.$constvalue." "; print $constname.'='.$constvalue." ";
} }
} }
@ -144,11 +127,9 @@ $fp = fopen($outputfile,'w');
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n"); fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'">'."\n"); fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'">'."\n");
foreach ($includeconstants as $countrycode => $tmp) foreach ($includeconstants as $countrycode => $tmp) {
{
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n"); fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
foreach($tmp as $constname => $constvalue) foreach($tmp as $constname => $constvalue) {
{
$valueforchecksum=(empty($constvalue)?'0':$constvalue); $valueforchecksum=(empty($constvalue)?'0':$constvalue);
$checksumconcat[]=$valueforchecksum; $checksumconcat[]=$valueforchecksum;
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n"); fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");

View File

@ -112,9 +112,6 @@
<rule ref="Generic.Functions.CallTimePassByReference" /> <rule ref="Generic.Functions.CallTimePassByReference" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" /> <rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma">
<severity>0</severity>
</rule>
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals"> <rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
@ -190,6 +187,9 @@
</rule> </rule>
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" /> <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" />
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration" /> <rule ref="Squiz.Functions.MultiLineFunctionDeclaration" />
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties> <properties>
@ -432,5 +432,5 @@
<rule ref="PSR2.Classes.ClassDeclaration" /> <rule ref="PSR2.Classes.ClassDeclaration" />
<rule ref="PSR2.Methods.FunctionClosingBrace" /> <rule ref="PSR2.Methods.FunctionClosingBrace" />
<rule ref="PSR2.Files.EndFileNewline.TooMany" /> <rule ref="PSR2.Files.EndFileNewline.TooMany" />
<rule ref="PSR2.Files.EndFileNewline.NoneFound" />
</ruleset> </ruleset>

View File

@ -220,11 +220,13 @@ class autoTranslator
} }
} }
if ($key == 'CHARSET') $val=$this->_outputpagecode; if ($key == 'CHARSET') {
elseif (preg_match('/^Format/',$key)) $val=$value; $val=$this->_outputpagecode;
elseif ($value=='-') $val=$value; } elseif (preg_match('/^Format/', $key)) {
else $val=$value;
{ } elseif ($value=='-') {
$val=$value;
} else {
// If not translated then translate // If not translated then translate
if ($this->_outputpagecode == 'UTF-8') $val=$this->translateTexts(array($value), substr($this->_refLang, 0, 2), substr($my_destlang, 0, 2)); if ($this->_outputpagecode == 'UTF-8') $val=$this->translateTexts(array($value), substr($this->_refLang, 0, 2), substr($my_destlang, 0, 2));
else $val=utf8_decode($this->translateTexts(array($value), substr($this->_refLang, 0, 2), substr($my_destlang, 0, 2))); else $val=utf8_decode($this->translateTexts(array($value), substr($this->_refLang, 0, 2), substr($my_destlang, 0, 2)));

View File

@ -531,12 +531,15 @@ if ($id)
if ($fieldlist[$field]=='country_id') { $valuetoshow=''; } if ($fieldlist[$field]=='country_id') { $valuetoshow=''; }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($valuetoshow != '') if ($valuetoshow != '') {
{
print '<td align="'.$align.'">'; print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
else print $valuetoshow; } elseif (! empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
print '</td>'; print '</td>';
} }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;

View File

@ -627,11 +627,17 @@ if ($id)
// Can an entry be erased or disabled ? // Can an entry be erased or disabled ?
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
if (isset($obj->code) && $id != 10) if (isset($obj->code) && $id != 10) {
{ if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; } $iserasable = 0;
elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } $canbedisabled = 0;
elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } } elseif ($obj->code == 'RECEP') {
$iserasable = 0;
$canbedisabled = 0;
} elseif ($obj->code == 'EF0') {
$iserasable = 0;
$canbedisabled = 0;
}
} }
$canbemodified=$iserasable; $canbemodified=$iserasable;

View File

@ -94,7 +94,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)
$idpays = $mysoc->country_id; $idpays = $mysoc->country_id;
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; $sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";

View File

@ -692,7 +692,7 @@ class Adherent extends CommonObject
$lthirdparty=new Societe($this->db); $lthirdparty=new Societe($this->db);
$result=$lthirdparty->fetch($this->fk_soc); $result=$lthirdparty->fetch($this->fk_soc);
if ($result >= 0) if ($result > 0)
{ {
$lthirdparty->address=$this->address; $lthirdparty->address=$this->address;
$lthirdparty->zip=$this->zip; $lthirdparty->zip=$this->zip;
@ -716,7 +716,7 @@ class Adherent extends CommonObject
$error++; $error++;
} }
} }
else elseif ($result < 0)
{ {
$this->error=$lthirdparty->error; $this->error=$lthirdparty->error;
$error++; $error++;

View File

@ -95,15 +95,13 @@ if ($cancel) {
$action=''; $action='';
if (! empty($backtopage)) if (! empty($backtopage)) {
{
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
} }
if ($action == 'add' && $user->rights->adherent->configurer) if ($action == 'add' && $user->rights->adherent->configurer) {
{
$object->label = trim($label); $object->label = trim($label);
$object->statut = (int) $statut; $object->statut = (int) $statut;
$object->subscription = (int) $subscription; $object->subscription = (int) $subscription;
@ -266,8 +264,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
$membertype = new AdherentType($db); $membertype = new AdherentType($db);
while ($i < $num) while ($i < $num) {
{
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$membertype->id = $objp->rowid; $membertype->id = $objp->rowid;

View File

@ -192,10 +192,8 @@ elseif ($action == 'set_ORDER_FREE_TEXT')
{ {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action=="setshippableiconinlist") {
// Activate Set Shippable Icon In List // Activate Set Shippable Icon In List
elseif ($action=="setshippableiconinlist") {
$setshippableiconinlist = GETPOST('value', 'int'); $setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;

View File

@ -136,9 +136,7 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha'))
else dol_syslog($imgThumbMini); else dol_syslog($imgThumbMini);
} }
else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING); else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
} } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$tmparray=explode(':', $result); $tmparray=explode(':', $result);

View File

@ -1436,8 +1436,7 @@ if ($id)
elseif($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth'); elseif($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth');
elseif($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext'); elseif($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext');
$align="center"; $align="center";
} } elseif ($fieldlist[$field]=='price' || preg_match('/^amount/i', $fieldlist[$field])) {
elseif ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) {
$valuetoshow=price($valuetoshow); $valuetoshow=price($valuetoshow);
} }
if ($value == 'private') if ($value == 'private')
@ -1558,9 +1557,7 @@ if ($id)
elseif ($fieldlist[$field]=='taux') { elseif ($fieldlist[$field]=='taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$align="center"; $align="center";
} } elseif (in_array($fieldlist[$field], array('recuperableonly'))) {
elseif (in_array($fieldlist[$field],array('recuperableonly')))
{
$align="center"; $align="center";
} }
elseif ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') { elseif ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
@ -1600,7 +1597,10 @@ if ($id)
} }
// Can an entry be erased or disabled ? // Can an entry be erased or disabled ?
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default // all true by default
$iserasable=1;
$canbedisabled=1;
$canbemodified=1;
if (isset($obj->code) && $id != 10) if (isset($obj->code) && $id != 10)
{ {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; } if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; }

View File

@ -545,7 +545,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> '; print '<strong>' . $form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '</strong> ';
} }
if ($tmpfieldlist == 'content') if ($tmpfieldlist == 'content')
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist); print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
if ($tmpfieldlist == 'content_lines') if ($tmpfieldlist == 'content_lines')
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>'; print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>';
// Input field // Input field

View File

@ -55,10 +55,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg))
{ {
dol_print_error($db); dol_print_error($db);
} }
} } elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
elseif (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg))
{
$code=$reg[1]; $code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{ {

View File

@ -104,9 +104,7 @@ if ($action === 'downloadblockchain') {
echo $bc; echo $bc;
exit; exit;
} } elseif (GETPOST('downloadcsv', 'alpha')) {
elseif (GETPOST('downloadcsv','alpha'))
{
$error = 0; $error = 0;
$previoushash=''; $previoushash='';
@ -438,8 +436,7 @@ print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"],'','',$param,'align="cente
print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList('<span id="blockchainstatus"></span>', 0, $_SERVER["PHP_SELF"], '', '', $param, 'align="center"', $sortfield, $sortorder, '')."\n";
print '</tr>'; print '</tr>';
if (! empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) if (! empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) {
{
// This is version that is faster but require more memory and report errors that are outside the filter range // This is version that is faster but require more memory and report errors that are outside the filter range
// TODO Make a full scan of table in reverse order of id of $block, so we can use the parameter $previoushash into checkSignature to save requests // TODO Make a full scan of table in reverse order of id of $block, so we can use the parameter $previoushash into checkSignature to save requests

View File

@ -1061,8 +1061,7 @@ class ActionComm extends CommonObject
$this->nb=array(); $this->nb=array();
$sql = "SELECT count(a.id) as nb"; $sql = "SELECT count(a.id) as nb";
} }
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= ")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " WHERE 1 = 1"; $sql.= " WHERE 1 = 1";

View File

@ -1428,9 +1428,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
elseif ($event->type_code == 'ICALEVENT') elseif ($event->type_code == 'ICALEVENT')
{ {
$cssclass.= " unmovable"; $cssclass.= " unmovable";
} } elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) {
elseif ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
{
$tmpyearend = date('Y', $event->date_end_in_calendar); $tmpyearend = date('Y', $event->date_end_in_calendar);
$tmpmonthend = date('m', $event->date_end_in_calendar); $tmpmonthend = date('m', $event->date_end_in_calendar);
$tmpdayend = date('d', $event->date_end_in_calendar); $tmpdayend = date('d', $event->date_end_in_calendar);

View File

@ -527,11 +527,11 @@ if (empty($reshook))
if ($action == 'settitre') $object->titre = trim(GETPOST('titre', 'alpha')); if ($action == 'settitre') $object->titre = trim(GETPOST('titre', 'alpha'));
elseif ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from', 'alpha')); elseif ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from', 'alpha'));
elseif ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto', 'alpha')); elseif ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto', 'alpha'));
elseif ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha')); elseif ($action == 'setemail_errorsto') {
elseif ($action == 'settitre' && empty($object->titre)) { $object->email_errorsto = trim(GETPOST('email_errorsto', 'alpha'));
} elseif ($action == 'settitre' && empty($object->titre)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} } elseif ($action == 'setfrom' && empty($object->email_from)) {
elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} }

View File

@ -518,8 +518,7 @@ if ($object->fetch($id) >= 0)
print_liste_field_titre("OtherInformations", $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("OtherInformations", $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Source", $_SERVER["PHP_SELF"], "", $param, "", 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Source", $_SERVER["PHP_SELF"], "", $param, "", 'align="center"', $sortfield, $sortorder);
// Date sending // Date sending
if ($object->statut < 2) if ($object->statut < 2) {
{
print_liste_field_titre(''); print_liste_field_titre('');
} }
else else

View File

@ -319,6 +319,7 @@ class Mailing extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$object->error; $this->error=$object->error;
$this->errors=array_merge($this->errors, $object->errors);
$error++; $error++;
} }

View File

@ -641,8 +641,7 @@ if (empty($reshook))
} }
// Close proposal // Close proposal
elseif ($action == 'setstatut' && $usercanclose && ! GETPOST('cancel','alpha')) elseif ($action == 'setstatut' && $usercanclose && ! GETPOST('cancel', 'alpha')) {
{
if (! (GETPOST('statut', 'int') > 0)) { if (! (GETPOST('statut', 'int') > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'statut'; $action = 'statut';
@ -672,8 +671,7 @@ if (empty($reshook))
} }
// Reopen proposal // Reopen proposal
elseif ($action == 'confirm_reopen' && $usercanclose && ! GETPOST('cancel','alpha')) elseif ($action == 'confirm_reopen' && $usercanclose && ! GETPOST('cancel', 'alpha')) {
{
// prevent browser refresh from reopening proposal several times // prevent browser refresh from reopening proposal several times
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
{ {
@ -1318,16 +1316,13 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha')) {
elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel','alpha'))
{
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }
// Set project
elseif ($action == 'classin' && $usercancreate) { elseif ($action == 'classin' && $usercancreate) {
// Set project
$object->setProject(GETPOST('projectid', 'int')); $object->setProject(GETPOST('projectid', 'int'));
} }

View File

@ -1285,7 +1285,12 @@ class Propal extends CommonObject
// Create clone // Create clone
$object->context['createfromclone']='createfromclone'; $object->context['createfromclone']='createfromclone';
$result=$object->create($user); $result=$object->create($user);
if ($result < 0) $error++; if ($result < 0)
{
$this->error = $object->error;
$this->errors = array_merge($this->errors, $object->errors);
$error++;
}
if (! $error) if (! $error)
{ {

View File

@ -1132,9 +1132,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
} } elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }

View File

@ -121,7 +121,7 @@ function pt($db, $sql, $date)
if ($obj->mode == 'claimed' && ! empty($previousmode)) if ($obj->mode == 'claimed' && ! empty($previousmode))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap">'.$obj->dm."</td>\n"; print '<td class="nowrap">'.$previousmonth."</td>\n";
print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n"; print '<td class="nowrap" align="right">'.price($amountclaimed)."</td>\n";
print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n"; print '<td class="nowrap" align="right">'.price($amountpaid)."</td>\n";
print "</tr>\n"; print "</tr>\n";
@ -271,7 +271,7 @@ $mend = $tmp['mon'];
$total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
$i=0; $mcursor=0; $i=0; $mcursor=0;
while ((($y < $yend) || ($y == $yend && $m < $mend)) && $mcursor < 1000) // $mcursor is to avoid too large loop while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mcursor is to avoid too large loop
{ {
//$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12); //$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12);
if ($m == 13) $y++; if ($m == 13) $y++;
@ -536,7 +536,7 @@ while ((($y < $yend) || ($y == $yend && $m < $mend)) && $mcursor < 1000) // $mcu
if ($i > 2) if ($i > 2)
{ {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>'; print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
print '<td class="nowrap" align="right">'.price(price2num($subtotalcoll, 'MT')).'</td>'; print '<td class="nowrap" align="right">'.price(price2num($subtotalcoll, 'MT')).'</td>';
print '<td class="nowrap" align="right">'.price(price2num($subtotalpaye, 'MT')).'</td>'; print '<td class="nowrap" align="right">'.price(price2num($subtotalpaye, 'MT')).'</td>';
print '<td class="nowrap" align="right">'.price(price2num($subtotal, 'MT')).'</td>'; print '<td class="nowrap" align="right">'.price(price2num($subtotal, 'MT')).'</td>';

View File

@ -40,12 +40,12 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$langs->loadLangs(array('companies', 'bills', 'banks', 'multicurrency')); $langs->loadLangs(array('companies', 'bills', 'banks', 'multicurrency'));
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm', 'alpha');
$facid = GETPOST('facid', 'int'); $facid = GETPOST('facid', 'int');
$socname = GETPOST('socname'); $accountid = GETPOST('accountid', 'int');
$accountid = GETPOST('accountid'); $paymentnum = GETPOST('num_paiement', 'alpha');
$paymentnum = GETPOST('num_paiement'); $socid = GETPOST('socid', 'int');
$sortfield = GETPOST('sortfield', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha');
@ -59,7 +59,6 @@ $multicurrency_amounts=array();
$multicurrency_amountsresttopay=array(); $multicurrency_amountsresttopay=array();
// Security check // Security check
$socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$socid = $user->societe_id; $socid = $user->societe_id;
@ -219,6 +218,9 @@ if (empty($reshook))
$db->begin(); $db->begin();
$thirdparty = new Societe($db);
if ($socid > 0) $thirdparty->fetch($socid);
// Clean parameters amount if payment is for a credit note // Clean parameters amount if payment is for a credit note
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE)
{ {
@ -238,7 +240,7 @@ if (empty($reshook))
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
// Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement // Si module bank actif, un compte est obligatoire lors de la saisie d'un paiement
if (GETPOST('accountid') <= 0) if (GETPOST('accountid', 'int') <= 0)
{ {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('AccountToCredit')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('AccountToCredit')), null, 'errors');
$error++; $error++;
@ -256,7 +258,7 @@ if (empty($reshook))
if (! $error) if (! $error)
{ {
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0), $thirdparty); // This include closing invoices and regenerating documents
if ($paiement_id < 0) if ($paiement_id < 0)
{ {
setEventMessages($paiement->error, $paiement->errors, 'errors'); setEventMessages($paiement->error, $paiement->errors, 'errors');
@ -280,7 +282,7 @@ if (empty($reshook))
{ {
$db->commit(); $db->commit();
// If payment dispatching on more than one invoice, we keep on summary page, otherwise jump on invoice card // If payment dispatching on more than one invoice, we stay on summary page, otherwise jump on invoice card
$invoiceid=0; $invoiceid=0;
foreach ($paiement->amounts as $key => $amount) foreach ($paiement->amounts as $key => $amount)
{ {

View File

@ -222,9 +222,10 @@ class Paiement extends CommonObject
* *
* @param User $user Object user * @param User $user Object user
* @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more * @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more
* @param Societe $thirdparty Thirdparty
* @return int id of created payment, < 0 if error * @return int id of created payment, < 0 if error
*/ */
function create($user, $closepaidinvoices = 0) function create($user, $closepaidinvoices = 0, $thirdparty = null)
{ {
global $conf, $langs; global $conf, $langs;
@ -274,7 +275,7 @@ class Paiement extends CommonObject
$this->db->begin(); $this->db->begin();
$this->ref = $this->getNextNumRef(''); $this->ref = $this->getNextNumRef(is_object($thirdparty)?$thirdparty:'');
if ($way == 'dolibarr') if ($way == 'dolibarr')
{ {
@ -424,6 +425,7 @@ class Paiement extends CommonObject
// Regenerate documents of invoices // Regenerate documents of invoices
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{ {
$newlang='';
$outputlangs = $langs; $outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016 Frédéric France <frederic.france@free.fr> * Copyright (C) 2016-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.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

View File

@ -505,7 +505,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc
if ($i > 2) if ($i > 2)
{ {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>'; print '<td align="right"><a href="quadri_detail.php?leftmenu=tax_vat&q='.round($m/3).'&year='.$y.'">'.$langs->trans("SubTotal").'</a>:</td>';
print '<td class="nowrap" align="right">'.price(price2num($subtotalcoll, 'MT')).'</td>'; print '<td class="nowrap" align="right">'.price(price2num($subtotalcoll, 'MT')).'</td>';
print '<td class="nowrap" align="right">'.price(price2num($subtotalpaye, 'MT')).'</td>'; print '<td class="nowrap" align="right">'.price(price2num($subtotalpaye, 'MT')).'</td>';
print '<td class="nowrap" align="right">'.price(price2num($subtotal, 'MT')).'</td>'; print '<td class="nowrap" align="right">'.price(price2num($subtotal, 'MT')).'</td>';

View File

@ -653,8 +653,7 @@ if (empty($reshook))
} }
} }
elseif ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha')) elseif ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel', 'alpha')) {
{
$error = 0; $error = 0;
if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update) if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update)
@ -1318,6 +1317,8 @@ else
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$soc = $object->thirdparty; // $soc is used later
$result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed
if ($result < 0) { if ($result < 0) {
dol_print_error($db, $object->error); dol_print_error($db, $object->error);

View File

@ -58,7 +58,8 @@ if ($action == 'builddoc' && $permissioncreate)
// Special case to force bank account // Special case to force bank account
//if (property_exists($object, 'fk_bank')) //if (property_exists($object, 'fk_bank'))
//{ //{
if (GETPOST('fk_bank','int')) { // this field may come from an external module if (GETPOST('fk_bank', 'int')) {
// this field may come from an external module
$object->fk_bank = GETPOST('fk_bank', 'int'); $object->fk_bank = GETPOST('fk_bank', 'int');
} elseif (! empty($object->fk_account)) { } elseif (! empty($object->fk_account)) {
$object->fk_bank = $object->fk_account; $object->fk_bank = $object->fk_account;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.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
@ -902,8 +903,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$objecttmp->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$objecttmp->thirdparty->default_lang;
if (! empty($newlang)) if (! empty($newlang)) {
{
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }

View File

@ -59,10 +59,8 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel
if ($result < 0) dol_print_error($db, $result); if ($result < 0) dol_print_error($db, $result);
} }
} }
} } elseif ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel', 'alpha')) {
// Set public note // Set public note
elseif ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel','alpha'))
{
if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before'); if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('', 'Include of actions_setnotes.inc.php was done but required variable was not set before');
if (empty($object->id)) $object->fetch($id); // Fetch may not be already done if (empty($object->id)) $object->fetch($id); // Fetch may not be already done
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES), '_private'); $result=$object->update_note(dol_html_entity_decode(GETPOST('note_private', 'none'), ENT_QUOTES), '_private');

View File

@ -89,8 +89,7 @@ class box_actions extends ModeleBoxes
$sql.= ", s.nom as name"; $sql.= ", s.nom as name";
$sql.= ", s.rowid as socid"; $sql.= ", s.rowid as socid";
$sql.= ", s.code_client"; $sql.= ", s.code_client";
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm AS ta, "; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a";
$sql.= MAIN_DB_PREFIX."actioncomm AS a)";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql.= " WHERE a.fk_action = ta.id"; $sql.= " WHERE a.fk_action = ta.id";

View File

@ -5015,7 +5015,7 @@ abstract class CommonObject
if ($this->array_options[$key] === '') $mandatorypb=true; if ($this->array_options[$key] === '') $mandatorypb=true;
if ($mandatorypb) if ($mandatorypb)
{ {
dol_syslog($this->error); dol_syslog("Mandatory extra field ".$key." is empty");
$this->errors[]=$langs->trans('ErrorFieldRequired', $attributeLabel); $this->errors[]=$langs->trans('ErrorFieldRequired', $attributeLabel);
return -1; return -1;
} }

View File

@ -3830,7 +3830,7 @@ class Form
global $langs,$conf; global $langs,$conf;
global $useglobalvars; global $useglobalvars;
$more=''; $more='<!-- formconfirm -->';
$formconfirm=''; $formconfirm='';
$inputok=array(); $inputok=array();
$inputko=array(); $inputko=array();
@ -3875,7 +3875,7 @@ class Form
elseif ($input['type'] == 'select') elseif ($input['type'] == 'select')
{ {
$more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>'; $more.='<tr><td'.(empty($input['tdclass'])?'':(' class="'.$input['tdclass'].'"')).'>';
if (! empty($input['label'])) $more.=$input['label'].'</td><td class="tdtop left>'; if (! empty($input['label'])) $more.=$input['label'].'</td><td class="tdtop left">';
$more.=$this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); $more.=$this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss);
$more.='</td></tr>'."\n"; $more.='</td></tr>'."\n";
} }

View File

@ -634,8 +634,9 @@ class Menubase
$tab_titre = explode("/", $menu['titre']); $tab_titre = explode("/", $menu['titre']);
$title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]); $title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
} }
elseif (preg_match('/\|\|/',$menu['titre'])) // To manage different translation (Title||AltTitle@ConditionForAltTitle) elseif (preg_match('/\|\|/', $menu['titre']))
{ {
// To manage different translation (Title||AltTitle@ConditionForAltTitle)
$tab_title = explode("||", $menu['titre']); $tab_title = explode("||", $menu['titre']);
$alt_title = explode("@", $tab_title[1]); $alt_title = explode("@", $tab_title[1]);
$title_enabled = verifCond($alt_title[1]); $title_enabled = verifCond($alt_title[1]);

View File

@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
* *
* @param array $versionarray Tableau de version (vermajeur,vermineur,autre) * @param array $versionarray Tableau de version (vermajeur,vermineur,autre)
* @return string Chaine version * @return string Chaine version
* @see versioncompare
*/ */
function versiontostring($versionarray) function versiontostring($versionarray)
{ {
@ -54,6 +55,7 @@ function versiontostring($versionarray)
* @return int -4,-3,-2,-1 if versionarray1<versionarray2 (value depends on level of difference) * @return int -4,-3,-2,-1 if versionarray1<versionarray2 (value depends on level of difference)
* 0 if same * 0 if same
* 1,2,3,4 if versionarray1>versionarray2 (value depends on level of difference) * 1,2,3,4 if versionarray1>versionarray2 (value depends on level of difference)
* @see versiontostring
*/ */
function versioncompare($versionarray1, $versionarray2) function versioncompare($versionarray1, $versionarray2)
{ {

View File

@ -4,6 +4,7 @@
* Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.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
@ -2654,6 +2655,17 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (! empty($conf->productbatch->enabled)) $original_file=$conf->productbatch->multidir_output[$entity].'/'.$original_file; if (! empty($conf->productbatch->enabled)) $original_file=$conf->productbatch->multidir_output[$entity].'/'.$original_file;
} }
// Wrapping for stock movements
elseif ($modulepart == 'movement' || $modulepart == 'mouvement')
{
if (empty($entity) || empty($conf->stock->multidir_output[$entity])) return array('accessallowed'=>0, 'error'=>'Value entity must be provided');
if (($fuser->rights->stock->{$lire} || $fuser->rights->stock->movement->{$lire} || $fuser->rights->stock->mouvement->{$lire}) || preg_match('/^specimen/i', $original_file))
{
$accessallowed=1;
}
if (! empty($conf->stock->enabled)) $original_file=$conf->stock->multidir_output[$entity].'/movement/'.$original_file;
}
// Wrapping pour les contrats // Wrapping pour les contrats
elseif ($modulepart == 'contract' && !empty($conf->contrat->dir_output)) elseif ($modulepart == 'contract' && !empty($conf->contrat->dir_output))
{ {

View File

@ -3089,7 +3089,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$fa='fa'; $fa='fa';
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa='fas'; if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa='fas';
$enabledisablehtml = '<span class="' . $fa . ' ' . $fakey . ' ' . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '') . ' valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" style="' . ($fasize ? ('font-size: ' . $fasize . ';') : '') . ($facolor ? (' color: ' . $facolor . ';') : '') . ($morestyle ? ' ' . $morestyle : '') . '"' . (($notitle || empty($titlealt)) ? '' : ' title="' . dol_escape_htmltag($titlealt) . '"') . ($moreatt ? ' ' . $moreatt : '') . '>'; $enabledisablehtml = '<span class="' . $fa . ' ' . $fakey . ' ' . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '');
$enabledisablehtml .= ' valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" style="' . ($fasize ? ('font-size: ' . $fasize . ';') : '') . ($facolor ? (' color: ' . $facolor . ';') : '') . ($morestyle ? ' ' . $morestyle : '') . '"' . (($notitle || empty($titlealt)) ? '' : ' title="' . dol_escape_htmltag($titlealt) . '"') . ($moreatt ? ' ' . $moreatt : '') . '>';
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$enabledisablehtml.= $titlealt; $enabledisablehtml.= $titlealt;
} }

View File

@ -833,7 +833,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200); $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200);
$newmenu->add("/fichinter/card.php?action=create&amp;leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); $newmenu->add("/fichinter/card.php?action=create&amp;leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
$newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203); if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203);
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
} }
} }

View File

@ -189,6 +189,7 @@ class mod_facture_mars extends ModeleNumRefFactures
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE ref LIKE '".$prefix."____-".$num."'"; $sql.= " WHERE ref LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")"; $sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
$sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -204,6 +204,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE ref LIKE '".$prefix."____-".$num."'"; $sql.= " WHERE ref LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")"; $sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
$sql.= " ORDER BY ref DESC";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -577,8 +577,7 @@ class ImportCsv extends ModeleImports
} }
} }
// If test is just a static regex // If test is just a static regex
elseif (! preg_match('/'.$objimport->array_import_regex[0][$val].'/i',$newval)) elseif (! preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
{
//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>"; //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]);
$this->errors[$error]['type']='REGEX'; $this->errors[$error]['type']='REGEX';

View File

@ -602,10 +602,8 @@ class ImportXlsx extends ModeleImports
$errorforthistable++; $errorforthistable++;
$error++; $error++;
} }
} } elseif (! preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
// If test is just a static regex // If test is just a static regex
elseif (! preg_match('/'.$objimport->array_import_regex[0][$val].'/i',$newval))
{
//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>"; //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
$this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]);
$this->errors[$error]['type']='REGEX'; $this->errors[$error]['type']='REGEX';

View File

@ -210,7 +210,8 @@ class modFacture extends DolibarrModules
$this->export_icon[$r] = 'invoice'; $this->export_icon[$r] = 'invoice';
$this->export_permission[$r] = array(array("facture", "facture", "export", "other")); $this->export_permission[$r] = array(array("facture", "facture", "export", "other"));
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State',
's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode',
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
@ -232,7 +233,7 @@ class modFacture extends DolibarrModules
$this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; $this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
} }
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>"NumericCompute", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>"NumericCompute", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric',
@ -262,7 +263,8 @@ class modFacture extends DolibarrModules
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as cd on s.fk_departement = cd.rowid,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'facture as f'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';
@ -282,7 +284,8 @@ class modFacture extends DolibarrModules
$this->export_icon[$r] = 'invoice'; $this->export_icon[$r] = 'invoice';
$this->export_permission[$r] = array(array("facture", "facture", "export")); $this->export_permission[$r] = array(array("facture", "facture", "export"));
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 'cd.nom'=>'State',
's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode',
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer', 'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
@ -302,7 +305,7 @@ class modFacture extends DolibarrModules
$this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; $this->export_fields_array[$r]['f.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
} }
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 'cd.nom'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date", 'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>'NumericCompute', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status', 'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'none.rest'=>'NumericCompute', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status',
@ -324,7 +327,8 @@ class modFacture extends DolibarrModules
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid,'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c on s.fk_pays = c.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as cd on s.fk_departement = cd.rowid,';
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f'; $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture as f';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON f.fk_projet = pj.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON f.fk_user_author = uc.rowid';

View File

@ -20,11 +20,10 @@
*/ */
/** /**
* \defgroup fournisseur suppliers Module * \defgroup fournisseur Module suppliers
* \brief Module to manage companies and contacts of supplier type
* \file htdocs/core/modules/modFournisseur.class.php * \file htdocs/core/modules/modFournisseur.class.php
* \ingroup fournisseur * \ingroup fournisseur
* \brief Description and activation file for module Fournisseur * \brief Description and activation file for module Supplier
*/ */
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';

View File

@ -18,8 +18,7 @@
*/ */
/** /**
* \defgroup ticket Ticket module * \defgroup ticket Module Ticket
* \brief Ticket module descriptor.
* \file core/modules/modTicket.class.php * \file core/modules/modTicket.class.php
* \ingroup ticket * \ingroup ticket
* \brief Description and activation file for module Ticket * \brief Description and activation file for module Ticket

View File

@ -27,8 +27,7 @@
*/ */
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf)) if (empty($conf) || ! is_object($conf)) {
{
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }

View File

@ -145,7 +145,7 @@ $coldisplay=-1; // We remove first td
} }
$coldisplay++; $coldisplay++;
print '<td align="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht,0,'',0):price($line->subprice,0,'',0)) . '"'; print '<td class="right"><input type="text" class="flat right" size="5" id="price_ht" name="price_ht" value="' . (isset($line->pu_ht)?price($line->pu_ht, 0, '', 0):price($line->subprice, 0, '', 0)) . '"';
if ($line->fk_prev_id != null) print ' readonly'; if ($line->fk_prev_id != null) print ' readonly';
print '></td>'; print '></td>';
@ -156,7 +156,7 @@ $coldisplay=-1; // We remove first td
if ($inputalsopricewithtax) if ($inputalsopricewithtax)
{ {
$coldisplay++; $coldisplay++;
print '<td align="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc,0,'',0):'').'"'; print '<td class="right"><input type="text" class="flat right" size="5" id="price_ttc" name="price_ttc" value="'.(isset($line->pu_ttc)?price($line->pu_ttc, 0, '', 0):'').'"';
if ($line->fk_prev_id != null) print ' readonly'; if ($line->fk_prev_id != null) print ' readonly';
print '></td>'; print '></td>';
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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
@ -28,6 +29,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php'; require_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin","cron","bills","members")); $langs->loadLangs(array("admin","cron","bills","members"));

View File

@ -117,9 +117,8 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
} } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
elseif (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus // Files infected by a virus
{
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
} }
else // Known error else // Known error

View File

@ -841,9 +841,7 @@ if (empty($reshook))
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // To redisplay the form being edited header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // To redisplay the form being edited
exit(); exit();
} }
} } elseif ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
elseif ($action == 'updateline' && $user->rights->expedition->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // To redisplay the form being edited header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // To redisplay the form being edited
exit(); exit();
} }

View File

@ -26,7 +26,7 @@
/** /**
* \file fichinter/card-rec.php * \file fichinter/card-rec.php
* \ingroup fichinter * \ingroup intervention
* \brief Page to show predefined fichinter * \brief Page to show predefined fichinter
*/ */

View File

@ -594,8 +594,7 @@ if (empty($reshook))
/* /*
* Mise a jour d'une ligne d'intervention * Mise a jour d'une ligne d'intervention
*/ */
elseif ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST('save','alpha') == $langs->trans("Save")) elseif ($action == 'updateline' && $user->rights->ficheinter->creer && GETPOST('save', 'alpha') == $langs->trans("Save")) {
{
$objectline = new FichinterLigne($db); $objectline = new FichinterLigne($db);
if ($objectline->fetch($lineid) <= 0) if ($objectline->fetch($lineid) <= 0)
{ {

View File

@ -69,8 +69,9 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) if (! $sortfield)
{ {
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date"; //if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date";
else $sortfield="f.ref"; //else
$sortfield="f.ref";
} }
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
@ -101,17 +102,17 @@ if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall[
// Definition of fields for list // Definition of fields for list
$arrayfields=array( $arrayfields=array(
'f.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'f.ref'=>array('label'=>'Ref', 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.nom'=>array('label'=>'ThirdParty', 'checked'=>1),
'f.fk_project'=>array('label'=>$langs->trans("Project"), 'checked'=>1), 'f.fk_project'=>array('label'=>'Project', 'checked'=>1),
'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1), 'f.fk_contrat'=>array('label'=>'Contract', 'checked'=>1),
'f.description'=>array('label'=>$langs->trans("Description"), 'checked'=>1), 'f.description'=>array('label'=>'Description', 'checked'=>1),
'fd.description'=>array('label'=>"xx", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), 'f.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>500),
'fd.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), 'f.tms'=>array('label'=>'DateModificationShort', 'checked'=>0, 'position'=>500),
'fd.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0), 'f.fk_statut'=>array('label'=>'Status', 'checked'=>1, 'position'=>1000),
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'fd.description'=>array('label'=>"DescriptionOfLine", 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'fd.date'=>array('label'=>'DateOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), 'fd.duree'=>array('label'=>'DurationOfLine', 'checked'=>1, 'enabled'=>empty($conf->global->FICHINTER_DISABLE_DETAILS)?1:0),
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -177,10 +178,22 @@ $companystatic=new Societe($db);
$title=$langs->trans("ListOfInterventions"); $title=$langs->trans("ListOfInterventions");
llxHeader('', $title); llxHeader('', $title);
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$atleastonefieldinlines=0;
foreach($arrayfields as $tmpkey => $tmpval)
{
if (preg_match('/^fd\./', $tmpkey) && ! empty($arrayfields[$tmpkey]['checked']))
{
$atleastonefieldinlines++;
break;
}
}
$sql = "SELECT"; $sql = "SELECT";
$sql.= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; $sql.= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,";
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " fd.description as descriptiondetail, fd.date as dp, fd.duree,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
$sql.= " s.nom as name, s.rowid as socid, s.client"; $sql.= " s.nom as name, s.rowid as socid, s.client";
// Add fields from extrafields // Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
@ -190,7 +203,7 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f"; $sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinter_extrafields as ef on (f.rowid = ef.fk_object)";
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE f.entity IN (".getEntity('intervention').")"; $sql.= " WHERE f.entity IN (".getEntity('intervention').")";
@ -254,16 +267,16 @@ if ($resql)
} }
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($sall) $urlparam.="&sall=".$sall; if ($sall) $param.="&sall=".urlencode($sall);
if ($socid) $param.="&socid=".$socid; if ($socid) $param.="&socid=".urlencode($socid);
if ($search_ref) $param.="&search_ref=".urlencode($search_ref); if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
if ($search_company) $param.="&search_company=".urlencode($search_company); if ($search_company) $param.="&search_company=".urlencode($search_company);
if ($search_desc) $param.="&search_desc=".urlencode($search_desc); if ($search_desc) $param.="&search_desc=".urlencode($search_desc);
if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status); if ($search_status != '' && $search_status > -1) $param.="&search_status=".urlencode($search_status);
if ($show_files) $param.='&show_files=' .$show_files; if ($show_files) $param.='&show_files='.urlencode($show_files);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -324,8 +337,6 @@ if ($resql)
print '</div>'; print '</div>';
} }
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
@ -350,19 +361,6 @@ if ($resql)
print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">'; print '<input type="text" class="flat" name="search_desc" value="'.$search_desc.'" size="12">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['fd.description']['checked']))
{
// Desc of line
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -392,6 +390,19 @@ if ($resql)
print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1); print $form->selectarray('search_status', $liststatus, $search_status, 1, 0, 0, '', 1);
print '</td>'; print '</td>';
} }
// Fields of detail line
if (! empty($arrayfields['fd.description']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>';
}
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
@ -400,21 +411,21 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'], $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre("Description",$_SERVER["PHP_SELF"],"f.description","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.description']['checked'])) print_liste_field_titre($arrayfields['f.description']['label'], $_SERVER["PHP_SELF"], "f.description", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre('',$_SERVER["PHP_SELF"],'');
if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"fd.date","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre("Duration",$_SERVER["PHP_SELF"],"fd.duree","",$param,'align="right"',$sortfield,$sortorder);
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre("DateCreationShort",$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre("DateModificationShort",$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"f.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['fd.description']['checked'])) print_liste_field_titre($arrayfields['fd.description']['label'], $_SERVER["PHP_SELF"], '');
if (! empty($arrayfields['fd.date']['checked'])) print_liste_field_titre($arrayfields['fd.date']['label'], $_SERVER["PHP_SELF"], "fd.date", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['fd.duree']['checked'])) print_liste_field_titre($arrayfields['fd.duree']['label'], $_SERVER["PHP_SELF"], "fd.duree", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -483,24 +494,6 @@ if ($resql)
print '<td>'.dol_trunc(dolGetFirstLineOfText($obj->description), 48).'</td>'; print '<td>'.dol_trunc(dolGetFirstLineOfText($obj->description), 48).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['fd.description']['checked']))
{
//print '<td>'.dol_trunc(dol_escape_htmltag(dolGetFirstLineOfText($obj->descriptiondetail)),48).'</td>';
print '<td>'.dolGetFirstLineOfText($obj->descriptiondetail).'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->dp),'dayhour')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td align="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
$totalarray['totalduration']+=$obj->duree;
}
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
@ -530,6 +523,24 @@ if ($resql)
print '<td align="right">'.$objectstatic->LibStatut($obj->fk_statut, 5).'</td>'; print '<td align="right">'.$objectstatic->LibStatut($obj->fk_statut, 5).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Fields of detail of line
if (! empty($arrayfields['fd.description']['checked']))
{
print '<td>'.dolGetFirstLineOfText($obj->descriptiondetail).'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.date']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->dp), 'dayhour')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['fd.duree']['checked']))
{
print '<td align="right">'.convertSecondToTime($obj->duree, 'allhourmin').'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totaldurationfield']=$totalarray['nbfield'];
$totalarray['totalduration']+=$obj->duree;
}
// Action column // Action column
print '<td class="nowrap" align="center">'; print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined

View File

@ -3293,6 +3293,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
if (!empty($objp))
{
$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;
@ -3338,6 +3340,13 @@ class CommandeFournisseurLigne extends CommonOrderLine
return 1; return 1;
} }
else else
{
$this->error='Supplier order line with id='.$rowid.' not found';
dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR);
return 0;
}
}
else
{ {
dol_print_error($this->db); dol_print_error($this->db);
return -1; return -1;

View File

@ -143,9 +143,10 @@ class PaiementFourn extends Paiement
* *
* @param User $user Object of creating user * @param User $user Object of creating user
* @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more * @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more
* @param Societe $thirdparty Thirdparty
* @return int id of created payment, < 0 if error * @return int id of created payment, < 0 if error
*/ */
function create($user, $closepaidinvoices = 0) function create($user, $closepaidinvoices = 0, $thirdparty = null)
{ {
global $langs,$conf; global $langs,$conf;
@ -186,7 +187,7 @@ class PaiementFourn extends Paiement
if ($totalamount <> 0) // On accepte les montants negatifs if ($totalamount <> 0) // On accepte les montants negatifs
{ {
$ref = $this->getNextNumRef(''); $ref = $this->getNextNumRef(is_object($thirdparty)?$thirdparty:'');
$now=dol_now(); $now=dol_now();
if ($way == 'dolibarr') if ($way == 'dolibarr')
@ -245,6 +246,7 @@ class PaiementFourn extends Paiement
// Regenerate documents of invoices // Regenerate documents of invoices
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{ {
$newlang='';
$outputlangs = $langs; $outputlangs = $langs;
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $invoice->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {

View File

@ -1239,9 +1239,7 @@ if (empty($reshook))
setEventMessages($langs->trans("ErrorWebServicesFieldsRequired"), null, 'errors'); setEventMessages($langs->trans("ErrorWebServicesFieldsRequired"), null, 'errors');
} elseif (empty($ws_user) || empty($ws_password) || empty($ws_thirdparty)) { } elseif (empty($ws_user) || empty($ws_password) || empty($ws_thirdparty)) {
setEventMessages($langs->trans("ErrorFieldsRequired"), null, 'errors'); setEventMessages($langs->trans("ErrorFieldsRequired"), null, 'errors');
} } else {
else
{
//Create SOAP client and connect it to order //Create SOAP client and connect it to order
$soapclient_order = new nusoap_client($ws_url."/webservices/server_order.php"); $soapclient_order = new nusoap_client($ws_url."/webservices/server_order.php");
$soapclient_order->soap_defencoding='UTF-8'; $soapclient_order->soap_defencoding='UTF-8';

View File

@ -60,18 +60,18 @@ $search_deliveryday=GETPOST("search_deliveryday","int");
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_product_category=GETPOST('search_product_category', 'int'); $search_product_category=GETPOST('search_product_category', 'int');
$search_ref=GETPOST('search_ref'); $search_ref=GETPOST('search_ref', 'alpha');
$search_refsupp=GETPOST('search_refsupp'); $search_refsupp=GETPOST('search_refsupp', 'alpha');
$search_company=GETPOST('search_company', 'alpha'); $search_company=GETPOST('search_company', 'alpha');
$search_town=GETPOST('search_town', 'alpha'); $search_town=GETPOST('search_town', 'alpha');
$search_zip=GETPOST('search_zip', 'alpha'); $search_zip=GETPOST('search_zip', 'alpha');
$search_state=trim(GETPOST("search_state")); $search_state=trim(GETPOST("search_state", 'alpha'));
$search_country=GETPOST("search_country", 'int'); $search_country=GETPOST("search_country", 'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int');
$search_user=GETPOST('search_user', 'int'); $search_user=GETPOST('search_user', 'int');
$search_request_author=GETPOST('search_request_author', 'alpha'); $search_request_author=GETPOST('search_request_author', 'alpha');
$search_ht=GETPOST('search_ht'); $search_ht=GETPOST('search_ht', 'alpha');
$search_ttc=GETPOST('search_ttc'); $search_ttc=GETPOST('search_ttc', 'alpha');
$search_status=(GETPOST('search_status', 'alpha')!=''?GETPOST('search_status', 'alpha'):GETPOST('statut', 'alpha')); // alpha and not intbecause it can be '6,7' $search_status=(GETPOST('search_status', 'alpha')!=''?GETPOST('search_status', 'alpha'):GETPOST('statut', 'alpha')); // alpha and not intbecause it can be '6,7'
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');

View File

@ -42,10 +42,10 @@ $langs->loadLangs(array('companies', 'bills', 'banks', 'compta'));
// Security check // Security check
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm'); $confirm = GETPOST('confirm', 'alpha');
$facid = GETPOST('facid', 'int'); $facid = GETPOST('facid', 'int');
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$accountid = GETPOST('accountid'); $accountid = GETPOST('accountid', 'int');
$day = GETPOST('day', 'int'); $day = GETPOST('day', 'int');
$month = GETPOST('month', 'int'); $month = GETPOST('month', 'int');
$year = GETPOST('year', 'int'); $year = GETPOST('year', 'int');
@ -253,6 +253,9 @@ if (empty($reshook))
{ {
$db->begin(); $db->begin();
$thirdparty = new Societe($db);
if ($socid > 0) $thirdparty->fetch($socid);
// Creation de la ligne paiement // Creation de la ligne paiement
$paiement = new PaiementFourn($db); $paiement = new PaiementFourn($db);
$paiement->datepaye = $datepaye; $paiement->datepaye = $datepaye;
@ -263,7 +266,7 @@ if (empty($reshook))
$paiement->note = $_POST['comment']; $paiement->note = $_POST['comment'];
if (! $error) if (! $error)
{ {
$paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0)); $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0), $thirdparty);
if ($paiement_id < 0) if ($paiement_id < 0)
{ {
setEventMessages($paiement->error, $paiement->errors, 'errors'); setEventMessages($paiement->error, $paiement->errors, 'errors');
@ -285,7 +288,7 @@ if (empty($reshook))
{ {
$db->commit(); $db->commit();
// If payment dispatching on more than one invoice, we keep on summary page, otherwise go on invoice card // If payment dispatching on more than one invoice, we stay on summary page, otherwise go on invoice card
$invoiceid=0; $invoiceid=0;
foreach ($paiement->amounts as $key => $amount) foreach ($paiement->amounts as $key => $amount)
{ {
@ -770,8 +773,7 @@ if (empty($action))
if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid; if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
// Search criteria // Search criteria
if ($month > 0) if ($month > 0) {
{
if ($year > 0 && empty($day)) if ($year > 0 && empty($day))
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'"; $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'";
elseif ($year > 0 && ! empty($day)) elseif ($year > 0 && ! empty($day))

View File

@ -106,9 +106,8 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
} } elseif (preg_match('/ErrorFileIsInfectedWithAVirus/', $resupload)) {
elseif (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus // Files infected by a virus
{
setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors');
} }
else // Known error else // Known error

View File

@ -54,3 +54,4 @@ Paymentnumpad=Payment Num Pad
Numberspad=Numbers Pad Numberspad=Numbers Pad
BillsCoinsPad=Bills and Coins Pad BillsCoinsPad=Bills and Coins Pad
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
TakeposNeedsCategories=TakePOS needs product categories to work

View File

@ -222,6 +222,9 @@ Info=Log
Family=Family Family=Family
Description=Description Description=Description
Designation=Description Designation=Description
DescriptionOfLine=Description of line
DateOfLine=Date of line
DurationOfLine=Duration of line
Model=Doc template Model=Doc template
DefaultModel=Default doc template DefaultModel=Default doc template
Action=Event Action=Event

View File

@ -156,8 +156,8 @@ DocForAllMembersCards=Generate business cards for all members
DocForOneMemberCards=Generate business cards for a particular member DocForOneMemberCards=Generate business cards for a particular member
DocForLabels=Generate address sheets DocForLabels=Generate address sheets
SubscriptionPayment=Subscription payment SubscriptionPayment=Subscription payment
LastSubscriptionDate=Latest subscription date LastSubscriptionDate=Date of latest subscription payment
LastSubscriptionAmount=Latest subscription amount LastSubscriptionAmount=Amount of latest subscription
MembersStatisticsByCountries=Members statistics by country MembersStatisticsByCountries=Members statistics by country
MembersStatisticsByState=Members statistics by state/province MembersStatisticsByState=Members statistics by state/province
MembersStatisticsByTown=Members statistics by town MembersStatisticsByTown=Members statistics by town
@ -195,3 +195,4 @@ NoEmailSentToMember=No email sent to member
EmailSentToMember=Email sent to member at %s EmailSentToMember=Email sent to member at %s
SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired subscription SendReminderForExpiredSubscriptionTitle=Send reminder by email for expired subscription
SendReminderForExpiredSubscription=Send reminder by email to members when subscription is about to expire (parameter is number of days before end of subscription to send the remind. It can be a list of days separated by a semicolon, for example '10;5;0;-5') SendReminderForExpiredSubscription=Send reminder by email to members when subscription is about to expire (parameter is number of days before end of subscription to send the remind. It can be a list of days separated by a semicolon, for example '10;5;0;-5')
MembershipPaid=Membership paid for current period (until %s)

View File

@ -147,7 +147,7 @@ CloneProduct=Clone product or service
ConfirmCloneProduct=Are you sure you want to clone product or service <b>%s</b>? ConfirmCloneProduct=Are you sure you want to clone product or service <b>%s</b>?
CloneContentProduct=Clone all main information of product/service CloneContentProduct=Clone all main information of product/service
ClonePricesProduct=Clone prices ClonePricesProduct=Clone prices
CloneCompositionProduct=Clone packaged product/service CloneCompositionProduct=Clone virtual product/service
CloneCombinationsProduct=Clone product variants CloneCombinationsProduct=Clone product variants
ProductIsUsed=This product is used ProductIsUsed=This product is used
NewRefForClone=Ref. of new product/service NewRefForClone=Ref. of new product/service

View File

@ -237,4 +237,9 @@ SendProjectRef=Information project %s
ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Salaries' must be enabled to define employee hourly rate to have time spent valorized ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Salaries' must be enabled to define employee hourly rate to have time spent valorized
NewTaskRefSuggested=Task ref already used, a new task ref is required NewTaskRefSuggested=Task ref already used, a new task ref is required
TimeSpentInvoiced=Time spent billed TimeSpentInvoiced=Time spent billed
TimeSpentForInvoice=Time spent
GenerateInvoice=Generate invoice GenerateInvoice=Generate invoice
OneLinePerUser=One line per user
ServiceToUseOnLines=Service to use on lines
InvoiceGeneratedFromTimeSpent=Invoice %s has been generated from time spent on project
ProjectBillTimeDescription=Check if you enter timesheet on tasks of project and plan to generate invoice(s) from the timesheet to invoice the customer of project.

View File

@ -133,8 +133,7 @@ unset($conf->db->pass); // This is to avoid password to be shown in memory/sw
/* /*
* Object $user * Object $user
*/ */
if (! defined('NOREQUIREUSER')) if (! defined('NOREQUIREUSER')) {
{
$user = new User($db); $user = new User($db);
} }

View File

@ -15,6 +15,7 @@
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr> * Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.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
@ -1176,8 +1177,7 @@ else
// Accountancy_code_sell // Accountancy_code_sell
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td>'; print '<td>';
if($type = 0) if($type = 0) {
{
$accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT); $accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
} else { } else {
$accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT); $accountancy_code_sell = (GETPOST('accountancy_code_sell', 'alpha')?(GETPOST('accountancy_code_sell', 'alpha')):$conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT);
@ -1190,8 +1190,7 @@ else
{ {
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
print '<td>'; print '<td>';
if($type = 0) if($type = 0) {
{
$accountancy_code_sell_intra = (GETPOST('accountancy_code_sell_intra', 'alpha')?(GETPOST('accountancy_code_sell_intra', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT); $accountancy_code_sell_intra = (GETPOST('accountancy_code_sell_intra', 'alpha')?(GETPOST('accountancy_code_sell_intra', 'alpha')):$conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT);
} else { } else {
$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha'); $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha');
@ -1228,8 +1227,7 @@ else
if ($conf->global->MAIN_FEATURES_LEVEL) if ($conf->global->MAIN_FEATURES_LEVEL)
{ {
// Accountancy_code_sell_intra // Accountancy_code_sell_intra
if ($mysoc->isInEEC()) if ($mysoc->isInEEC()) {
{
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">'; print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">';
print '</td></tr>'; print '</td></tr>';

View File

@ -356,6 +356,7 @@ class Productbatch extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$object->error; $this->error=$object->error;
$this->errors=array_merge($this->errors, $object->errors);
$error++; $error++;
} }

View File

@ -924,6 +924,7 @@ class Productcustomerprice extends CommonObject
// Other options // Other options
if ($result < 0) { if ($result < 0) {
$this->error = $object->error; $this->error = $object->error;
$this->errors=array_merge($this->errors, $object->errors);
$error++; $error++;
} }

View File

@ -589,6 +589,7 @@ class Propalmergepdfproduct extends CommonObject
if ($result < 0) if ($result < 0)
{ {
$this->error=$object->error; $this->error=$object->error;
$this->errors=array_merge($this->errors, $object->errors);
$error++; $error++;
} }

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2016 Charlie BENKE <charlie@patas-monkey.com> * Copyright (C) 2014-2016 Charlie BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Pierre Ardoin <mapiolca@me.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
@ -172,12 +173,12 @@ $total=0;
if ($type == '0') if ($type == '0')
{ {
print $statProducts; print $statProducts;
$total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]); $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2])+round($prodser[0][3]);
} }
elseif ($type == '1') elseif ($type == '1')
{ {
print $statServices; print $statServices;
$total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2]); $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[1][3]);
} }
else else
{ {

View File

@ -327,6 +327,16 @@ class Entrepot extends CommonObject
{ {
global $conf; global $conf;
dol_syslog(get_class($this)."::fetch id=".$id." ref=".$ref);
// Check parameters
if (! $id && ! $ref)
{
$this->error='ErrorWrongParameters';
dol_syslog(get_class($this)."::fetch ".$this->error);
return -1;
}
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id"; $sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id) if ($id)
@ -339,7 +349,6 @@ class Entrepot extends CommonObject
if ($ref) $sql.= " AND ref = '".$this->db->escape($ref)."'"; if ($ref) $sql.= " AND ref = '".$this->db->escape($ref)."'";
} }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {

View File

@ -622,7 +622,10 @@ if ($action == 'create' && $user->rights->projet->creer)
// Bill time // Bill time
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{ {
print '<tr><td>'.$langs->trans("BillTime").'</td>'; print '<tr><td>';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '</td>';
print '<td><input type="checkbox" name="bill_time"'.(GETPOST('bill_time', 'alpha')!=''?' checked="checked"':'').'"></td>'; print '<td><input type="checkbox" name="bill_time"'.(GETPOST('bill_time', 'alpha')!=''?' checked="checked"':'').'"></td>';
print '</tr>'; print '</tr>';
} }
@ -857,7 +860,10 @@ elseif ($object->id > 0)
// Bill time // Bill time
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{ {
print '<tr><td>'.$langs->trans("BillTime").'</td>'; print '<tr><td>';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '</td>';
print '<td><input type="checkbox" name="bill_time"'.((GETPOSTISSET('bill_time')?GETPOST('bill_time', 'alpha'):$object->bill_time) ? ' checked="checked"' : '').'"></td>'; print '<td><input type="checkbox" name="bill_time"'.((GETPOSTISSET('bill_time')?GETPOST('bill_time', 'alpha'):$object->bill_time) ? ' checked="checked"' : '').'"></td>';
print '</tr>'; print '</tr>';
} }
@ -987,7 +993,10 @@ elseif ($object->id > 0)
// Bill time // Bill time
if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT)) if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_BILL_TIME_SPENT))
{ {
print '<tr><td>'.$langs->trans("BillTime").'</td>'; print '<tr><td>';
$htmltext = $langs->trans("ProjectBillTimeDescription");
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '</td>';
print '<td>'.yn($object->bill_time).'</td>'; print '<td>'.yn($object->bill_time).'</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -722,18 +722,14 @@ class Project extends CommonObject
} }
} }
if (empty($error)) if (empty($error)) {
{
// We remove directory // We remove directory
$projectref = dol_sanitizeFileName($this->ref); $projectref = dol_sanitizeFileName($this->ref);
if ($conf->projet->dir_output) if ($conf->projet->dir_output) {
{
$dir = $conf->projet->dir_output . "/" . $projectref; $dir = $conf->projet->dir_output . "/" . $projectref;
if (file_exists($dir)) if (file_exists($dir)) {
{
$res = @dol_delete_dir_recursive($dir); $res = @dol_delete_dir_recursive($dir);
if (!$res) if (!$res) {
{
$this->errors[] = 'ErrorFailToDeleteDir'; $this->errors[] = 'ErrorFailToDeleteDir';
$error++; $error++;
} }
@ -955,48 +951,37 @@ class Project extends CommonObject
// phpcs:enable // phpcs:enable
global $langs; global $langs;
if ($mode == 0) if ($mode == 0) {
{
return $langs->trans($this->statuts_long[$statut]); return $langs->trans($this->statuts_long[$statut]);
} } elseif ($mode == 1) {
if ($mode == 1)
{
return $langs->trans($this->statuts_short[$statut]); return $langs->trans($this->statuts_short[$statut]);
} } elseif ($mode == 2) {
if ($mode == 2)
{
if ($statut == 0) if ($statut == 0)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_short[$statut]);
if ($statut == 1) elseif ($statut == 1)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_short[$statut]);
if ($statut == 2) elseif ($statut == 2)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_short[$statut]);
} } elseif ($mode == 3) {
if ($mode == 3)
{
if ($statut == 0) if ($statut == 0)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0'); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0');
if ($statut == 1) elseif ($statut == 1)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4'); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4');
if ($statut == 2) elseif ($statut == 2)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6'); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6');
} } elseif ($mode == 4) {
if ($mode == 4)
{
if ($statut == 0) if ($statut == 0)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_long[$statut]); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut0') . ' ' . $langs->trans($this->statuts_long[$statut]);
if ($statut == 1) elseif ($statut == 1)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_long[$statut]); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut4') . ' ' . $langs->trans($this->statuts_long[$statut]);
if ($statut == 2) if ($statut == 2)
return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_long[$statut]); return img_picto($langs->trans($this->statuts_long[$statut]), 'statut6') . ' ' . $langs->trans($this->statuts_long[$statut]);
} } elseif ($mode == 5) {
if ($mode == 5)
{
if ($statut == 0) if ($statut == 0)
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut0'); return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut0');
if ($statut == 1) elseif ($statut == 1)
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut4'); return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut4');
if ($statut == 2) elseif ($statut == 2)
return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut6'); return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_long[$statut]), 'statut6');
} }
} }

View File

@ -1226,6 +1226,7 @@ class Task extends CommonObject
$sql.= " t.task_date_withhour,"; $sql.= " t.task_date_withhour,";
$sql.= " t.task_duration,"; $sql.= " t.task_duration,";
$sql.= " t.fk_user,"; $sql.= " t.fk_user,";
$sql.= " t.thm,";
$sql.= " t.note"; $sql.= " t.note";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql.= " WHERE t.rowid = ".$id; $sql.= " WHERE t.rowid = ".$id;
@ -1245,6 +1246,7 @@ class Task extends CommonObject
$this->timespent_withhour = $obj->task_date_withhour; $this->timespent_withhour = $obj->task_date_withhour;
$this->timespent_duration = $obj->task_duration; $this->timespent_duration = $obj->task_duration;
$this->timespent_fk_user = $obj->fk_user; $this->timespent_fk_user = $obj->fk_user;
$this->timespent_thm = $obj->thm; // hourly rate
$this->timespent_note = $obj->note; $this->timespent_note = $obj->note;
} }

View File

@ -969,9 +969,9 @@ foreach ($listofreferent as $key => $value)
// Third party or user // Third party or user
print '<td class="left">'; print '<td class="left">';
if (is_object($element->thirdparty)) print $element->thirdparty->getNomUrl(1,'',48); if (is_object($element->thirdparty)) {
elseif ($tablename == 'expensereport_det') print $element->thirdparty->getNomUrl(1, '', 48);
{ } elseif ($tablename == 'expensereport_det') {
$tmpuser=new User($db); $tmpuser=new User($db);
$tmpuser->fetch($expensereport->fk_user_author); $tmpuser->fetch($expensereport->fk_user_author);
print $tmpuser->getNomUrl(1, '', 48); print $tmpuser->getNomUrl(1, '', 48);

View File

@ -301,12 +301,11 @@ elseif (GETPOST('project_ref','alpha'))
$withproject=1; $withproject=1;
} }
if ($massaction == 'confirm_generateinvoice') if ($action == 'confirm_generateinvoice')
{ {
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
//->fetch_thirdparty(); //->fetch_thirdparty();
if (! ($projectstatic->thirdparty->id > 0)) if (! ($projectstatic->thirdparty->id > 0))
{ {
setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors');
@ -323,43 +322,85 @@ if ($massaction == 'confirm_generateinvoice')
$fuser = new User($db); $fuser = new User($db);
$db->begin(); $db->begin();
$idprod = GETPOST('productid', 'int');
$idprod = GETPOST('idprod', 'int');
if ($idprod > 0) if ($idprod > 0)
{ {
$tmpproduct->fetch($idprod); $tmpproduct->fetch($idprod);
}
$dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0);
$pu_ht = $dataforprice['pu_ht']; $pu_ht = empty($dataforprice['pu_ht'])?0:$dataforprice['pu_ht'];
$txtva = $dataforprice['tva_tx']; $txtva = $dataforprice['tva_tx'];
$localtax1 = $dataforprice['localtax1'];
$localtax2 = $dataforprice['localtax2'];
}
else
{
$pu_ht = 0;
$txtva = get_default_tva($mysoc, $projectstatic->thirdparty);
$localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1);
$localtax2 = get_default_localtax($mysoc, $projectstatic->thirdparty, 2);
}
$tmpinvoice->fk_soc = $projectstatic->thirdparty->id; $tmpinvoice->socid = $projectstatic->thirdparty->id;
$tmpinvoice->create($user); $tmpinvoice->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$tmpinvoice->fk_project = $projectstatic->id;
$result = $tmpinvoice->create($user);
if ($result <= 0)
{
$error++;
setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors');
}
if (! $error)
{
$arrayoftasks=array(); $arrayoftasks=array();
foreach($toselect as $key => $value) foreach($toselect as $key => $value)
{ {
// Get userid, timepent // Get userid, timepent
$object->fetchTimeSpent($value); $object->fetchTimeSpent($value);
$arrayoftasks[$object->timespent_fk_user]['timespent']+=$object->timespent_duration; $arrayoftasks[$object->timespent_fk_user]['timespent']+=$object->timespent_duration;
$arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600']+=($object->timespent_duration * $object->timespent_thm);
} }
foreach($arrayoftasks as $userid => $value) foreach($arrayoftasks as $userid => $value)
{ {
$fuser->fetch($userid); $fuser->fetch($userid);
//$pu_ht = $value['timespent'] * $fuser->thm; //$pu_ht = $value['timespent'] * $fuser->thm;
$username = $fuser->getFullName($langs); $username = $fuser->getFullName($langs);
// Add lines // Define qty per hour
$tmpinvoice->addline($langs->trans("TotalOfTimeSpentBy", $username).' : '.$value['timespent'], $pu_ht, 1, $txtva); $qtyhour = round($value['timespent'] / 3600, 2);
$qtyhourtext = convertSecondToTime($value['timespent']);
// If no unit price known
if (empty($pu_ht))
{
$pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU');
} }
setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $tmpinvoice->ref), null, 'mesgs'); // Add lines
//var_dump($tmpinvoice); $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0));
// Update lineid into line of timespent
$sql ='UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id;
$sql.=' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid;
$result = $db->query($sql);
if (! $result)
{
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
}
}
}
if (! $error) if (! $error)
{ {
$urltoinvoice = $tmpinvoice->getNomUrl(0);
setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $urltoinvoice), null, 'mesgs');
//var_dump($tmpinvoice);
$db->commit(); $db->commit();
} }
else else
@ -802,6 +843,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
if ($action == 'editline') print '<input type="hidden" name="action" value="updateline">'; if ($action == 'editline') print '<input type="hidden" name="action" value="updateline">';
elseif ($action == 'splitline') print '<input type="hidden" name="action" value="updatesplitline">'; elseif ($action == 'splitline') print '<input type="hidden" name="action" value="updatesplitline">';
elseif ($action == 'createtime' && empty($id) && $user->rights->projet->lire) print '<input type="hidden" name="action" value="addtimespent">'; elseif ($action == 'createtime' && empty($id) && $user->rights->projet->lire) print '<input type="hidden" name="action" value="addtimespent">';
elseif ($massaction == 'generateinvoice' && empty($id) && $user->rights->facture->lire) print '<input type="hidden" name="action" value="confirm_generateinvoice">';
else print '<input type="hidden" name="action" value="list">'; else print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -827,11 +869,20 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print $form->selectDate('', '', '', '', '', '', 1, 1); print $form->selectDate('', '', '', '', '', '', 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr>';
print '<td>';
print $langs->trans('Mode');
print '</td>';
print '<td>';
$tmparray=array('onelineperuser'=>'OneLinePerUser');
print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1);
print '</td>';
print '</tr>';
if ($conf->service->enabled) if ($conf->service->enabled)
{ {
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print $langs->trans('Service'); print $langs->trans('ServiceToUseOnLines');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500'); print $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500');
@ -1125,6 +1176,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
print "</tr>\n"; print "</tr>\n";
$tasktmp = new Task($db); $tasktmp = new Task($db);
$tmpinvoice = new Facture($db);
$i = 0; $i = 0;
@ -1281,9 +1333,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
{ {
if ($task_time->invoice_id) if ($task_time->invoice_id)
{ {
$tmpinvoice->fetch($task_time->invoice_id); $result = $tmpinvoice->fetch($task_time->invoice_id);
if ($result > 0)
{
print $tmpinvoice->getNomUrl(1); print $tmpinvoice->getNomUrl(1);
} }
}
else else
{ {
print $langs->trans("No"); print $langs->trans("No");

View File

@ -1319,6 +1319,13 @@ if ($source == 'membersubscription')
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($member->ref).'">'; print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($member->ref).'">';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
if ($object->datefin > 0)
{
print '<tr class="CTableRow'.($var?'1':'2').'"><td class="CTableRow'.($var?'1':'2').'">'.$langs->trans("DateEndSubscription");
print '</td><td class="CTableRow'.($var?'1':'2').'">'.dol_print_date($member->datefin,'day');
print '</td></tr>'."\n";
}
if ($member->last_subscription_date || $member->last_subscription_amount) if ($member->last_subscription_date || $member->last_subscription_amount)
{ {
// Last subscription date // Last subscription date
@ -1589,16 +1596,19 @@ if ($action != 'dopayment')
{ {
print '<br><br><span class="amountpaymentcomplete">'.$langs->trans("InvoicePaid").'</span>'; print '<br><br><span class="amountpaymentcomplete">'.$langs->trans("InvoicePaid").'</span>';
} }
elseif ($source == 'membersubscription' && $object->datefin > dol_now())
{
print '<br><br><span class="amountpaymentcomplete">'.$langs->trans("MembershipPaid").'</span>';
}
elseif ($source == 'donation' && $object->paid) elseif ($source == 'donation' && $object->paid)
{ {
print '<br><br><span class="amountpaymentcomplete">'.$langs->trans("DonationPaid").'</span>'; print '<br><br><span class="amountpaymentcomplete">'.$langs->trans("DonationPaid").'</span>';
} }
else else
{ {
// Membership can be paid and we still allow to make renewal
if ($source == 'membersubscription' && $object->datefin > dol_now())
{
$langs->load("members");
print '<br><span class="amountpaymentcomplete">'.$langs->trans("MembershipPaid", dol_print_date($object->datefin, 'day')).'</span><br>';
}
// Buttons for all payments registration methods // Buttons for all payments registration methods
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled))

View File

@ -687,9 +687,7 @@ if (empty($reshook))
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }
} } elseif ($action == 'updateline' && $user->rights->reception->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
elseif ($action == 'updateline' && $user->rights->reception->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
exit(); exit();
} }

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net> /* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.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
@ -59,8 +60,7 @@ $stripe = new Stripe($db);
llxHeader('', $langs->trans("StripePayoutList")); llxHeader('', $langs->trans("StripePayoutList"));
if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha'))) if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) {
{
$service = 'StripeTest'; $service = 'StripeTest';
$servicestatus = '0'; $servicestatus = '0';
dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
@ -80,8 +80,9 @@ $stripeacc = $stripe->getStripeAccount($service);
if (! $rowid) { if (! $rowid) {
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
if ($optioncss != '') if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
}
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">'; print '<input type="hidden" name="action" value="list">';
@ -207,16 +208,17 @@ if (! $rowid) {
print "<td align=\"right\">" . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "</td>"; print "<td align=\"right\">" . price(($payout->fee) / 100, 0, '', 1, - 1, - 1, strtoupper($payout->currency)) . "</td>";
// Status // Status
print "<td align='right'>"; print "<td align='right'>";
if ($payout->status=='paid') if ($payout->status=='paid') {
{print img_picto($langs->trans("".$payout->status.""),'statut4');} print img_picto($langs->trans("".$payout->status.""), 'statut4');
elseif ($payout->status=='pending') } elseif ($payout->status=='pending') {
{print img_picto($langs->trans("".$payout->status.""),'statut7');} print img_picto($langs->trans("".$payout->status.""), 'statut7');
elseif ($payout->status=='in_transit') } elseif ($payout->status=='in_transit') {
{print img_picto($langs->trans("".$payout->status.""),'statut7');} print img_picto($langs->trans("".$payout->status.""), 'statut7');
elseif ($payout->status=='failed') } elseif ($payout->status=='failed') {
{print img_picto($langs->trans("".$payout->status.""),'statut7');} print img_picto($langs->trans("".$payout->status.""), 'statut7');
elseif ($payout->status=='canceled') } elseif ($payout->status=='canceled') {
{print img_picto($langs->trans("".$payout->status.""),'statut8');} print img_picto($langs->trans("".$payout->status.""), 'statut8');
}
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -1800,7 +1800,7 @@ if ($action == 'create')
} }
// Create an order // Create an order
if (! empty($conf->commande->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) { if (! empty($conf->fournisseur->enabled) && $object->statut == SupplierProposal::STATUS_SIGNED) {
if ($user->rights->fournisseur->commande->creer) { if ($user->rights->fournisseur->commande->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
} }

View File

@ -1,21 +1,11 @@
html,body { html,body {
padding:0; box-sizing: border-box;
padding:3px;
margin:0; margin:0;
height:100%; height:100%;
width:100%; width:100%;
} }
.row {
width:100%;
height:50%;
}
.row div {
width:33%;
height:100%;
float:left;
}
button.calcbutton { button.calcbutton {
display: inline-block; display: inline-block;
position: relative; position: relative;
@ -69,33 +59,36 @@ button.actionbutton {
vertical-align: middle; vertical-align: middle;
text-align: center; text-align: center;
overflow: visible; /* removes extra width in IE */ overflow: visible; /* removes extra width in IE */
width:32%; width:33%;
height:32%; height:33%;
} }
div.wrapper{ div.wrapper{
float:left; /* important */ float:left; /* important */
position:relative; /* important(so we can absolutely position the description div */ position:relative; /* important(so we can absolutely position the description div */
width:21.5%; width:25%;
height:23%; height:25%;
margin:1%; margin:0;
padding:1px;
border: 0.1em solid; border: 0.1em solid;
box-shadow: 3px 3px 2px #888; box-shadow: 3px 3px 2px #888;
text-align: center; text-align: center;
box-sizing: border-box;
background-color:#f0eeee;
} }
div.wrapper2{ div.wrapper2{
float:left; /* important */ float:left; /* important */
position:relative; /* important(so we can absolutely position the description div */ position:relative; /* important(so we can absolutely position the description div */
width:10.9%; width:12.5%;
height:23%; height:25%;
margin-top:0.5%; margin:0;
margin-bottom:0.5%; padding:1px;
margin-left:0.5%;
margin-right:0.5%;
border: 0.1em solid; border: 0.1em solid;
box-shadow: 3px 3px 2px #888; box-shadow: 2px 2px 1px #888;
text-align: center; text-align: center;
box-sizing: border-box;
background-color:#f0eeee;
} }
button:active{ button:active{
@ -124,8 +117,8 @@ div.description{
} }
.container{ .container{
width: 98%; width: 100%;
height: 98%; height: 100%;
margin: 0 auto; margin: 0 auto;
overflow: visible; overflow: visible;
box-sizing: border-box; box-sizing: border-box;
@ -145,10 +138,12 @@ div.description{
.div1{ .div1{
height:100%; height:100%;
width: 33%; width: 34%;
float: left; float: left;
text-align: center; text-align: center;
box-sizing: border-box; box-sizing: border-box;
overflow: auto;
background-color:white;
} }
.div2{ .div2{
@ -156,7 +151,6 @@ div.description{
width: 33%; width: 33%;
font-size: 0; font-size: 0;
float: left; float: left;
text-align: center;
padding-left: 10px; padding-left: 10px;
box-sizing: border-box; box-sizing: border-box;
} }
@ -165,7 +159,6 @@ div.description{
height: 100%; height: 100%;
width: 33%; width: 33%;
float: left; float: left;
text-align: center;
box-sizing: border-box; box-sizing: border-box;
} }
@ -175,6 +168,7 @@ div.description{
float: left; float: left;
box-sizing: border-box; box-sizing: border-box;
font-size: 6px; font-size: 6px;
padding:3px;
} }
.div5{ .div5{
@ -183,6 +177,7 @@ div.description{
float: left; float: left;
box-sizing: border-box; box-sizing: border-box;
font-size: 6px; font-size: 6px;
padding:10px;
} }
p.description_content{ p.description_content{

View File

@ -387,12 +387,12 @@ $( document ).ready(function() {
}); });
</script> </script>
<body style="overflow: hidden; background-color:#E8E8E8;"> <body style="overflow: hidden; background-color:#D1D1D1;">
<div class="container"> <div class="container">
<div class="row1"> <div class="row1">
<div id="poslines" class="div1" style="overflow: auto;"> <div id="poslines" class="div1">
</div> </div>
<div class="div2"> <div class="div2">
@ -415,6 +415,13 @@ $( document ).ready(function() {
</div> </div>
<?php <?php
// TakePOS setup check
if (empty($conf->global->CASHDESK_ID_THIRDPARTY) or empty($conf->global->CASHDESK_ID_BANKACCOUNT_CASH) or empty($conf->global->CASHDESK_ID_BANKACCOUNT_CB)) {
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
}
if (count($maincategories)==0) {
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
}
// User menu and external TakePOS modules // User menu and external TakePOS modules
$menus = array(); $menus = array();
$r=0; $r=0;
@ -447,14 +454,15 @@ if($conf->global->TAKEPOS_BAR_RESTAURANT){
} }
if ($conf->global->TAKEPOSCONNECTOR){ if ($conf->global->TAKEPOSCONNECTOR){
$menus[$r++]=array('title'=>$langs->trans("DOL_OPEN_DRAWER"), $menus[$r++]=array(
'action'=>'OpenDrawer();'); 'title'=>$langs->trans("DOL_OPEN_DRAWER"),
'action'=>'OpenDrawer();'
);
} }
$hookmanager->initHooks(array('takeposfrontend')); $hookmanager->initHooks(array('takeposfrontend'));
$reshook=$hookmanager->executeHooks('ActionButtons'); $reshook=$hookmanager->executeHooks('ActionButtons');
if (!empty($reshook)) if (!empty($reshook)) {
{
$menus[$r++]=$reshook; $menus[$r++]=$reshook;
} }

View File

@ -197,7 +197,9 @@ class Users extends DolibarrApi
* *
* @param int $id Id of account to update * @param int $id Id of account to update
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return array
*
* @throws RestException
*/ */
function put($id, $request_data = null) function put($id, $request_data = null)
{ {

View File

@ -1586,7 +1586,7 @@ class User extends CommonObject
$adh=new Adherent($this->db); $adh=new Adherent($this->db);
$result=$adh->fetch($this->fk_member); $result=$adh->fetch($this->fk_member);
if ($result >= 0) if ($result > 0)
{ {
$adh->firstname=$this->firstname; $adh->firstname=$this->firstname;
$adh->lastname=$this->lastname; $adh->lastname=$this->lastname;
@ -1625,7 +1625,7 @@ class User extends CommonObject
$error++; $error++;
} }
} }
else elseif ($result < 0)
{ {
$this->error=$adh->error; $this->error=$adh->error;
$this->errors=$adh->errors; $this->errors=$adh->errors;

View File

@ -472,15 +472,17 @@ else
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login');
if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar'); if ($useringroup->admin && ! $useringroup->entity) {
elseif ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star'); print img_picto($langs->trans("SuperAdministrator"), 'redstar');
} elseif ($useringroup->admin) {
print img_picto($langs->trans("Administrator"), 'star');
}
print '</td>'; print '</td>';
print '<td>'.$useringroup->lastname.'</td>'; print '<td>'.$useringroup->lastname.'</td>';
print '<td>'.$useringroup->firstname.'</td>'; print '<td>'.$useringroup->firstname.'</td>';
print '<td align="center">'.$useringroup->getLibStatut(3).'</td>'; print '<td align="center">'.$useringroup->getLibStatut(3).'</td>';
print '<td align="right">'; print '<td align="right">';
if (! empty($user->admin)) if (! empty($user->admin)) {
{
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">'; print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">';
print img_picto($langs->trans("RemoveFromGroup"), 'unlink'); print img_picto($langs->trans("RemoveFromGroup"), 'unlink');
print '</a>'; print '</a>';

View File

@ -194,7 +194,7 @@ class WebsitePage extends CommonObject
if (null !== $website_id) { if (null !== $website_id) {
$sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'"; $sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'";
if ($page) $sql .= " AND t.pageurl = '" . $this->db->escape($page) . "'"; if ($page) $sql .= " AND t.pageurl = '" . $this->db->escape($page) . "'";
if ($aliasalt) $sql .= " AND t.aliasalt LIKE '%," . $this->db->escape($aliasalt) . ",%'"; if ($aliasalt) $sql .= " AND (t.aliasalt LIKE '%," . $this->db->escape($aliasalt) . ",%' OR t.aliasalt LIKE '%, " . $this->db->escape($aliasalt) . ",%')";
} }
} }
$sql .= $this->db->plimit(1); $sql .= $this->db->plimit(1);

View File

@ -116,6 +116,10 @@ if ($pageid < 0) $pageid = 0;
if (($pageid > 0 || $pageref) && $action != 'addcontainer') if (($pageid > 0 || $pageref) && $action != 'addcontainer')
{ {
$res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref); $res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref);
if ($res == 0)
{
$res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), null, $pageref);
}
// Check if pageid is inside the new website, if not we reset param pageid // Check if pageid is inside the new website, if not we reset param pageid
if ($res >= 0 && $object->id > 0) if ($res >= 0 && $object->id > 0)