Merge remote-tracking branch 'refs/remotes/Dolibarr/8.0' into 8.0

This commit is contained in:
fappels 2018-08-22 18:15:23 +02:00
commit 6c4ecc025e
100 changed files with 700 additions and 380 deletions

View File

@ -212,6 +212,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/supplier_proposal
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme
%_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices

View File

@ -292,6 +292,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/supplier_proposal
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme
%_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices

View File

@ -209,6 +209,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/supplier_proposal
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme
%_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices

View File

@ -220,6 +220,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/supplier_proposal
%_datadir/dolibarr/htdocs/support
%_datadir/dolibarr/htdocs/theme
%_datadir/dolibarr/htdocs/ticket
%_datadir/dolibarr/htdocs/user
%_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices

View File

@ -295,6 +295,9 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0;
if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0;
if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0;
// admin.lang
if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0;
if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0;
// boxes.lang
if (preg_match('/^BoxTitleLast/', $value)) $qualifiedforclean=0;
if (preg_match('/^BoxTitleLatest/', $value)) $qualifiedforclean=0;

View File

@ -464,7 +464,7 @@ class Adherent extends CommonObject
$action='update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)

View File

@ -142,7 +142,7 @@ class AdherentType extends CommonObject
/**
* Met a jour en base donnees du type
*
* @param User $user Object user making change
* @param User $user Object user making change
* @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO
*/
@ -172,7 +172,7 @@ class AdherentType extends CommonObject
$action='update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)

View File

@ -330,7 +330,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if (! $error)
{
// $db->commit();
$db->commit();
}
else
{

View File

@ -379,7 +379,7 @@ $tabrowid[9] = "code_iso";
$tabrowid[10]= "";
$tabrowid[11]= "rowid";
$tabrowid[12]= "";
$tabrowid[13]= "";
$tabrowid[13]= "id";
$tabrowid[14]= "";
$tabrowid[15]= "";
$tabrowid[16]= "code";

View File

@ -309,8 +309,8 @@ if ($action == 'edit') // Edit
// Firstname/Name
print '<tr><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"),1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION',$array,(isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
@ -556,7 +556,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
}
else if ($tmpfieldlist == 'joinfiles') {
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '') . '">';
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="' . (isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1') . '">';
}
else
{
@ -989,7 +989,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print '<td>';
if (! empty($conf->global->MAIN_MULTILANGS))
{
$selectedlang = $langs->defaultlang;
$selectedlang = GETPOSTISSET('langcode','aZ09')?GETPOST('langcode','aZ09'):$langs->defaultlang;
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
}

View File

@ -313,7 +313,9 @@ if ($mode == 'desc')
{
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> <a href="'.$objMod->editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
$editor_url = $objMod->editor_url;
if (! preg_match('/^http/', $editor_url)) $editor_url = 'http://'.$editor_url;
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
$text.=$textexternal;
$text.='<br>';
}

View File

@ -19,14 +19,11 @@
/**
* \file admin/multicurrency.php
* \ingroup multicurrency
* \brief This file is an example module setup page
* Put some comments here
* \brief Page to setup multicurrency module
*/
// Dolibarr environment
require '../main.inc.php';
// Libraries
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
@ -42,6 +39,8 @@ if (! $user->admin) {
// Parameters
$action = GETPOST('action', 'alpha');
/*
* Actions
*/
@ -164,6 +163,8 @@ if ($resql)
* View
*/
$form=new Form($db);
$page_name = "MultiCurrencySetup";
llxHeader('', $langs->trans($page_name));
@ -176,21 +177,16 @@ print_fiche_titre($langs->trans($page_name), $linkback);
$head = multicurrencyAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurrency");
// Setup page goes here
$form=new Form($db);
$var=false;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '<td align="center">'.$langs->trans("Value").'</td>'."\n";
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE">';
@ -200,11 +196,9 @@ print '</form>';
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_useOriginTx").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MULTICURRENCY_USE_ORIGIN_TX">';
@ -217,8 +211,7 @@ print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_buyPriceInCurrency").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MULTICURRENCY_BUY_PRICE_IN_CURRENCY">';
@ -232,8 +225,7 @@ print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MULTICURRENCY_MODIFY_RATE_APPLICATION">';
@ -245,16 +237,17 @@ print '</td></tr>';
*/
print '</table>';
print '<br>';
if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
{
$var=false;
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize")).'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="100">';
print '<td align="right">';
print '<form id="form_sync" action="" method="POST">';
print '<input type="hidden" name="action" value="synchronize" />';
print '<textarea id="response" class="hideobject" name="response"></textarea>';
@ -263,11 +256,9 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '</td></tr>';
print '<tr class="oddeven">';
print '<td><a target="_blank" href="https://currencylayer.com">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_ID">';
@ -279,8 +270,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_SOURCE">';
@ -291,8 +281,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '<tr class="oddeven">';
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_MULTICURRENCY_ALTERNATE_SOURCE">';
@ -302,35 +291,35 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
print '</td></tr>';
print '</table>';
print '</div>';
print '<br>';
}
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Rate").'</td>'."\n";
print '<td align="center">'.$langs->trans("Rate").'</td>'."\n";
print '</tr>';
print '<tr class="oddeven">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<tr class="oddeven">';
print '<td>'.$form->selectCurrency('', 'code').'</td>';
print '<td align="right">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add_currency">';
print '<td>'.$form->selectCurrency('', 'code').'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->trans('Rate').'" />&nbsp;';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td></form></tr>';
print '</td>';
print '</tr>';
print '</form>';
print '<tr class="oddeven">';
print '<td>'.$conf->currency.$form->textwithpicto(' ', $langs->trans("BaseCurrency")).'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">1';
print '</td></form></tr>';
print '<td align="right">1</td>';
print '</tr>';
foreach ($TCurrency as &$currency)
{
@ -338,8 +327,7 @@ foreach ($TCurrency as &$currency)
print '<tr class="oddeven">';
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="400">';
print '<td align="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update_currency">';
@ -349,13 +337,11 @@ foreach ($TCurrency as &$currency)
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Modify").'">&nbsp;';
print '<input type="submit" name="submit" class="button" value="'.$langs->trans("Delete").'">';
print '</form>';
print '</td></tr>';
}
print '</table>';
print '</div>';
print '
<script type="text/javascript">

View File

@ -65,6 +65,8 @@ class DolibarrApi
$this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
$this->r->setAPIVersion(1);
//$this->r->setSupportedFormats('json');
//$this->r->setSupportedFormats('jsonFormat');
}
/**

View File

@ -95,8 +95,8 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails
$trigger_name='MYOBJECT_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
$trigger_name='ASSET_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_ASSET_TO';
$trackid='asset'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
}

View File

@ -117,10 +117,10 @@ else if (GETPOST('downloadcsv','alpha'))
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql.= " WHERE entity = ".$conf->entity;
if (GETPOST('yeartoexport','int') > 0)
if (GETPOST('monthtoexport','int') > 0 || GETPOST('yeartoexport','int') > 0)
{
$dates = dol_get_first_day(GETPOST('yeartoexport','int'), 1);
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12);
$dates = dol_get_first_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):1);
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):12);
$sql.= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
}
$sql.= " ORDER BY rowid ASC"; // Required so we get the first one
@ -131,9 +131,16 @@ else if (GETPOST('downloadcsv','alpha'))
{
// Make the first fetch to get first line
$obj = $db->fetch_object($res);
$previoushash = $block_static->getPreviousHash(0, $obj->rowid);
$firstid = $obj->rowid;
if ($obj)
{
$previoushash = $block_static->getPreviousHash(0, $obj->rowid);
$firstid = $obj->rowid;
}
else
{ // If not data found for filter, we do not need previoushash neither firstid
$previoushash = 'nodata';
$firstid = '';
}
}
else
{
@ -144,14 +151,14 @@ else if (GETPOST('downloadcsv','alpha'))
if (! $error)
{
// Now restart request with all data
// Now restart request with all data = no limit(1) in sql request
$sql = "SELECT rowid,date_creation,tms,user_fullname,action,amounts,element,fk_object,date_object,ref_object,signature,fk_user,object_data";
$sql.= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql.= " WHERE entity = ".$conf->entity;
if (GETPOST('yeartoexport','int') > 0)
if (GETPOST('monthtoexport','int') > 0 || GETPOST('yeartoexport','int') > 0)
{
$dates = dol_get_first_day(GETPOST('yeartoexport','int'), 1);
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12);
$dates = dol_get_first_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):1);
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):12);
$sql.= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
}
$sql.= " ORDER BY rowid ASC"; // Required so later we can use the parameter $previoushash of checkSignature()
@ -161,7 +168,7 @@ else if (GETPOST('downloadcsv','alpha'))
{
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"unalterable-log-archive-" .$dolibarr_main_db_name."-".(GETPOST('yeartoexport','int')>0?GETPOST('yeartoexport','int').'-':'').$previoushash. ".csv\"");
header("Content-disposition: attachment; filename=\"unalterable-log-archive-" .$dolibarr_main_db_name."-".(GETPOST('yeartoexport','int')>0 ? GETPOST('yeartoexport','int').(GETPOST('monthtoexport','int')>0?sprintf("%02d",GETPOST('monthtoexport','int')):'').'-':'').$previoushash. ".csv\"");
print $langs->transnoentities('Id')
.';'.$langs->transnoentities('Date')
@ -321,7 +328,20 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
print '<div align="right">';
print $langs->trans("RestrictYearToExport").': ';
print '<input type="text" name="yeartoexport" class="maxwidth75" value="'.GETPOST('yeartoexport','int').'">';
$smonth=GETPOST('monthtoexport','int');
// Month
$retstring='';
$retstring.='<select class="flat valignmiddle maxwidth75imp marginrightonly" id="monthtoexport" name="monthtoexport">';
$retstring.='<option value="0" selected>&nbsp;</option>';
for ($month = 1 ; $month <= 12 ; $month++)
{
$retstring.='<option value="'.$month.'"'.($month == $smonth?' selected':'').'>';
$retstring.=dol_print_date(mktime(12,0,0,$month,1,2000),"%b");
$retstring.="</option>";
}
$retstring.="</select>";
print $retstring;
print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth75" value="'.GETPOST('yeartoexport','int').'">';
print '<input type="hidden" name="withtab" value="'.GETPOST('withtab','alpha').'">';
print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">';
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('DownloadBlockChain').'</a>';
@ -360,7 +380,7 @@ print '</td>';
// User
print '<td class="liste_titre">';
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
print '</td>';
@ -373,6 +393,7 @@ print '</td>';
// Ref
print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
// Link to ref
print '<td class="liste_titre"></td>';
// Amount
@ -463,7 +484,6 @@ if (is_array($blocks))
// User
print '<td>';
//print $block->getUser()
print $block->user_fullname;
print '</td>';
@ -475,7 +495,7 @@ if (is_array($blocks))
print '<td class="nowrap">'.$block->ref_object.'</td>';
// Link to source object
print '<td><!-- object_link -->'.$object_link.'</td>';
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>';
// Amount
print '<td align="right">'.price($block->amounts).'</td>';
@ -484,8 +504,8 @@ if (is_array($blocks))
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
// Fingerprint
print '<td>';
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint');
print '<td class="nowrap">';
print $form->textwithpicto(dol_trunc($block->signature, '8'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
print '</td>';
// Status

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
@ -927,6 +927,15 @@ if ($action == 'create')
if ($id > 0)
{
$result1=$object->fetch($id);
if ($result1 <= 0)
{
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
llxFooter();
exit;
}
$result2=$object->fetch_thirdparty();
$result2=$object->fetch_projet();
$result3=$object->fetch_contact();
@ -957,7 +966,7 @@ if ($id > 0)
$object->note = GETPOST("note",'none');
}
if ($result1 < 0 || $result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0)
{
dol_print_error($db,$object->error);
exit;

View File

@ -620,7 +620,7 @@ class ActionComm extends CommonObject
$this->contact->id = $obj->fk_contact; // deprecated
$this->fk_element = $obj->elementid;
$this->elementid = $obj->elementid;
$this->elementid = $obj->elementid;
$this->elementtype = $obj->elementtype;
$this->fetchResources();

View File

@ -1327,7 +1327,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
$colorindexused[$user->id] = 0; // Color index for current user (user->id) is always 0
$nextindextouse=count($colorindexused); // At first run this is 0, so first user has 0, next 1, ...
$nextindextouse=is_array($colorindexused)?count($colorindexused):0; // At first run this is 0, so fist user has 0, next 1, ...
//var_dump($colorindexused);
foreach ($eventarray as $daykey => $notused)

View File

@ -74,6 +74,7 @@ $originid = GETPOST('originid', 'int');
$confirm = GETPOST('confirm', 'alpha');
$lineid = GETPOST('lineid', 'int');
$contactid = GETPOST('contactid','int');
$projectid = GETPOST('projectid','int');
// PDF
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
@ -1389,7 +1390,7 @@ if ($action == 'create')
}
$objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : 0);
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
@ -1551,9 +1552,6 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled))
{
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load("projects");
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td>';

View File

@ -1335,13 +1335,12 @@ class Propal extends CommonObject
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
$sql.= " WHERE p.fk_statut = c.id";
if ($ref) {
$sql.= " AND p.entity IN (".getEntity('propal').")"; // Dont't use entity if you use rowid
$sql.= " AND p.ref='".$ref."'";
$sql.= " WHERE p.entity IN (".getEntity('propal').")"; // Dont't use entity if you use rowid
$sql.= " AND p.ref='".$this->db->escape($ref)."'";
}
else $sql.= " AND p.rowid=".$rowid;
else $sql.= " WHERE p.rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -1464,6 +1463,8 @@ class Propal extends CommonObject
*/
function update(User $user, $notrigger=0)
{
global $conf;
$error=0;
// Clean parameters
@ -1512,17 +1513,23 @@ class Propal extends CommonObject
$error++; $this->errors[]="Error ".$this->db->lasterror();
}
if (! $error)
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0)
{
if (! $notrigger)
$result=$this->insertExtraFields();
if ($result < 0)
{
// Call trigger
$result=$this->call_trigger('PROPAL_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
$error++;
}
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('PROPAL_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
}
// Commit or rollback
if ($error)
{

View File

@ -78,13 +78,15 @@ $search_day=GETPOST("search_day","int");
$search_month=GETPOST("search_month","int");
$search_year=GETPOST("search_year","int");
$search_dayfin=GETPOST("search_dayfin","int");
$search_monthfin=GETPOST("search_monthfin","int");
$search_month_end=GETPOST("search_month_end","int");
$search_yearfin=GETPOST("search_yearfin","int");
$search_daydelivery=GETPOST("search_daydelivery","int");
$search_monthdelivery=GETPOST("search_monthdelivery","int");
$search_yeardelivery=GETPOST("search_yeardelivery","int");
$search_availability=GETPOST('search_availability','int');
$search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha');
@ -98,7 +100,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -213,7 +215,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_month='';
$search_day='';
$search_yearfin='';
$search_monthfin='';
$search_month_end='';
$search_dayfin='';
$search_yeardelivery='';
$search_monthdelivery='';
@ -310,7 +312,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
if ($search_refproject) $sql .= natural_search('pr.ref', $search_refprojet);
if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject);
if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')';
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
@ -343,14 +345,14 @@ else if ($search_year > 0)
{
$sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'";
}
if ($search_monthfin > 0)
if ($search_month_end > 0)
{
if ($search_yearfin > 0 && empty($search_dayfin))
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,$search_monthfin,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,$search_monthfin,false))."'";
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_get_first_day($search_yearfin,$search_month_end,false))."' AND '".$db->idate(dol_get_last_day($search_yearfin,$search_month_end,false))."'";
else if ($search_yearfin > 0 && ! empty($search_dayfin))
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_monthfin, $search_dayfin, $search_yearfin))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_monthfin, $search_dayfin, $search_yearfin))."'";
$sql.= " AND p.fin_validite BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_end, $search_dayfin, $search_yearfin))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_end, $search_dayfin, $search_yearfin))."'";
else
$sql.= " AND date_format(p.fin_validite, '%m') = '".$db->escape($search_monthfin)."'";
$sql.= " AND date_format(p.fin_validite, '%m') = '".$db->escape($search_month_end)."'";
}
else if ($search_yearfin > 0)
{
@ -432,7 +434,7 @@ if ($resql)
if ($search_year) $param.='&search_year='.urlencode($search_year);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_refcustomer) $param.='&search_refcustomer='.urlencode($search_refcustomer);
if ($search_refprojet) $param.='&search_refprojet='.urlencode($search_refprojet);
if ($search_refproject) $param.='&search_refproject='.urlencode($search_refproject);
if ($search_societe) $param.='&search_societe='.urlencode($search_societe);
if ($search_user > 0) $param.='&search_user='.urlencode($search_user);
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale);
@ -615,7 +617,7 @@ if ($resql)
print '<td class="liste_titre nowraponall" align="center">';
//print $langs->trans('Month').': ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="'.dol_escape_htmltag($search_dayfin).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthfin" value="'.dol_escape_htmltag($search_monthfin).'">';
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
//print '&nbsp;'.$langs->trans('Year').': ';
$formother->select_year($search_yearfin,'search_yearfin',1, 20, 5);
print '</td>';

