Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-08-12 20:09:22 +02:00
commit dc8c4402ee
54 changed files with 332 additions and 219 deletions

View File

@ -464,7 +464,7 @@ class Adherent extends CommonObject
$action='update'; $action='update';
// Actions on extra fields // 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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -142,7 +142,7 @@ class AdherentType extends CommonObject
/** /**
* Met a jour en base donnees du type * 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 * @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, < 0 if KO
*/ */
@ -172,7 +172,7 @@ class AdherentType extends CommonObject
$action='update'; $action='update';
// Actions on extra fields // 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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

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

View File

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

View File

@ -65,6 +65,8 @@ class DolibarrApi
$this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect); $this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
$this->r->setAPIVersion(1); $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'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails // Actions to send emails
$trigger_name='MYOBJECT_SENTBYMAIL'; $trigger_name='ASSET_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; $autocopy='MAIN_MAIL_AUTOCOPY_ASSET_TO';
$trackid='asset'.$object->id; $trackid='asset'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; 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 = "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.= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql.= " WHERE entity = ".$conf->entity; $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); $dates = dol_get_first_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):1);
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12); $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.= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'";
} }
$sql.= " ORDER BY rowid ASC"; // Required so we get the first one $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 // Make the first fetch to get first line
$obj = $db->fetch_object($res); $obj = $db->fetch_object($res);
if ($obj)
$previoushash = $block_static->getPreviousHash(0, $obj->rowid); {
$firstid = $obj->rowid; $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 else
{ {
@ -144,14 +151,14 @@ else if (GETPOST('downloadcsv','alpha'))
if (! $error) 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 = "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.= " FROM ".MAIN_DB_PREFIX."blockedlog";
$sql.= " WHERE entity = ".$conf->entity; $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); $dates = dol_get_first_day(GETPOST('yeartoexport','int'), GETPOST('monthtoexport','int')?GETPOST('monthtoexport','int'):1);
$datee = dol_get_last_day(GETPOST('yeartoexport','int'), 12); $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.= " 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() $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-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary"); 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') print $langs->transnoentities('Id')
.';'.$langs->transnoentities('Date') .';'.$langs->transnoentities('Date')
@ -321,7 +328,20 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
print '<div align="right">'; print '<div align="right">';
print $langs->trans("RestrictYearToExport").': '; 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="hidden" name="withtab" value="'.GETPOST('withtab','alpha').'">';
print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">'; 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>'; 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 // User
print '<td class="liste_titre">'; 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>'; print '</td>';
@ -373,6 +393,7 @@ print '</td>';
// Ref // Ref
print '<td class="liste_titre"><input type="text" class="maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>'; 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>'; print '<td class="liste_titre"></td>';
// Amount // Amount
@ -463,7 +484,6 @@ if (is_array($blocks))
// User // User
print '<td>'; print '<td>';
//print $block->getUser() //print $block->getUser()
print $block->user_fullname; print $block->user_fullname;
print '</td>'; print '</td>';
@ -475,7 +495,7 @@ if (is_array($blocks))
print '<td class="nowrap">'.$block->ref_object.'</td>'; print '<td class="nowrap">'.$block->ref_object.'</td>';
// Link to source object // 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 // Amount
print '<td align="right">'.price($block->amounts).'</td>'; 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>'; print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
// Fingerprint // Fingerprint
print '<td>'; print '<td class="nowrap">';
print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint'); print $form->textwithpicto(dol_trunc($block->signature, '8'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint'.$block->id);
print '</td>'; print '</td>';
// Status // Status

View File

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

View File

@ -1464,6 +1464,8 @@ class Propal extends CommonObject
*/ */
function update(User $user, $notrigger=0) function update(User $user, $notrigger=0)
{ {
global $conf;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -1512,17 +1514,23 @@ class Propal extends CommonObject
$error++; $this->errors[]="Error ".$this->db->lasterror(); $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 $error++;
$result=$this->call_trigger('PROPAL_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
} }
} }
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('PROPAL_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {

View File

@ -78,13 +78,15 @@ $search_day=GETPOST("search_day","int");
$search_month=GETPOST("search_month","int"); $search_month=GETPOST("search_month","int");
$search_year=GETPOST("search_year","int"); $search_year=GETPOST("search_year","int");
$search_dayfin=GETPOST("search_dayfin","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_yearfin=GETPOST("search_yearfin","int");
$search_daydelivery=GETPOST("search_daydelivery","int"); $search_daydelivery=GETPOST("search_daydelivery","int");
$search_monthdelivery=GETPOST("search_monthdelivery","int"); $search_monthdelivery=GETPOST("search_monthdelivery","int");
$search_yeardelivery=GETPOST("search_yeardelivery","int"); $search_yeardelivery=GETPOST("search_yeardelivery","int");
$search_availability=GETPOST('search_availability','int'); $search_availability=GETPOST('search_availability','int');
$search_categ_cus=trim(GETPOST("search_categ_cus",'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'); $viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
@ -98,7 +100,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $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; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -213,7 +215,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_month=''; $search_month='';
$search_day=''; $search_day='';
$search_yearfin=''; $search_yearfin='';
$search_monthfin=''; $search_month_end='';
$search_dayfin=''; $search_dayfin='';
$search_yeardelivery=''; $search_yeardelivery='';
$search_monthdelivery=''; $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_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_ref) $sql .= natural_search('p.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); 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_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')';
if ($search_societe) $sql .= natural_search('s.nom', $search_societe); 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))."'"; $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)) 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)) 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 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) else if ($search_yearfin > 0)
{ {
@ -432,7 +434,7 @@ if ($resql)
if ($search_year) $param.='&search_year='.urlencode($search_year); if ($search_year) $param.='&search_year='.urlencode($search_year);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_refcustomer) $param.='&search_refcustomer='.urlencode($search_refcustomer); 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_societe) $param.='&search_societe='.urlencode($search_societe);
if ($search_user > 0) $param.='&search_user='.urlencode($search_user); if ($search_user > 0) $param.='&search_user='.urlencode($search_user);
if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); 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 '<td class="liste_titre nowraponall" align="center">';
//print $langs->trans('Month').': '; //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).'">'; 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').': '; //print '&nbsp;'.$langs->trans('Year').': ';
$formother->select_year($search_yearfin,'search_yearfin',1, 20, 5); $formother->select_year($search_yearfin,'search_yearfin',1, 20, 5);
print '</td>'; print '</td>';

View File