View File

@ -3067,17 +3067,23 @@ class Commande extends CommonOrder
$error++; $this->errors[]="Error ".$this->db->lasterror();
}
if (! $error)
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0)
{
if (! $notrigger)
$result=$this->insertExtraFields();
if ($result < 0)
{
// Call trigger
$result=$this->call_trigger('ORDER_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
$error++;
}
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('ORDER_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
}
// Commit or rollback
if ($error)
{

View File

@ -78,6 +78,9 @@ $search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int');
$viewstatut=GETPOST('viewstatut');
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$search_project_ref=GETPOST('search_project_ref','alpha');
// Security check
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int'));
@ -91,7 +94,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -1423,14 +1423,14 @@ if ($resql)
if (! empty($arrayfields['b.conciliated']['checked']))
{
print '<td class="nowrap" align="center">';
print '<td class="nowraponall" align="center">';
print $objp->conciliated?$langs->trans("Yes"):$langs->trans("No");
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action edit/delete
print '<td class="nowrap" align="center">';
print '<td class="nowraponall" align="center">';
// Transaction reconciliated or edit link
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
{

View File

@ -4028,8 +4028,6 @@ else if ($id > 0 || ! empty($ref))
print '</table>';
// List of previous situation invoices
$sign = 1;
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = - 1;
$nbrows = 8;
@ -4370,7 +4368,7 @@ else if ($id > 0 || ! empty($ref))
}
else // Credit note
{
$cssforamountpaymentcomplete='';
$cssforamountpaymentcomplete='amountpaymentneutral';
// Total already paid back
print '<tr><td colspan="' . $nbcols . '" align="right">';
@ -4385,7 +4383,7 @@ else if ($id > 0 || ! empty($ref))
if ($resteapayeraffiche <= 0)
print $langs->trans('RemainderToPayBack');
else
print $langs->trans('ExcessPaydBack');
print $langs->trans('ExcessPaid');
print ' :</td>';
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopayback"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($sign * $resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>';
@ -4730,7 +4728,7 @@ else if ($id > 0 || ! empty($ref))
}
// For situation invoice with excess received
if ($object->statut == Facture::STATUS_VALIDATED
if ($object->statut > Facture::STATUS_DRAFT
&& ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) > 0
&& $user->rights->facture->creer
&& !$objectidnext
@ -4748,7 +4746,7 @@ else if ($id > 0 || ! empty($ref))
}
// remove situation from cycle
if ($object->statut == Facture::STATUS_VALIDATED
if ($object->statut > Facture::STATUS_DRAFT
&& $object->type == Facture::TYPE_SITUATION
&& $user->rights->facture->creer
&& !$objectidnext

View File

@ -984,6 +984,7 @@ class FactureRec extends CommonInvoice
$error=0;
$langs->load("bills");
$langs->load('main');
$nb_create=0;
@ -1060,6 +1061,8 @@ class FactureRec extends CommonInvoice
}
if (! $error && $facturerec->generate_pdf)
{
// We refresh the object in order to have all necessary data (like date_lim_reglement)
$facture->fetch($facture->id);
$result = $facture->generateDocument($facturerec->modelpdf, $langs);
if ($result <= 0)
{

View File

@ -1549,6 +1549,8 @@ class Facture extends CommonInvoice
*/
function update(User $user, $notrigger=0)
{
global $conf;
$error=0;
// Clean parameters
@ -1614,17 +1616,23 @@ class Facture extends CommonInvoice
$error++; $this->errors[]="Error ".$this->db->lasterror();
}
if (! $error)
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0)
{
if (! $notrigger)
$result=$this->insertExtraFields();
if ($result < 0)
{
// Call trigger
$result=$this->call_trigger('BILL_MODIFY',$user);
if ($result < 0) $error++;
// End call triggers
$error++;
}
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BILL_MODIFY',$user);
if ($result < 0) $error++;
// End call triggers
}
// Commit or rollback
if ($error)
{
@ -4836,7 +4844,7 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {
$res = $this->db->fetch_array($resql);
return $res['situation_percent'];
return floatval($res['situation_percent']);
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR);

View File

@ -88,13 +88,15 @@ $search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_user = GETPOST('search_user','int');
$search_sale = GETPOST('search_sale','int');
$search_day = GETPOST('search_day','int');
$search_day = GETPOST('search_day','int');
$search_month = GETPOST('search_month','int');
$search_year = GETPOST('search_year','int');
$search_day_lim = GETPOST('search_day_lim','int');
$search_day_lim = GETPOST('search_day_lim','int');
$search_month_lim = GETPOST('search_month_lim','int');
$search_year_lim = GETPOST('search_year_lim','int');
$search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$option = GETPOST('search_option');
if ($option == 'late') {
@ -106,7 +108,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
if (! $sortorder) $sortorder='DESC';

View File

@ -722,7 +722,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerOrderToBill',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.tva, c.total_ht, c.total_ttc";
$sql.= " GROUP BY s.nom, s.email, s.rowid, s.code_client, s.code_compta, c.rowid, c.ref, c.facture, c.fk_statut, c.total_ht, c.tva, c.total_ttc, cc.rowid, cc.code";
$resql = $db->query($sql);
if ( $resql )
@ -838,7 +838,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";

View File

@ -45,7 +45,10 @@ $result = restrictedArea($user, 'prelevement', '', '', 'bons');
$action = GETPOST('action','alpha');
$mode = GETPOST('mode','alpha')?GETPOST('mode','alpha'):'real';
$format = GETPOST('format','aZ09');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
/*
* Actions
@ -196,13 +199,33 @@ $sql.= " AND pfd.traite = 0";
$sql.= " AND pfd.fk_facture = f.rowid";
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1,$offset);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
print load_fiche_titre($langs->trans("InvoiceWaitingWithdraw").($num > 0?' ('.$num.')':''),'','');
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if($socid) $param .= '&socid='.urlencode($socid);
if($option) $param .= "&option=".urlencode($option);
if(! empty($page) && $num <= $nbtotalofrecords) $page = 0;
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("InvoiceWaitingWithdraw"),$page,$_SERVER['PHP_SELF'],$param,'','','',$num,$nbtotalofrecords,'title_accountancy.png',0,'','', $limit);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -219,7 +242,7 @@ if ($resql)
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($db);
while ($i < $num && $i < 20)
while ($i < $num && $i < $limit)
{
$obj = $db->fetch_object($resql);
@ -260,6 +283,7 @@ if ($resql)
}
else print '<tr '.$bc[0].'><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print "</table>";
print "</form>";
print "<br>\n";
}
else

View File

@ -371,15 +371,12 @@ class Contact extends CommonObject
$action='update';
// Actions on extra fields
if (! $error)
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}

View File

@ -925,16 +925,13 @@ class Contrat extends CommonObject
}
}
if (! $error)
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
// Insert contacts commerciaux ('SALESREPSIGN','contrat')
@ -1283,18 +1280,7 @@ class Contrat extends CommonObject
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Call triggers
$result=$this->call_trigger('CONTRACT_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
}
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0)
{
$result=$this->insertExtraFields();
if ($result < 0)
@ -1303,6 +1289,14 @@ class Contrat extends CommonObject
}
}
if (! $error && ! $notrigger)
{
// Call triggers
$result=$this->call_trigger('CONTRACT_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
// Commit or rollback
if ($error)
{

View File

@ -197,7 +197,7 @@ $now=dol_now();
$form=new Form($db);
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
$sql.= " s.rowid as socid, s.nom as name,";
$sql.= " s.rowid as socid, s.nom as name, s.email, s.client, s.fournisseur,";
$sql.= " cd.rowid, cd.description, cd.statut,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
@ -540,6 +540,11 @@ while ($i < min($num,$limit))
$contractstatic->id=$obj->cid;
$contractstatic->ref=$obj->ref?$obj->ref:$obj->cid;
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->email=$obj->email;
$companystatic->client=$obj->client;
$companystatic->fournisseur=$obj->fournisseur;
print '<tr class="oddeven">';
@ -555,7 +560,7 @@ while ($i < min($num,$limit))
if (! empty($arrayfields['p.description']['checked']))
{
print '<td>';
if ($obj->pid)
if ($obj->pid > 0)
{
$productstatic->id=$obj->pid;
$productstatic->type=$obj->ptype;
@ -625,9 +630,6 @@ while ($i < min($num,$limit))
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td>';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client=1;
print $companystatic->getNomUrl(1,'customer',28);
print '</td>';
if (! $i) $totalarray['nbfield']++;

View File

@ -424,25 +424,25 @@ if (! $error && $massaction == 'confirm_presend')
if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYEMAIL';
if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYEMAIL';
if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_SENTBYEMAIL';
if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYEMAIL';
if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYMAIL';
if ($triggername == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYEMAIL';
if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL';
if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYEMAIL';
if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYEMAIL';
if (! empty($trigger_name))
if (! empty($triggername))
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers($trigger_name, $objectobj, $user, $langs, $conf);
$result=$interface->run_triggers($triggername, $objectobj, $user, $langs, $conf);
if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers
if ($error)
{
setEventMessages($db->lasterror(), $errors, 'errors');
dol_syslog("Error in trigger ".$trigger_name.' '.$db->lasterror(), LOG_ERR);
dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR);
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2014-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
* Copyright (C) 2014-2018 Frederic France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,7 +28,7 @@
// Filename to print must be provided into 'file' parameter
// Print file
if ($action == 'print_file' and $user->rights->printing->read)
if ($action == 'print_file' && $user->rights->printing->read)
{
$langs->load("printing");
require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php';

View File

@ -120,6 +120,7 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
$row_array['selectcountry_id'] = $row['fk_country'];
$row_array['state_id'] = $row['fk_county'];
// TODO Use a cache here to avoid to make select_state in each pass (this make a SQL and lot of logs)
$row_array['states'] = $formcompany->select_state('',$row['fk_country'],'');
array_push($return_arr,$row_array);

View File

@ -6883,7 +6883,7 @@ abstract class CommonObject
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
if ($this->fields[$key]['notnull'] == 1 && ! isset($values[$key]) && is_null($val['default']))
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && ! isset($values[$key]) && is_null($val['default']))
{
$error++;
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
@ -7044,15 +7044,12 @@ abstract class CommonObject
}
// Update extrafield
if (! $error)
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
$result=$this->insertExtraFields();
if ($result < 0)
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
$error++;
}
}

View File

@ -744,6 +744,7 @@ class ExtraFields
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
if ($elementtype == 'order_supplier') $elementtype='commande_fournisseur';
$array_name_label=array();

View File

@ -1078,7 +1078,11 @@ class Form
$outarray=array();
// Clean $filter that may contains sql conditions so sql code
if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3);
if (function_exists('test_sql_and_script_inject')) {
if (test_sql_and_script_inject($filter, 3)>0) {
$filter ='';
}
}
// On recherche les societes
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
@ -1539,9 +1543,12 @@ class Form
if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX) || $noactive) $sql.= " AND u.statut <> 0";
if (! empty($morefilter)) $sql.=" ".$morefilter;
if(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)){
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname
{
$sql.= " ORDER BY u.firstname ASC";
}else{
}
else
{
$sql.= " ORDER BY u.lastname ASC";
}
@ -1588,9 +1595,11 @@ class Form
$out.= '>';
}
$fullNameMode = 0; //Lastname + firstname
if(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)){
$fullNameMode = 1; //firstname + lastname
// $fullNameMode is 0=Lastname+Firstname (MAIN_FIRSTNAME_NAME_POSITION=1), 1=Firstname+Lastname (MAIN_FIRSTNAME_NAME_POSITION=0)
$fullNameMode = 0;
if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION))
{
$fullNameMode = 1; //Firstname+lastname
}
$out.= $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength);
@ -3315,21 +3324,21 @@ class Form
if ($resql && $this->db->num_rows($resql) > 0) {
// Last seen cycle
$ref = 0;
while ($res = $this->db->fetch_array($resql, MYSQL_NUM)) {
while ($obj = $this->db->fetch_object($resql)){
//Same company ?
if ($socid == $res[5]) {
if ($socid == $obj->fk_soc) {
//Same cycle ?
if ($res[2] != $ref) {
if ($obj->situation_cycle_ref != $ref) {
// Just seen this cycle
$ref = $res[2];
$ref = $obj->situation_cycle_ref;
//not final ?
if ($res[4] != 1) {
if ($obj->situation_final != 1) {
//Not prov?
if (substr($res[1], 1, 4) != 'PROV') {
if ($selected == $res[0]) {
$opt .= '<option value="' . $res[0] . '" selected>' . $res[1] . '</option>';
if (substr($obj->facnumber, 1, 4) != 'PROV') {
if ($selected == $obj->situation_final) {
$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->facnumber . '</option>';
} else {
$opt .= '<option value="' . $res[0] . '">' . $res[1] . '</option>';
$opt .= '<option value="' . $obj->rowid . '">' . $obj->facnumber . '</option>';
}
}
}
@ -4943,6 +4952,7 @@ class Form
}
// Zone de saisie manuelle de la date
$retstring.='<div class="nowrap inline-block">';
$retstring.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"';
$retstring.=($disabled?' disabled':'');
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
@ -4966,6 +4976,7 @@ class Form
$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').'</button>';
}
$retstring.='</div>';
$retstring.='<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";
$retstring.='<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
$retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";
@ -6332,7 +6343,7 @@ class Form
$disabled = ($disabled ? ' disabled' : '');
$resultyesno = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
$resultyesno = '<select class="flat width75" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
if ($useempty) $resultyesno .= '<option value="-1"'.(($value < 0)?' selected':'').'>&nbsp;</option>'."\n";
if (("$value" == 'yes') || ($value == 1))
{

View File

@ -203,7 +203,7 @@ class FormCompany
*
* @param string $selected Code state preselected (mus be state id)
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department
* @param string $htmlname Id of department. If '', we want only the string with <option>
* @return string String with HTML select
* @see select_country
*/
@ -217,7 +217,7 @@ class FormCompany
$out='';
// On recherche les departements/cantons/province active d'une region et pays actif
// Serch departements/cantons/province active d'une region et pays actif
$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
$sql .= " ".MAIN_DB_PREFIX ."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r,".MAIN_DB_PREFIX."c_country as c";
$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
@ -226,7 +226,6 @@ class FormCompany
if ($country_codeid && ! is_numeric($country_codeid)) $sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
$sql .= " ORDER BY c.code, d.code_departement";
dol_syslog(get_class($this)."::select_departement", LOG_DEBUG);
$result=$this->db->query($sql);
if ($result)
{
@ -298,9 +297,12 @@ class FormCompany
dol_print_error($this->db);
}
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
// Make select dynamic
if (! empty($htmlname))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
return $out;
}

View File

@ -778,7 +778,8 @@ class FormFile
$out.= '<td class="right nowraponall">';
if ($delallowed)
{
$out.= '<a href="'.$urlsource.(strpos($urlsource,'?')?'&amp;':'?').'action=remove_file&amp;file='.urlencode($relativepath);
$tmpurlsource = preg_replace('/#[a-zA-Z0-9_]*$/', '', $urlsource);
$out.= '<a href="'.$tmpurlsource.(strpos($tmpurlsource,'?')?'&amp;':'?').'action=remove_file&amp;file='.urlencode($relativepath);
$out.= ($param?'&amp;'.$param:'');
//$out.= '&modulepart='.$modulepart; // TODO obsolete ?
//$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?
@ -814,7 +815,7 @@ class FormFile
$this->numoffiles++;
}
// Loop on each file found
// Loop on each link found
if (is_array($link_list))
{
$colspan=2;
@ -1304,8 +1305,7 @@ class FormFile
if (! empty($conf->dol_use_jmobile)) $useajax=0;
if (empty($conf->use_javascript_ajax)) $useajax=0;
if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
print '<a href="'.(($useinecm && $useajax)?'#':($url.'?action=delete&urlfile='.urlencode($filepath).$param)).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
}
print "</td>";

View File

@ -286,7 +286,7 @@ class FormMail extends Form
$disablebademails=1;
// Define output language
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels'];
@ -1082,7 +1082,7 @@ class FormMail extends Form
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
if ($active >= 0) $sql.=" AND active = ".$active;
if ($label) $sql.=" AND label ='".$db->escape($label)."'";
if (is_object($outputlangs)) $sql.= " AND (lang = '".$db->escape($outputlangs->defaultlang)."' OR lang IS NULL OR lang = '')";
if (! ($id > 0) && is_object($outputlangs)) $sql.= " AND (lang = '".$db->escape($outputlangs->defaultlang)."' OR lang IS NULL OR lang = '')";
if ($id > 0) $sql.= " AND rowid=".$id;
if ($id == -1) $sql.= " AND position=0";
if (is_object($outputlangs)) $sql.= $db->order("position,lang,label","ASC,DESC,ASC"); // We want line with lang set first, then with lang null or ''

View File

@ -89,7 +89,7 @@ function societe_prepare_head(Societe $object)
$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
$head[$h][1] = '';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && ($object->client==2 || $object->client==3)) $head[$h][1] .= $langs->trans("Prospect");
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client==3) $head[$h][1] .= '/';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && $object->client==3) $head[$h][1] .= ' | ';
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && ($object->client==1 || $object->client==3)) $head[$h][1] .= $langs->trans("Customer");
$head[$h][2] = 'customer';
$h++;

View File

@ -1133,10 +1133,11 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
* @param int $nophperrors Disable all PHP output errors
* @param int $nohook Disable all hooks
* @param object $object Current object in use
* @param boolean $allowdotdot Allow to delete file path with .. inside. Never use this, it is reserved for migration purpose.
* @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error
* @see dol_delete_dir
*/
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null)
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null,$allowdotdot=false)
{
global $db, $conf, $user, $langs;
global $hookmanager;
@ -1148,7 +1149,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
// Security:
// We refuse transversal using .. and pipes into filenames.
if (preg_match('/\.\./',$file) || preg_match('/[<>|]/',$file))
if ((! $allowdotdot && preg_match('/\.\./',$file)) || preg_match('/[<>|]/',$file))
{
dol_syslog("Refused to delete file ".$file, LOG_WARNING);
return false;

View File

@ -487,10 +487,10 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu
elseif ($reg[1] == 'MONTH') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mon']; }
elseif ($reg[1] == 'YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['year']; }
elseif ($reg[1] == 'PREVIOUS_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
elseif ($reg[1] == 'PREVIOUS_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_prev_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
elseif ($reg[1] == 'PREVIOUS_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] - 1); }
elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); }
elseif ($reg[1] == 'MYCOMPANY_COUNTRY_ID' || $reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID')
{
@ -5491,7 +5491,7 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UT
function dol_string_onlythesehtmltags($stringtoclean)
{
$allowed_tags = array(
"html", "head", "meta", "body", "b", "br", "div", "em", "font", "img", "ins", "hr", "i", "li", "link",
"html", "head", "meta", "body", "article", "a", "b", "br", "div", "em", "font", "img", "ins", "hr", "i", "li", "link",
"ol", "p", "s", "section", "span", "strong", "title",
"table", "tr", "th", "td", "u", "ul"
);
@ -6110,9 +6110,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$tmp=dol_getdate(dol_now(), true);
$tmp2=dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']);
$tmp3=dol_get_prev_month($tmp['mday'], $tmp['mon'], $tmp['year']);
$tmp3=dol_get_prev_month($tmp['mon'], $tmp['year']);
$tmp4=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']);
$tmp5=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']);
$tmp5=dol_get_next_month($tmp['mon'], $tmp['year']);
$substitutionarray=array_merge($substitutionarray, array(
'__DAY__' => (string) $tmp['mday'],
@ -6325,7 +6325,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
$ret='';
// If order not defined, we use the setup
if ($nameorder < 0) $nameorder=$conf->global->MAIN_FIRSTNAME_NAME_POSITION;
if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?1:0);
if ($nameorder && ((string) $nameorder != '2'))
{
$ret.=$firstname;

View File

@ -1875,13 +1875,13 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
{
$prev_progress = 0;
$progress = 1;
if (method_exists($object, 'get_prev_progress'))
if (method_exists($object->lines[$i], 'get_prev_progress'))
{
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
$progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100;
}
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
}
}
else
$result.=price($sign * $total_ht, 0, $outputlangs);
}

View File

@ -104,9 +104,24 @@ function project_prepare_head($object)
$head[$h][2] = 'tasks';
$h++;
$nbTimeSpent=0;
$sql = "SELECT t.rowid";
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
$sql .= " WHERE t.fk_task = pt.rowid";
$sql .= " AND pt.fk_projet =".$object->id;
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj) $nbTimeSpent=1;
}
else dol_print_error($db);
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id;
$head[$h][1] = $langs->trans("TimeSpent");
//if ($nbTasks > 0) $head[$h][1].= ' <span class="badge">'.($nbTasks).'</span>';
if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>';
$head[$h][2] = 'timespent';
$h++;
}
@ -165,9 +180,10 @@ function task_prepare_head($object)
// Is there timespent ?
$nbTimeSpent=0;
$sql = "SELECT t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
$sql .= " AND t.fk_task =".$object->id;
//$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql .= " WHERE t.fk_task =".$object->id;
$resql = $db->query($sql);
if ($resql)
{

View File

@ -150,11 +150,10 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
if (! empty($conf->salaries->enabled)) $menuqualified++;
if (! empty($conf->supplier_invoice->enabled)) $menuqualified++;
if (! empty($conf->loan->enabled)) $menuqualified++;
if (! empty($conf->banque->enabled)) $menuqualified++;
$tmpentry=array(
'enabled'=>$menuqualified,
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read) || ! empty($user->rights->banque->lire)),
'module'=>'facture|supplier_invoice|don|tax|salaries|loan|banque');
'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
'module'=>'facture|supplier_invoice|don|tax|salaries|loan');
$showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
{

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
*
* 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

View File

@ -7,7 +7,7 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -405,7 +405,7 @@ class pdf_crabe extends ModelePDFFactures
{
$tab_top -= 2;
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);

View File

@ -349,12 +349,12 @@ class modAdherent extends DolibarrModules
// Cronjobs
$this->cronjobs = array(
0=>array(
'label'=>'SendReminderForExpiredSubscription',
'label'=>'SendReminderForExpiredSubscriptionTitle',
'jobtype'=>'method', 'class'=>'adherents/class/adherent.class.php',
'objectname'=>'Adherent',
'method'=>'sendReminderForExpiredSubscription',
'parameters'=>'10',
'comment'=>'sendReminderForExpiredSubscription',
'comment'=>'SendReminderForExpiredSubscription',
'frequency'=>1,
'unitfrequency'=> 3600 * 24,
'priority'=>50,

View File

@ -42,7 +42,7 @@ class modService extends DolibarrModules
*/
function __construct($db)
{
global $conf;
global $conf, $mysoc;
$this->db = $db;
$this->numero = 53;

View File

@ -67,7 +67,7 @@ class doc_generic_project_odt extends ModelePDFProjects
function __construct($db)
{
global $conf,$langs,$mysoc;
// Load traductions files requiredby by page
$langs->loadLangs(array("companies", "main"));
@ -130,12 +130,9 @@ class doc_generic_project_odt extends ModelePDFProjects
$array_key.'_statut'=>$object->getLibStatut()
);
// Retrieve extrafields
$extrafieldkey=$object->element;
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element,true);
$object->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs);
@ -154,7 +151,7 @@ class doc_generic_project_odt extends ModelePDFProjects
{
global $conf;
return array(
$resarray = array(
'task_ref'=>$task->ref,
'task_fk_project'=>$task->fk_project,
'task_projectref'=>$task->projectref,
@ -163,6 +160,7 @@ class doc_generic_project_odt extends ModelePDFProjects
'task_description'=>$task->description,
'task_fk_parent'=>$task->fk_parent,
'task_duration'=>$task->duration,
'task_duration_hour'=>convertSecondToTime($task->duration,'all'),
'task_progress'=>$task->progress,
'task_public'=>$task->public,
'task_date_start'=>dol_print_date($task->date_start,'day'),
@ -170,6 +168,16 @@ class doc_generic_project_odt extends ModelePDFProjects
'task_note_private'=>$task->note_private,
'task_note_public'=>$task->note_public
);
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($task->table_element,true);
$task->fetch_optionals($task->id,$extralabels);
$resarray = $this->fill_substitutionarray_with_extrafields($task,$resarray,$extrafields,'task',$outputlangs);
return $resarray;
}
/**
@ -310,7 +318,10 @@ class doc_generic_project_odt extends ModelePDFProjects
'tasktime_fk_user'=>$tasktime['fk_user'],
'tasktime_user_name'=>$tasktime['name'],
'tasktime_user_first'=>$tasktime['firstname'],
'tasktime_fullcivname'=>$tasktime['fullcivname']
'tasktime_fullcivname'=>$tasktime['fullcivname'],
'tasktime_amountht'=>$tasktime['amountht'],
'tasktime_amountttc'=>$tasktime['amountttc'],
'tasktime_thm'=>$tasktime['thm'],
);
}
@ -452,7 +463,7 @@ class doc_generic_project_odt extends ModelePDFProjects
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
@ -691,7 +702,7 @@ class doc_generic_project_odt extends ModelePDFProjects
//Time ressources
$sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user, t.note";
$sql.= ", u.lastname, u.firstname";
$sql.= ", u.lastname, u.firstname, t.thm";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
$sql .= " , ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE t.fk_task =".$task->id;
@ -705,6 +716,35 @@ class doc_generic_project_odt extends ModelePDFProjects
$i = 0;
$tasks = array();
$listlinestasktime = $listlines->__get('taskstimes');
if (empty($num)) {
$row['rowid']='';
$row['task_date']='';
$row['task_duration']='';
$row['$tasktime']='';
$row['note']='';
$row['fk_user']='';
$row['name']='';
$row['firstname']='';
$row['fullcivname']='';
$row['amountht']='';
$row['amountttc']='';
$row['thm']='';
$tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs);
foreach($tmparray as $key => $val)
{
try
{
$listlinestasktime->setVars($key, $val, true, 'UTF-8');
}
catch(OdfException $e)
{
}
catch(SegmentException $e)
{
}
}
$listlinestasktime->merge();
}
while ($i < $num)
{
$row = $this->db->fetch_array($resql);
@ -716,6 +756,16 @@ class doc_generic_project_odt extends ModelePDFProjects
$row['fullcivname']='';
}
if (!empty($row['thm'])) {
$row['amountht']=($row['task_duration'] / 3600) * $row['thm'];
$defaultvat = get_default_tva($mysoc, $mysoc);
$row['amountttc']=price2num($row['amountht'] * (1 + ($defaultvat / 100)),'MT');;
} else {
$row['amountht']=0;
$row['amountttc']=0;
$row['thm']=0;
}
$tmparray=$this->get_substitutionarray_taskstime($row,$outputlangs);
foreach($tmparray as $key => $val)
@ -877,60 +927,114 @@ class doc_generic_project_odt extends ModelePDFProjects
//List of referent
$listofreferent=array(
'propal'=>array(
'title'=>"ListProposalsAssociatedProject",
'class'=>'Propal',
'table'=>'propal',
'test'=>$conf->propal->enabled && $user->rights->propale->lire),
'order'=>array(
'title'=>"ListOrdersAssociatedProject",
'class'=>'Commande',
'table'=>'commande',
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
'invoice'=>array(
'title'=>"ListInvoicesAssociatedProject",
'class'=>'Facture',
'table'=>'facture',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'invoice_predefined'=>array(
'title'=>"ListPredefinedInvoicesAssociatedProject",
'class'=>'FactureRec',
'table'=>'facture_rec',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'order_supplier'=>array(
'title'=>"ListSupplierOrdersAssociatedProject",
'table'=>'commande_fournisseur',
'class'=>'CommandeFournisseur',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire),
'invoice_supplier'=>array(
'title'=>"ListSupplierInvoicesAssociatedProject",
'table'=>'facture_fourn',
'class'=>'FactureFournisseur',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
'contract'=>array(
'title'=>"ListContractAssociatedProject",
'class'=>'Contrat',
'table'=>'contrat',
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
'intervention'=>array(
'title'=>"ListFichinterAssociatedProject",
'class'=>'Fichinter',
'table'=>'fichinter',
'disableamount'=>1,
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
'trip'=>array(
'title'=>"ListTripAssociatedProject",
'class'=>'Deplacement',
'table'=>'deplacement',
'disableamount'=>1,
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
'agenda'=>array(
'title'=>"ListActionsAssociatedProject",
'class'=>'ActionComm',
'table'=>'actioncomm',
'disableamount'=>1,
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire)
$listofreferent = array(
'propal' => array(
'title' => "ListProposalsAssociatedProject",
'class' => 'Propal',
'table' => 'propal',
'test' => $conf->propal->enabled && $user->rights->propale->lire
),
'order' => array(
'title' => "ListOrdersAssociatedProject",
'class' => 'Commande',
'table' => 'commande',
'test' => $conf->commande->enabled && $user->rights->commande->lire
),
'invoice' => array(
'title' => "ListInvoicesAssociatedProject",
'class' => 'Facture',
'table' => 'facture',
'test' => $conf->facture->enabled && $user->rights->facture->lire
),
'invoice_predefined' => array(
'title' => "ListPredefinedInvoicesAssociatedProject",
'class' => 'FactureRec',
'table' => 'facture_rec',
'test' => $conf->facture->enabled && $user->rights->facture->lire
),
'proposal_supplier' => array(
'title' => "ListSupplierProposalsAssociatedProject",
'class' => 'SupplierProposal',
'table' => 'supplier_proposal',
'test' => $conf->supplier_proposal->enabled && $user->rights->supplier_proposal->lire
),
'order_supplier' => array(
'title' => "ListSupplierOrdersAssociatedProject",
'table' => 'commande_fournisseur',
'class' => 'CommandeFournisseur',
'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire
),
'invoice_supplier' => array(
'title' => "ListSupplierInvoicesAssociatedProject",
'table' => 'facture_fourn',
'class' => 'FactureFournisseur',
'test' => $conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire
),
'contract' => array(
'title' => "ListContractAssociatedProject",
'class' => 'Contrat',
'table' => 'contrat',
'test' => $conf->contrat->enabled && $user->rights->contrat->lire
),
'intervention' => array(
'title' => "ListFichinterAssociatedProject",
'class' => 'Fichinter',
'table' => 'fichinter',
'disableamount' => 1,
'test' => $conf->ficheinter->enabled && $user->rights->ficheinter->lire
),
'shipping' => array(
'title' => "ListShippingAssociatedProject",
'class' => 'Expedition',
'table' => 'expedition',
'disableamount' => 1,
'test' => $conf->expedition->enabled && $user->rights->expedition->lire
),
'trip' => array(
'title' => "ListTripAssociatedProject",
'class' => 'Deplacement',
'table' => 'deplacement',
'disableamount' => 1,
'test' => $conf->deplacement->enabled && $user->rights->deplacement->lire
),
'expensereport' => array(
'title' => "ListExpenseReportsAssociatedProject",
'class' => 'ExpenseReportLine',
'table' => 'expensereport_det',
'test' => $conf->expensereport->enabled && $user->rights->expensereport->lire
),
'donation' => array(
'title' => "ListDonationsAssociatedProject",
'class' => 'Don',
'table' => 'don',
'test' => $conf->don->enabled && $user->rights->don->lire
),
'loan' => array(
'title' => "ListLoanAssociatedProject",
'class' => 'Loan',
'table' => 'loan',
'test' => $conf->loan->enabled && $user->rights->loan->read
),
'chargesociales' => array(
'title' => "ListSocialContributionAssociatedProject",
'class' => 'ChargeSociales',
'table' => 'chargesociales',
'urlnew' => DOL_URL_ROOT . '/compta/sociales/card.php?action=create&projectid=' . $id,
'test' => $conf->tax->enabled && $user->rights->tax->charges->lire
),
'stock_mouvement' => array(
'title' => "ListMouvementStockProject",
'class' => 'MouvementStock',
'table' => 'stock_mouvement',
'test' => ($conf->stock->enabled && $user->rights->stock->mouvement->lire && ! empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW))
),
'agenda' => array(
'title' => "ListActionsAssociatedProject",
'class' => 'ActionComm',
'table' => 'actioncomm',
'disableamount' => 1,
'test' => $conf->agenda->enabled && $user->rights->agenda->allactions->lire
)
);
//Insert reference

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017-2018 Ferran Marcet <fmarcet@2byte.es>
*
* 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

View File

@ -495,7 +495,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($object->lines[$i]->remise_percent)
{
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails);
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent."%", 0, 'R');
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent, 0, 'R');
}
// Total HT line

View File

@ -193,6 +193,21 @@ if ($action == 'presend')
);
complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters);
// Find the good contact adress
$custcontact = '';
$contactarr = array();
$contactarr = $object->liste_contact(- 1, 'external');
if (is_array($contactarr) && count($contactarr) > 0) {
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
$contactstatic = new Contact($db);
foreach ($contactarr as $contact) {
$contactstatic->fetch($contact['id']);
$substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($langs, 1);
}
}
// Tableau des substitutions
$formmail->substit = $substitutionarray;

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT."/core/class/html.formcron.class.php";
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'cron'));
$langs->loadLangs(array('admin', 'cron', 'members'));
if (!$user->rights->cron->create) accessforbidden();

View File

@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/cron.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin","cron","bills"));
$langs->loadLangs(array("admin","cron","bills","members"));
if (!$user->rights->cron->read) accessforbidden();

View File

@ -957,6 +957,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled))
{
$projectid = GETPOST('projectid','int')?GETPOST('projectid','int'):0;
if(empty($projectid) && ! empty($object->fk_project)) $projectid = $object->fk_project;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load("projects");

View File

@ -313,7 +313,7 @@ class Expedition extends CommonObject
}
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
$result=$this->insertExtraFields();
if ($result < 0)
@ -541,8 +541,7 @@ class Expedition extends CommonObject
*/
$result=$this->fetch_thirdparty();
// Retreive all extrafield
// fetch optionals attributes and labels
// Retreive extrafields
$this->fetch_optionals();
/*
@ -2412,7 +2411,8 @@ class ExpeditionLigne extends CommonObjectLine
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet");
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
$result=$this->insertExtraFields();
if ($result < 0)

View File

@ -222,7 +222,7 @@ class Fichinter extends CommonObject
if (! $resql) $error++;
}
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
$result=$this->insertExtraFields();
if ($result < 0)
@ -278,6 +278,7 @@ class Fichinter extends CommonObject
*/
function update($user, $notrigger=0)
{
global $conf;
if (! is_numeric($this->duration)) {
$this->duration = 0;
}
@ -285,6 +286,8 @@ class Fichinter extends CommonObject
$this->fk_project = 0;
}
$error = 0;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
@ -299,8 +302,16 @@ class Fichinter extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG);
if ($this->db->query($sql))
{
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('FICHINTER_MODIFY',$user);
@ -372,8 +383,7 @@ class Fichinter extends CommonObject
if ($this->statut == 0) $this->brouillon = 1;
// Retreive all extrafield
// fetch optionals attributes and labels
// Retreive extrafields
$this->fetch_optionals();
/*

View File

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

View File

@ -193,7 +193,7 @@ class PaiementFourn extends Paiement
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'paiementfourn (';
$sql.= 'ref, entity, datec, datep, amount, multicurrency_amount, fk_paiement, num_paiement, note, fk_user_author, fk_bank)';
$sql.= " VALUES ('".$this->db->escape($ref)."', ".$conf->entity.", '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
$sql.= " '".$this->db->idate($this->datepaye)."', '".$total."', '".$mtotal."', ".$this->paiementid.", '".$this->db->escape($this->num_paiement)."', '".$this->db->escape($this->note)."', ".$user->id.", 0)";
$resql = $this->db->query($sql);
if ($resql)

View File

@ -79,6 +79,8 @@ $search_total_ttc=GETPOST('search_total_ttc','alpha');
$optioncss = GETPOST('optioncss','alpha');
$search_billed = GETPOST('search_billed','int');
$search_project_ref=GETPOST('search_project_ref','alpha');
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$status=GETPOST('statut','alpha');
$viewstatut=GETPOST('viewstatut');
@ -94,7 +96,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -2898,7 +2898,7 @@ else
if ($resteapayeraffiche <= 0)
print $langs->trans('RemainderToPayBack');
else
print $langs->trans('ExcessPaydBack');
print $langs->trans('ExcessPaid');
print ' :</td>';
print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopay"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($sign * $resteapayeraffiche) . '</td>';
print '<td class="nowrap">&nbsp;</td></tr>';

View File

@ -69,7 +69,6 @@ $mode=GETPOST("mode");
$search_all = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_label = GETPOST("search_label","alpha");
$search_company = GETPOST("search_company","alpha");
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
$search_product_category=GETPOST('search_product_category','int');
@ -77,7 +76,7 @@ $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','al
$search_refsupplier=GETPOST('search_refsupplier','alpha');
$search_type=GETPOST('search_type','int');
$search_project=GETPOST('search_project','alpha');
$search_societe=GETPOST('search_societe','alpha');
$search_company=GETPOST('search_company','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_vat=GETPOST('search_montant_vat','alpha');
$search_montant_localtax1=GETPOST('search_montant_localtax1','alpha');
@ -99,6 +98,8 @@ $day_lim = GETPOST('day_lim','int');
$month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int');
$toselect = GETPOST('toselect', 'array');
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$option = GETPOST('option');
if ($option == 'late') {
@ -110,7 +111,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page=GETPOST("page",'int');
if ($page == -1 || $page == null) { $page = 0 ; }
if ($page == -1 || $page == null || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0 ; }
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -203,7 +204,6 @@ if (empty($reshook))
$search_type="";
$search_label="";
$search_project='';
$search_societe="";
$search_company="";
$search_amount_no_tax="";
$search_amount_all_tax="";
@ -315,13 +315,12 @@ if ($search_type != '' && $search_type >= 0)
//if ($search_type == '5') $sql.=" AND f.type = 5"; // situation
}
if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total_ht', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total_tva', $search_montant_vat, 1);
if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1);
@ -431,7 +430,7 @@ if ($resql)
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_societe)) $search_societe = $soc->name;
if (empty($search_company)) $search_company = $soc->name;
}
$param='&socid='.$socid;
@ -665,7 +664,7 @@ if ($resql)
// Thirpdarty
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_company" value="'.$search_company.'"></td>';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';

View File

@ -452,10 +452,15 @@ if ($action == 'confirm_valid')
$newSolde = $soldeActuel - ($nbopenedday * $object->getConfCP('nbHolidayDeducted'));
// On ajoute la modification dans le LOG
$object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type);
$result=$object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type);
if ($result<0) {
setEventMessages(null, $object->errors,'errors');
}
// Mise à jour du solde
$object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
$result=$object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type);
if ($result<0) {
setEventMessages(null, $object->errors,'errors');
}
// To
$destinataire = new User($db);

View File

@ -32,6 +32,10 @@
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
-- Forgot in < 4.0
ALTER TABLE llx_c_ziptown DROP FOREIGN KEY fk_c_ziptown_fk_pays;
ALTER TABLE llx_c_ziptown ADD CONSTRAINT fk_c_ziptown_fk_pays FOREIGN KEY (fk_pays) REFERENCES llx_c_country(rowid);
-- Forgot in 7.0
@ -46,11 +50,17 @@ ALTER TABLE llx_website_page ADD COLUMN type_container varchar(16) NOT NULL DEFA
ALTER TABLE llx_ecm_files DROP INDEX uk_ecm_files;
ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename, entity);
UPDATE llx_const set name = __ENCRYPT('INVOICE_FREE_TEXT')__ where name = __ENCRYPT('FACTURE_FREE_TEXT')__;
-- drop very old table (bad name)
DROP TABLE llx_c_accountancy_category;
DROP TABLE llx_c_accountingaccount;
-- drop old postgresql unique key
-- VPGSQL8.2 DROP INDEX llx_usergroup_rights_fk_usergroup_fk_id_key
update llx_propal set fk_statut = 1 where fk_statut = -1;
ALTER TABLE llx_inventory ADD COLUMN fk_user_creat integer;

View File

@ -1079,15 +1079,28 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
if ($db->type == "mysql" || $db->type == "mysqli")
{
$listoftables = $db->DDLListTables($db->database_name);
$force_utf8_on_tables = GETPOST('force_utf8_on_tables','alpha');
$listoftables = $db->DDLListTables($db->database_name);
// Disable foreign key checking for avoid errors
if ($force_utf8_on_tables == 'confirmed')
{
$sql='SET FOREIGN_KEY_CHECKS=0';
print '<!-- '.$sql.' -->';
$resql = $db->query($sql);
}
foreach($listoftables as $table)
{
// do not convert llx_const if mysql encrypt/decrypt is used
if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match('/\_const$/', $table)) continue;
print '<tr><td colspan="2">';
print $table;
$sql='ALTER TABLE '.$table.' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
print '<!-- '.$sql.' -->';
if (GETPOST('force_utf8_on_tables','alpha') == 'confirmed')
if ($force_utf8_on_tables == 'confirmed')
{
$resql = $db->query($sql);
print ' - Done ('.($resql?'OK':'KO').')';
@ -1095,6 +1108,14 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha'))
else print ' - Disabled';
print '</td></tr>';
}
// Enable foreign key checking
if ($force_utf8_on_tables == 'confirmed')
{
$sql='SET FOREIGN_KEY_CHECKS=1';
print '<!-- '.$sql.' -->';
$resql = $db->query($sql);
}
}
else
{

View File

@ -4472,7 +4472,7 @@ function migrate_delete_old_files($db,$langs,$conf)
$result=1;
if (file_exists($filetodelete))
{
$result=dol_delete_file($filetodelete);
$result=dol_delete_file($filetodelete,0,0,0,null,true);
if (! $result)
{
$langs->load("errors");

View File

@ -477,6 +477,8 @@ davDescription=Add a component to be a DAV server
DAVSetup=Setup of module DAV
DAV_ALLOW_PUBLIC_DIR=Enable the public directory (WebDav directory with no login required)
DAV_ALLOW_PUBLIC_DIRTooltip=The WebDav public directory is a WebDAV directory everybody can access to (in read and write mode), with no need to have/use an existing login/password account.
DAV_ALLOW_ECM_DIR=Enable the root directy of DMS/ECM module (login required)
DAV_ALLOW_ECM_DIRTooltip=The root directory where all files are manually uploaded when using the DMS/ECM module. Like for the feature from the web interface, you will need a valid login/password with granted permissions to access it.
# Modules
Module0Name=Users & Groups
Module0Desc=Users / Employees and Groups management
@ -1794,7 +1796,7 @@ EnterCalculationRuleIfPreviousFieldIsYes=Enter calculcation rule if previous fie
SeveralLangugeVariatFound=Several language variants found
COMPANY_AQUARIUM_REMOVE_SPECIAL=Remove special characters
COMPANY_AQUARIUM_CLEAN_REGEX=Regex filter to clean value (COMPANY_AQUARIUM_CLEAN_REGEX)
GDPRContact=GDPR contact
GDPRContact=Privacy Policies or GDPR contact
GDPRContactDesc=If you store data about European companies/citizen, you can store here the contact who is responsible for the General Data Protection Regulation
##### Resource ####
ResourceSetup=Configuration du module Resource

View File

@ -35,7 +35,7 @@ AgendaAutoActionDesc= Define here events for which you want Dolibarr to create a
AgendaSetupOtherDesc= This page provides options to allow export of your Dolibarr events into an external calendar (thunderbird, google calendar, ...)
AgendaExtSitesDesc=This page allows to declare external sources of calendars to see their events into Dolibarr agenda.
ActionsEvents=Events for which Dolibarr will create an action in agenda automatically
EventRemindersByEmailNotEnabled=Event reminders by email was not enabled into Agenda module setup.
EventRemindersByEmailNotEnabled=Event reminders by email was not enabled into %s module setup.
##### Agenda event labels #####
NewCompanyToDolibarr=Third party %s created
ContractValidatedInDolibarr=Contract %s validated

View File

@ -50,4 +50,4 @@ BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs modu
BlockedLogDisableNotAllowedForCountry=List of countries where usage of this module is mandatory (just to prevent to disable the module by error, if your country is in this list, disable of module is not possible without editing this list first. Note also that enabling/disabling this module will keep a track into the unalterable log).
OnlyNonValid=Non valid
TooManyRecordToScanRestrictFilters=Too many record to scan/analyze. Please restrict list with more restrictive filters.
RestrictYearToExport=Restrict year to export
RestrictYearToExport=Restrict month / year to export

View File

@ -5,10 +5,10 @@ SelectThirdParty=Select a third party
ConfirmDeleteCompany=Are you sure you want to delete this company and all inherited information?
DeleteContact=Delete a contact/address
ConfirmDeleteContact=Are you sure you want to delete this contact and all inherited information?
MenuNewThirdParty=new Third Party
MenuNewCustomer=new Customer
MenuNewProspect=new Prospect
MenuNewSupplier=new Vendor
MenuNewThirdParty=New Third Party
MenuNewCustomer=New Customer
MenuNewProspect=Nnew Prospect
MenuNewSupplier=New Vendor
MenuNewPrivateIndividual=New private individual
NewCompany=New company (prospect, customer, vendor)
NewThirdParty=New Third Party (prospect, customer, vendor)
@ -333,7 +333,7 @@ NoContactForAnyProposal=This contact is not a contact for any commercial proposa
NoContactForAnyContract=This contact is not a contact for any contract
NoContactForAnyInvoice=This contact is not a contact for any invoice
NewContact=New contact
NewContactAddress=new Contact/Address
NewContactAddress=New Contact/Address
MyContacts=My contacts
Capital=Capital
CapitalOf=Capital of %s

View File

@ -142,6 +142,7 @@ Closed=Closed
Closed2=Closed
NotClosed=Not closed
Enabled=Enabled
Enable=Enable
Deprecated=Deprecated
Disable=Disable
Disabled=Disabled

View File

@ -167,8 +167,9 @@ TypeContact_project_task_external_TASKCONTRIBUTOR=Contributor
SelectElement=Select element
AddElement=Link to element
# Documents models
DocumentModelBeluga=Project template for linked objects overview
DocumentModelBaleine=Project report template for tasks
DocumentModelBeluga=Project document template for linked objects overview
DocumentModelBaleine=Project document template for tasks
DocumentModelTimeSpent=Project report template for time spent
PlannedWorkload=Planned workload
PlannedWorkloadShort=Workload
ProjectReferers=Related items
@ -228,3 +229,4 @@ DontHavePermissionForCloseProject=You do not have permissions to close the proje
DontHaveTheValidateStatus=The project %s must be open to be closed
RecordsClosed=%s project(s) closed
SendProjectRef=Information project %s
ModuleSalaryToDefineHourlyRateMustBeEnabled=Module 'Payment of employee wages' must be enabled to define employee hourly rate to have time spent valorized

View File

@ -80,7 +80,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -916,7 +916,7 @@ class Product extends CommonObject
$action='update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
$result=$this->insertExtraFields();
if ($result < 0)

View File

@ -135,7 +135,7 @@ if (dol_strlen($type))
$sql.= " AND p.fk_product_type <> '1'";
}
}
if ($sref) $sql.= natural_search('p.ref', $ref);
if ($sref) $sql.= natural_search('p.ref', $sref);
if ($search_barcode) $sql.= natural_search('p.barcode', $search_barcode);
if ($snom) $sql.= natural_search('p.label', $snom);
if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell;

View File

@ -293,7 +293,7 @@ $sql.= ' ,'.$sqldesiredtock.' as desiredstock, '.$sqlalertstock.' as alertstock,
$sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique';
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
$sql.= ' ON p.rowid = s.fk_product';
$sql.= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN (SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))';
if($fk_supplier > 0) {
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')';
}

View File

@ -71,7 +71,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield='t.task_date,t.task_datehour,t.rowid';
if (! $sortorder) $sortorder='DESC';
if (! $sortorder) $sortorder='DESC,DESC,DESC';
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
//$object = new TaskTime($db);
@ -158,7 +158,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire)
else
{
$object->timespent_note = $_POST["timespent_note"];
$object->progress = GETPOST('progress', 'int');
if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value
$object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds
$object->timespent_duration+= $_POST["timespent_durationmin"]*60; // We store duration in seconds
if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered
@ -422,7 +422,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
{
if ($projectstatic->public || $userWrite > 0)
{
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1'.($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project
{
$backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':'');
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
}
else // We are on tab 'Time Spent' of task
{
$backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':'');
$linktocreatetime = '<a class="butActionNew" href="'.$_SERVER['PHP_SELF'].'?withproject=1'.($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl).'">'.$langs->trans('AddTimeSpent').'<span class="fa fa-plus-circle valignmiddle"></span></a>';
}
}
else
{
@ -600,7 +609,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
// Progress declared
print '<td class="nowrap">';
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress');
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1);
print '</td>';
print '<td align="center">';
@ -785,7 +794,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
// Progress declared
print '<td class="nowrap">';
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress');
print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1);
print '</td>';
print '<td align="center">';

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2018
/* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
*
* 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
@ -26,6 +26,7 @@ if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.p
if (! $res) die("Include of main fails");
if (empty($conf->stripe->enabled)) accessforbidden('',0,0,1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
@ -42,11 +43,13 @@ if (isset($_GET['connect'])){
{
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY;
$service = 'StripeTest';
$servicestatus = 0;
}
else
{
$endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY;
$service = 'StripeLive';
$servicestatus = 1;
}
}
else {
@ -54,11 +57,13 @@ else {
{
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
$service = 'StripeTest';
$servicestatus = 0;
}
else
{
$endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY;
$service = 'StripeLive';
$servicestatus = 1;
}
}
$payload = @file_get_contents("php://input");
@ -119,7 +124,7 @@ $stripe=new Stripe($db);
if ($event->type == 'payout.created') {
$error=0;
$result=dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s',$event->data->object->arrival_date), 'chaine', 0, '', $conf->entity);
$result=dolibarr_set_const($db, $servicestatus."_NEXTPAYOUT", date('Y-m-d H:i:s',$event->data->object->arrival_date), 'chaine', 0, '', $conf->entity);
if ($result > 0)
{
@ -139,7 +144,7 @@ if ($event->type == 'payout.created') {
elseif ($event->type == 'payout.paid') {
global $conf;
$error=0;
$result=dolibarr_set_const($db, $service."_NEXTPAYOUT",null,'chaine',0,'',$conf->entity);
$result=dolibarr_set_const($db, $servicestatus."_NEXTPAYOUT",null,'chaine',0,'',$conf->entity);
if ($result)
{
$langs->load("errors");
@ -227,19 +232,37 @@ elseif ($event->type == 'charge.failed') {
}
elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated==true)) {
$stripe=new Stripe($db);
$charge=$stripe->CreatePaymentStripe($event->data->object->amount/100,$event->data->object->currency,$event->data->object->metadata->source,$event->data->object->metadata->idsource,$event->data->object->id,$event->data->object->metadata->customer,$stripe->getStripeAccount($service));
$fulltag=$event->data->object->metadata->FULLTAG;
// Save into $tmptag all metadata
$tmptag=dolExplodeIntoArray($fulltag,'.','=');
if (! empty($tmptag['ORD'])){
$order=new Commande($db);
$order->fetch('',$tmptag['ORD']);
$origin='order';
$item=$order->id;
} elseif (! empty($tmptag['INV'])) {
$invoice = new Facture($db);
$invoice->fetch('',$tmptag['INV']);
$origin='invoice';
$item=$invoice->id;
}
$stripe=new Stripe($db);
$stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here)
$stripecu = $stripe->getStripeCustomerAccount($tmptag['CUS'], $servicestatus); // Get thirdparty cu_...
$charge=$stripe->createPaymentStripe($event->data->object->amount/100,$event->data->object->currency,$origin,$item,$event->data->object->id,$stripecu,$stripeacc,$servicestatus);
if (isset($charge->id) && $charge->statut=='error'){
$msg=$charge->message;
$code=$charge->code;
$error++;
}
elseif (isset($charge->id) && $charge->statut=='success' && $event->data->object->metadata->source=='order') {
$order=new Commande($db);
$order->fetch($event->data->object->metadata->idsource);
}
elseif (isset($charge->id) && $charge->statut=='success' && (! empty($tmptag['ORD']))) {
//$order=new Commande($db);
//$order->fetch('',$tmptag['ORD']);
$invoice = new Facture($db);
$idinv=$invoice->createFromOrder($order);
$idinv=$invoice->createFromOrder($order,$user);
if ($idinv > 0)
{
@ -265,7 +288,7 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type ==
if (!$error){
$datepaye = dol_now();
$paiementcode ="CB";
$paymentType ="CB";
$amounts=array();
$amounts[$invoice->id] = $total;
$multicurrency_amounts=array();
@ -274,7 +297,7 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type ==
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array with all payments dispatching
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
$paiement->paiementid = dol_getIdFromCode($db,$paiementcode,'c_paiement');
$paiement->paiementid = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1);
$paiement->num_paiement = $charge->message;
$paiement->note = '';
}

View File

@ -754,6 +754,7 @@ class Societe extends CommonObject
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update', $nosyncmember=1)
{
global $langs,$conf,$hookmanager;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (empty($id)) $id = $this->id;
@ -1053,7 +1054,7 @@ class Societe extends CommonObject
$action='update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)

View File

@ -289,6 +289,9 @@ if ($type_element == 'contract')
$thirdTypeSelect='customer';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
if (!empty($sql_select))
{
$sql = $sql_select;

View File

@ -90,6 +90,8 @@ $search_level_from = GETPOST("search_level_from","alpha");
$search_level_to = GETPOST("search_level_to","alpha");
$search_stcomm=GETPOST('search_stcomm','int');
$search_import_key = GETPOST("search_import_key","alpha");
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$type=GETPOST('type','alpha');
$optioncss=GETPOST('optioncss','alpha');
@ -103,7 +105,7 @@ $sortorder=GETPOST("sortorder",'alpha');
$page=GETPOST("page",'int');
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
if (empty($page) || $page == -1) { $page = 0; }
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php';
$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe'));
$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe','withdrawals'));
// Security check

View File

@ -1013,7 +1013,7 @@ class SupplierProposal extends CommonObject
$action='update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
$result=$this->insertExtraFields();
if ($result < 0)
@ -1022,7 +1022,7 @@ class SupplierProposal extends CommonObject
}
}
if (! $erro && ! $notrigger)
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('PROPAL_SUPPLIER_CREATE',$user);

View File

@ -69,6 +69,8 @@ $search_montant_vat=GETPOST('search_montant_vat','alpha');
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int');
$object_statut=$db->escape(GETPOST('supplier_proposal_statut'));
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
@ -81,7 +83,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;

View File

@ -39,7 +39,7 @@ CKEDITOR.editorConfig = function( config )
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['CreateDiv','ShowBlocks'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['Bold','Italic','Underline','Strike','Superscript'], // 'Subscript'
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['BidiLtr', 'BidiRtl'],
@ -58,7 +58,7 @@ CKEDITOR.editorConfig = function( config )
['Undo','Redo','-','Find','Replace'],
['CreateDiv','ShowBlocks'],
['Format','Font','FontSize'],
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
['NumberedList','BulletedList','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'],
@ -72,7 +72,7 @@ CKEDITOR.editorConfig = function( config )
['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone
['Undo','Redo','-','Find','Replace'],
['Format','Font','FontSize'],
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
['NumberedList','BulletedList','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'],

View File

@ -39,7 +39,7 @@ CKEDITOR.editorConfig = function( config )
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['CreateDiv','ShowBlocks'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['Bold','Italic','Underline','Strike','Superscript'], // 'Subscript'
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['BidiLtr', 'BidiRtl'],
@ -58,7 +58,7 @@ CKEDITOR.editorConfig = function( config )
['Undo','Redo','-','Find','Replace'],
['CreateDiv','ShowBlocks'],
['Format','Font','FontSize'],
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
['NumberedList','BulletedList','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor','Image','Table','HorizontalRule','SpecialChar'],
@ -72,7 +72,7 @@ CKEDITOR.editorConfig = function( config )
['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone
['Undo','Redo','-','Find','Replace'],
['Format','Font','FontSize'],
['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'],
['Bold','Italic','Underline','Strike','Superscript','-','TextColor','RemoveFormat'],
['NumberedList','BulletedList','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Image','Table','HorizontalRule','SpecialChar'],

View File

@ -3735,6 +3735,8 @@ tr.visible {
border: 0px;
background-color: transparent;
background-image: none;
color: #000 !important;
text-shadow: none;
}
.websitebar {
border-bottom: 1px solid #ccc;

View File

@ -1499,7 +1499,7 @@ else
// Date employment
print '<tr><td>'.$langs->trans("DateEmployment").'</td>';
print '<td>';
print dol_print_date($object->dateemployment);
print dol_print_date($object->dateemployment, 'day');
print '</td>';
print "</tr>\n";
@ -1823,7 +1823,7 @@ else
if ($caneditgroup)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removegroup&amp;group='.$group->id.'">';
print img_delete($langs->trans("RemoveFromGroup"));
print img_picto($langs->trans("RemoveFromGroup"), 'unlink');
print '</a>';
}
else

View File

@ -227,7 +227,7 @@ class Users extends DolibarrApi
}
/**
* add user to group
* Add a user into a group
*
* @param int $id User ID
* @param int $group Group ID
@ -236,6 +236,9 @@ class Users extends DolibarrApi
* @url GET {id}/setGroup/{group}
*/
function setGroup($id, $group) {
global $conf;
//if (!DolibarrApiAccess::$user->rights->user->user->supprimer) {
//throw new RestException(401);
//}
@ -250,7 +253,9 @@ class Users extends DolibarrApi
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
$result = $this->useraccount->SetInGroup($group,1);
// When using API, action is done on entity of logged user because a user of entity X with permission to create user should not be able to
// hack the security by giving himself permissions on another entity.
$result = $this->useraccount->SetInGroup($group, DolibarrApiAccess::$user->entity > 0 ? DolibarrApiAccess::$user->entity : $conf->entity);
if (! ($result > 0))
{
throw new RestException(500, $this->useraccount->error);

View File

@ -135,7 +135,7 @@ class User extends CommonObject
public $default_c_exp_tax_cat;
public $default_range;
public $fields=array(
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'),
@ -1581,7 +1581,7 @@ class User extends CommonObject
$action='update';
// Actions on extra fields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
{
$result=$this->insertExtraFields();
if ($result < 0)

View File

@ -64,7 +64,9 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css')
llxHeader('',$langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')','','',0,0,$arrayofjs,$arrayofcss);
print load_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '<form action="'.DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'').'" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("ViewList")).'"></form>');
$morehtmlright = '<a class="nohover" href="'.DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'').'">'.$langs->trans("ViewList").'</a>';
print load_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', $morehtmlright);

View File

@ -292,8 +292,9 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$morehtmlright = '<a class="nohover" href="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'').'">'.$langs->trans("HierarchicView").'</a>';
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, $newcardbutton, '', $limit);
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_generic', 0, $morehtmlright.' '.$newcardbutton, '', $limit);
if ($sall)
{

View File

@ -1048,11 +1048,11 @@ function getProductsForCategory($authentication,$id,$lang='')
$res = $db->query($sql);
if ($res)
{
$iProduct = 0;
while ($rec = $db->fetch_array($res))
{
$obj = new Product($db);
$obj->fetch($rec['fk_'.$field]);
$iProduct = 0;
if($obj->status > 0 )
{
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);

View File

@ -317,7 +317,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
$conf->global->MAIN_FIRSTNAME_NAME_POSITION = 1; // Force setup for firstname then lastname
$conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname
$template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'.
'__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__';