@ -3067,17 +3067,23 @@ class Commande extends CommonOrder
$error++; $this->errors[]="Error ".$this->db->lasterror(); $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 $error++;
$result=$this->call_trigger('ORDER_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
} }
} }
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('ORDER_MODIFY', $user);
if ($result < 0) $error++;
// End call triggers
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {

View File

@ -78,6 +78,9 @@ $search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int'); $billed = GETPOST('billed','int');
$viewstatut=GETPOST('viewstatut'); $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 // Security check
$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int')); $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'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $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; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -1555,6 +1555,8 @@ class Facture extends CommonInvoice
*/ */
function update(User $user, $notrigger=0) function update(User $user, $notrigger=0)
{ {
global $conf;
$error=0; $error=0;
// Clean parameters // Clean parameters
@ -1620,17 +1622,23 @@ class Facture extends CommonInvoice
$error++; $this->errors[]="Error ".$this->db->lasterror(); $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 $error++;
$result=$this->call_trigger('BILL_MODIFY',$user);
if ($result < 0) $error++;
// End call triggers
} }
} }
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BILL_MODIFY',$user);
if ($result < 0) $error++;
// End call triggers
}
// Commit or rollback // Commit or rollback
if ($error) if ($error)
{ {
@ -4842,7 +4850,7 @@ class FactureLigne extends CommonInvoiceLine
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) { if ($resql && $resql->num_rows > 0) {
$res = $this->db->fetch_array($resql); $res = $this->db->fetch_array($resql);
return $res['situation_percent']; return floatval($res['situation_percent']);
} else { } else {
$this->error = $this->db->error(); $this->error = $this->db->error();
dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR); 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_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_user = GETPOST('search_user','int'); $search_user = GETPOST('search_user','int');
$search_sale = GETPOST('search_sale','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_month = GETPOST('search_month','int');
$search_year = GETPOST('search_year','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_month_lim = GETPOST('search_month_lim','int');
$search_year_lim = GETPOST('search_year_lim','int'); $search_year_lim = GETPOST('search_year_lim','int');
$search_categ_cus=trim(GETPOST("search_categ_cus",'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'); $option = GETPOST('search_option');
if ($option == 'late') { if ($option == 'late') {
@ -106,7 +108,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $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; $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 && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';

View File

@ -45,7 +45,10 @@ $result = restrictedArea($user, 'prelevement', '', '', 'bons');
$action = GETPOST('action','alpha'); $action = GETPOST('action','alpha');
$mode = GETPOST('mode','alpha')?GETPOST('mode','alpha'):'real'; $mode = GETPOST('mode','alpha')?GETPOST('mode','alpha'):'real';
$format = GETPOST('format','aZ09'); $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 * Actions
@ -196,13 +199,33 @@ $sql.= " AND pfd.traite = 0";
$sql.= " AND pfd.fk_facture = f.rowid"; $sql.= " AND pfd.fk_facture = f.rowid";
if ($socid) $sql.= " AND f.fk_soc = ".$socid; 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); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -219,7 +242,7 @@ if ($resql)
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($db); $bac = new CompanyBankAccount($db);
while ($i < $num && $i < 20) while ($i < $num && $i < $limit)
{ {
$obj = $db->fetch_object($resql); $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>'; else print '<tr '.$bc[0].'><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print "</table>"; print "</table>";
print "</form>";
print "<br>\n"; print "<br>\n";
} }
else else

View File

@ -371,15 +371,12 @@ class Contact extends CommonObject
$action='update'; $action='update';
// Actions on extra fields // 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(); $error++;
if ($result < 0)
{
$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)
$result=$this->insertExtraFields(); {
if ($result < 0) $error++;
{ }
$error++;
}
}
} }
// Insert contacts commerciaux ('SALESREPSIGN','contrat') // Insert contacts commerciaux ('SALESREPSIGN','contrat')
@ -1283,18 +1280,7 @@ class Contrat extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } if (! $resql) { $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)
{
// 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
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
if ($result < 0) 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 // Commit or rollback
if ($error) if ($error)
{ {

View File

@ -424,25 +424,25 @@ if (! $error && $massaction == 'confirm_presend')
if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYEMAIL'; if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYEMAIL';
if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYEMAIL'; if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYEMAIL';
if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_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 == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYEMAIL';
if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL'; if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL';
if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYEMAIL'; if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYEMAIL';
if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYEMAIL'; if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYEMAIL';
if (! empty($trigger_name)) if (! empty($triggername))
{ {
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db); $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; } if ($result < 0) { $error++; $errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
if ($error) if ($error)
{ {
setEventMessages($db->lasterror(), $errors, 'errors'); 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

@ -6913,7 +6913,7 @@ abstract class CommonObject
if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]=''; if (! empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key]='';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1)); //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++; $error++;
$this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']); $this->errors[]=$langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
@ -7074,15 +7074,12 @@ abstract class CommonObject
} }
// Update extrafield // 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(); $error++;
if ($result < 0)
{
$error++;
}
} }
} }

View File

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

View File

@ -1083,7 +1083,11 @@ class Form
else if (!is_array($selected)) $selected = array($selected); else if (!is_array($selected)) $selected = array($selected);
// Clean $filter that may contains sql conditions so sql code // 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 // 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"; $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
@ -4955,6 +4959,7 @@ class Form
} }
// Zone de saisie manuelle de la date // 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.='<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidth75" maxlength="11" value="'.$formated_date.'"';
$retstring.=($disabled?' disabled':''); $retstring.=($disabled?' disabled':'');
$retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring.=' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
@ -4978,6 +4983,7 @@ class Form
$retstring.='<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"),'calendarday','class="datecallink"').'</button>'; $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.'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.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
$retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n"; $retstring.='<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";
@ -6344,7 +6350,7 @@ class Form
$disabled = ($disabled ? ' disabled' : ''); $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 ($useempty) $resultyesno .= '<option value="-1"'.(($value < 0)?' selected':'').'>&nbsp;</option>'."\n";
if (("$value" == 'yes') || ($value == 1)) if (("$value" == 'yes') || ($value == 1))
{ {

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 $nophperrors Disable all PHP output errors
* @param int $nohook Disable all hooks * @param int $nohook Disable all hooks
* @param object $object Current object in use * @param object $object Current object in use
* @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 * @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 * @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 $db, $conf, $user, $langs;
global $hookmanager; global $hookmanager;
@ -1148,7 +1149,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
// Security: // Security:
// We refuse transversal using .. and pipes into filenames. // 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); dol_syslog("Refused to delete file ".$file, LOG_WARNING);
return false; return false;

View File

@ -6354,7 +6354,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)
$ret=''; $ret='';
// If order not defined, we use the setup // 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')) if ($nameorder && ((string) $nameorder != '2'))
{ {
$ret.=$firstname; $ret.=$firstname;

View File

@ -1885,13 +1885,13 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
{ {
$prev_progress = 0; $prev_progress = 0;
$progress = 1; $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); $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
$progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100; $progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100;
} }
$result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs); $result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs);
} }
else else
$result.=price($sign * $total_ht, 0, $outputlangs); $result.=price($sign * $total_ht, 0, $outputlangs);
} }

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * 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 * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

@ -7,7 +7,7 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * 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 * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -436,7 +436,7 @@ class pdf_crabe extends ModelePDFFactures
{ {
$tab_top -= 2; $tab_top -= 2;
$substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object); $substitutionarray=pdf_getSubstitutionArray($outputlangs, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object);
$notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs);

View File

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

View File

@ -67,7 +67,7 @@ class doc_generic_project_odt extends ModelePDFProjects
function __construct($db) function __construct($db)
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
// Load traductions files requiredby by page // Load traductions files requiredby by page
$langs->loadLangs(array("companies", "main")); $langs->loadLangs(array("companies", "main"));
@ -130,12 +130,9 @@ class doc_generic_project_odt extends ModelePDFProjects
$array_key.'_statut'=>$object->getLibStatut() $array_key.'_statut'=>$object->getLibStatut()
); );
// Retrieve extrafields
$extrafieldkey=$object->element;
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $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(); $object->fetch_optionals();
$resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); $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; global $conf;
return array( $resarray = array(
'task_ref'=>$task->ref, 'task_ref'=>$task->ref,
'task_fk_project'=>$task->fk_project, 'task_fk_project'=>$task->fk_project,
'task_projectref'=>$task->projectref, 'task_projectref'=>$task->projectref,
@ -170,6 +167,16 @@ class doc_generic_project_odt extends ModelePDFProjects
'task_note_private'=>$task->note_private, 'task_note_private'=>$task->note_private,
'task_note_public'=>$task->note_public '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;
} }
/** /**
@ -452,7 +459,7 @@ class doc_generic_project_odt extends ModelePDFProjects
if (! is_object($outputlangs)) $outputlangs=$langs; if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output; $sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8'; $outputlangs->charset_output='UTF-8';
// Load translation files required by the page // Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects")); $outputlangs->loadLangs(array("main", "dict", "companies", "projects"));

View File

@ -6,7 +6,7 @@
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * 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 * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by

View File

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

View File

@ -313,7 +313,7 @@ class Expedition extends CommonObject
} }
// Actions on extra fields // 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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -541,8 +541,7 @@ class Expedition extends CommonObject
*/ */
$result=$this->fetch_thirdparty(); $result=$this->fetch_thirdparty();
// Retreive all extrafield // Retreive extrafields
// fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
/* /*
@ -2412,7 +2411,8 @@ class ExpeditionLigne extends CommonObjectLine
if ($resql) if ($resql)
{ {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet"); $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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -222,7 +222,7 @@ class Fichinter extends CommonObject
if (! $resql) $error++; 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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -285,6 +285,8 @@ class Fichinter extends CommonObject
$this->fk_project = 0; $this->fk_project = 0;
} }
$error = 0;
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET ";
@ -299,8 +301,16 @@ class Fichinter extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
if ($this->db->query($sql)) 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 // Call trigger
$result=$this->call_trigger('FICHINTER_MODIFY',$user); $result=$this->call_trigger('FICHINTER_MODIFY',$user);
@ -372,8 +382,7 @@ class Fichinter extends CommonObject
if ($this->statut == 0) $this->brouillon = 1; if ($this->statut == 0) $this->brouillon = 1;
// Retreive all extrafield // Retreive extrafields
// fetch optionals attributes and labels
$this->fetch_optionals(); $this->fetch_optionals();
/* /*

View File

@ -79,6 +79,8 @@ $search_total_ttc=GETPOST('search_total_ttc','alpha');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$search_billed = GETPOST('search_billed','int'); $search_billed = GETPOST('search_billed','int');
$search_project_ref=GETPOST('search_project_ref','alpha'); $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'); $status=GETPOST('statut','alpha');
$viewstatut=GETPOST('viewstatut'); $viewstatut=GETPOST('viewstatut');
@ -94,7 +96,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $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; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -69,7 +69,6 @@ $mode=GETPOST("mode");
$search_all = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $search_all = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_label = GETPOST("search_label","alpha"); $search_label = GETPOST("search_label","alpha");
$search_company = GETPOST("search_company","alpha");
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha"); $search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");
$search_amount_all_tax = GETPOST("search_amount_all_tax","alpha"); $search_amount_all_tax = GETPOST("search_amount_all_tax","alpha");
$search_product_category=GETPOST('search_product_category','int'); $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_refsupplier=GETPOST('search_refsupplier','alpha');
$search_type=GETPOST('search_type','int'); $search_type=GETPOST('search_type','int');
$search_project=GETPOST('search_project','alpha'); $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_ht=GETPOST('search_montant_ht','alpha');
$search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_vat=GETPOST('search_montant_vat','alpha');
$search_montant_localtax1=GETPOST('search_montant_localtax1','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'); $month_lim = GETPOST('month_lim','int');
$year_lim = GETPOST('year_lim','int'); $year_lim = GETPOST('year_lim','int');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$search_btn=GETPOST('button_search','alpha');
$search_remove_btn=GETPOST('button_removefilter','alpha');
$option = GETPOST('option'); $option = GETPOST('option');
if ($option == 'late') { if ($option == 'late') {
@ -110,7 +111,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page=GETPOST("page",'int'); $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 ; $offset = $limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -203,7 +204,6 @@ if (empty($reshook))
$search_type=""; $search_type="";
$search_label=""; $search_label="";
$search_project=''; $search_project='';
$search_societe="";
$search_company=""; $search_company="";
$search_amount_no_tax=""; $search_amount_no_tax="";
$search_amount_all_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_type == '5') $sql.=" AND f.type = 5"; // situation
} }
if ($search_project) $sql .= natural_search('p.ref', $search_project); 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_town) $sql.= natural_search('s.town', $search_town);
if ($search_zip) $sql.= natural_search("s.zip",$search_zip); if ($search_zip) $sql.= natural_search("s.zip",$search_zip);
if ($search_state) $sql.= natural_search("state.nom",$search_state); if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; 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_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_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_vat != '') $sql.= natural_search('f.total_tva', $search_montant_vat, 1);
if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 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 = new Societe($db);
$soc->fetch($socid); $soc->fetch($socid);
if (empty($search_societe)) $search_societe = $soc->name; if (empty($search_company)) $search_company = $soc->name;
} }
$param='&socid='.$socid; $param='&socid='.$socid;
@ -665,7 +664,7 @@ if ($resql)
// Thirpdarty // Thirpdarty
if (! empty($arrayfields['s.nom']['checked'])) 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 // 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>'; 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')); $newSolde = $soldeActuel - ($nbopenedday * $object->getConfCP('nbHolidayDeducted'));
// On ajoute la modification dans le LOG // 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 // 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 // To
$destinataire = new User($db); $destinataire = new User($db);

View File

@ -46,6 +46,8 @@ 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 DROP INDEX uk_ecm_files;
ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename, entity); 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 very old table (bad name)
DROP TABLE llx_c_accountancy_category; DROP TABLE llx_c_accountancy_category;

View File

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

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). 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 OnlyNonValid=Non-valid
TooManyRecordToScanRestrictFilters=Too many record to scan/analyze. Please restrict list with more restrictive filters. 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

@ -80,7 +80,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $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; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -933,7 +933,7 @@ class Product extends CommonObject
$action='update'; $action='update';
// Actions on extra fields // 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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

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

View File

@ -42,11 +42,13 @@ if (isset($_GET['connect'])){
{ {
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY; $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY;
$service = 'StripeTest'; $service = 'StripeTest';
$servicestatus = 0;
} }
else else
{ {
$endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY;
$service = 'StripeLive'; $service = 'StripeLive';
$servicestatus = 1;
} }
} }
else { else {
@ -54,11 +56,13 @@ else {
{ {
$endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY;
$service = 'StripeTest'; $service = 'StripeTest';
$servicestatus = 0;
} }
else else
{ {
$endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY; $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY;
$service = 'StripeLive'; $service = 'StripeLive';
$servicestatus = 1;
} }
} }
$payload = @file_get_contents("php://input"); $payload = @file_get_contents("php://input");
@ -226,19 +230,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)) { elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated==true)) {
$stripe=new Stripe($db); $fulltag=$event->data->object->metadata->FULLTAG;
$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)); // 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'){ if (isset($charge->id) && $charge->statut=='error'){
$msg=$charge->message; $msg=$charge->message;
$code=$charge->code; $code=$charge->code;
$error++; $error++;
} }
elseif (isset($charge->id) && $charge->statut=='success' && $event->data->object->metadata->source=='order') { elseif (isset($charge->id) && $charge->statut=='success' && (! empty($tmptag['ORD']))) {
$order=new Commande($db); //$order=new Commande($db);
$order->fetch($event->data->object->metadata->idsource); //$order->fetch('',$tmptag['ORD']);
$invoice = new Facture($db); $invoice = new Facture($db);
$idinv=$invoice->createFromOrder($order); $idinv=$invoice->createFromOrder($order,$user);
if ($idinv > 0) if ($idinv > 0)
{ {
@ -264,7 +286,7 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type ==
if (!$error){ if (!$error){
$datepaye = dol_now(); $datepaye = dol_now();
$paiementcode ="CB"; $paymentType ="CB";
$amounts=array(); $amounts=array();
$amounts[$invoice->id] = $total; $amounts[$invoice->id] = $total;
$multicurrency_amounts=array(); $multicurrency_amounts=array();
@ -273,7 +295,7 @@ elseif (($event->type == 'source.chargeable') && ($event->data->object->type ==
$paiement->datepaye = $datepaye; $paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array with all payments dispatching $paiement->amounts = $amounts; // Array with all payments dispatching
$paiement->multicurrency_amounts = $multicurrency_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->num_paiement = $charge->message;
$paiement->note = ''; $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) function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update', $nosyncmember=1)
{ {
global $langs,$conf,$hookmanager; global $langs,$conf,$hookmanager;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (empty($id)) $id = $this->id; if (empty($id)) $id = $this->id;
@ -1053,7 +1054,7 @@ class Societe extends CommonObject
$action='update'; $action='update';
// Actions on extra fields // 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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)

View File

@ -289,6 +289,9 @@ if ($type_element == 'contract')
$thirdTypeSelect='customer'; $thirdTypeSelect='customer';
} }
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
if (!empty($sql_select)) if (!empty($sql_select))
{ {
$sql = $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_level_to = GETPOST("search_level_to","alpha");
$search_stcomm=GETPOST('search_stcomm','int'); $search_stcomm=GETPOST('search_stcomm','int');
$search_import_key = GETPOST("search_import_key","alpha"); $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'); $type=GETPOST('type','alpha');
$optioncss=GETPOST('optioncss','alpha'); $optioncss=GETPOST('optioncss','alpha');
@ -103,7 +105,7 @@ $sortorder=GETPOST("sortorder",'alpha');
$page=GETPOST("page",'int'); $page=GETPOST("page",'int');
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom"; 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; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -1013,7 +1013,7 @@ class SupplierProposal extends CommonObject
$action='update'; $action='update';
// Actions on extra fields // 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(); $result=$this->insertExtraFields();
if ($result < 0) if ($result < 0)
@ -1022,7 +1022,7 @@ class SupplierProposal extends CommonObject
} }
} }
if (! $erro && ! $notrigger) if (! $error && ! $notrigger)
{ {
// Call trigger // Call trigger
$result=$this->call_trigger('PROPAL_SUPPLIER_CREATE',$user); $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_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int'); $search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int');
$object_statut=$db->escape(GETPOST('supplier_proposal_statut')); $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')); $sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $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'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $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; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

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

View File

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

View File

@ -67,7 +67,7 @@ class Users extends DolibarrApi
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
se
if(! DolibarrApiAccess::$user->rights->user->user->lire) { if(! DolibarrApiAccess::$user->rights->user->user->lire) {
throw new RestException(401, "You are not allowed to read list of users"); throw new RestException(401, "You are not allowed to read list of users");
} }

View File

@ -1611,7 +1611,7 @@ class User extends CommonObject
$action='update'; $action='update';
// Actions on extra fields // 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(); $result=$this->insertExtraFields();
if ($result < 0) 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); 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.'">'; 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) if ($sall)
{ {

View File

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