Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop_mc

This commit is contained in:
Regis Houssin 2017-10-03 17:01:39 +02:00
commit 9c2d053f74
162 changed files with 2553 additions and 1366 deletions

View File

@ -16,6 +16,8 @@ Following changes may create regressions for some external modules, but were nec
* The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__, * The substitution key for reference of object is now __REF__ whatever is the object (it replaces __ORDERREF__,
__PROPALREF__, ...) __PROPALREF__, ...)
* Some REST API to access the dictionary (country, town, ...) were moved into a common API. * Some REST API to access the dictionary (country, town, ...) were moved into a common API.
* Page bank/index.php and bank/bankentries.php were renamed into bank/list.php and bank/bankentries_list.php to
follow page naming conventions (so default filter/sort order features can also work).
***** ChangeLog for 6.0.1 compared to 6.0.* ***** ***** ChangeLog for 6.0.1 compared to 6.0.* *****

View File

@ -0,0 +1 @@
http://ec.europa.eu/eurostat/ramon/nomenclatures/index.cfm?TargetUrl=LST_CLS_DLD&StrNom=NACE_REV2&StrLanguageCode=FR&StrLayoutCode=#

View File

@ -87,7 +87,7 @@ if ($object->id > 0)
dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user'); dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -1431,7 +1431,7 @@ else
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
if (! empty($conf->societe->enabled)) $rowspan++; if (! empty($conf->societe->enabled)) $rowspan++;
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -1558,16 +1558,17 @@ class Adherent extends CommonObject
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small) * @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
* @param int $maxlen length max label * @param int $maxlen length max label
* @param string $option Page for link * @param string $option Page for link
* @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
* @param string $morecss Add more css on link * @param string $morecss Add more css on link
* @return string Chaine avec URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='',$morecss='') function getNomUrl($withpictoimg=0, $maxlen=0, $option='card', $mode='', $morecss='', $save_lastsearch_value=-1)
{ {
global $conf, $langs; global $conf, $langs;
@ -1591,15 +1592,24 @@ class Adherent extends CommonObject
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs); $label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
$label.='</div>'; $label.='</div>';
if ($option == 'card' || $option == 'category') if (empty($option) || $option == 'card' || $option == 'category')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.'"'; $url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
} }
if ($option == 'subscription') if ($option == 'subscription')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id.'"'; $url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
} }
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$link = '<a href="'.$url.'"';
$linkclose=""; $linkclose="";
if (empty($notooltip)) if (empty($notooltip))
{ {

View File

@ -110,7 +110,7 @@ if ($id > 0)
dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user'); dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -96,7 +96,7 @@ $head = member_prepare_head($object);
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user'); dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -74,7 +74,7 @@ if ($id)
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'].'">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -601,7 +601,7 @@ if ($rowid > 0)
dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user'); dol_fiche_head($head, 'subscription', $langs->trans("Member"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -365,7 +365,7 @@ if ($rowid > 0)
dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group'); dol_fiche_head($head, 'card', $langs->trans("MemberType"), -1, 'group');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -93,7 +93,7 @@ $head = member_type_prepare_head($object);
dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group'); dol_fiche_head($head, 'ldap', $langs->trans("MemberType"), -1, 'group');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -269,12 +269,12 @@ if ($mode != 'focus')
{ {
if ($mode != 'sortorder') if ($mode != 'sortorder')
{ {
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object')); // Must match list into GETPOST $substitutionarray=getCommonSubstitutionArray($langs, 2, array('object','objectamount')); // Must match list into GETPOST
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); unset($substitutionarray['__USER_SIGNATURE__']);
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>'; $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach($substitutionarray as $key => $val) foreach($substitutionarray as $key => $val)
{ {
$texthelp.=$key.'<br>'; $texthelp.=$key.' -> '.$val.'<br>';
} }
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click
} }

View File

@ -137,7 +137,17 @@ if ($action == 'update')
} }
} }
dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_METEO",$_POST["MAIN_DISABLE_METEO"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_USE_METEO_WITH_PERCENTAGE",GETPOST("MAIN_USE_METEO_WITH_PERCENTAGE"),'chaine',0,'',$conf->entity);
// For update value with percentage
$plus='';
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $plus = '_PERCENTAGE';
// Update values
for($i=0;$i<4;$i++) {
if(isset($_POST['MAIN_METEO'.$plus.'_LEVEL'.$i])) dolibarr_set_const($db, 'MAIN_METEO'.$plus.'_LEVEL'.$i, GETPOST('MAIN_METEO'.$plus.'_LEVEL'.$i, 'int'),'chaine',0,'',$conf->entity);
}
} }
@ -196,13 +206,6 @@ if ($action == 'edit')
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>'; print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
print '</table>'; print '</table>';
print '<br>';
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
print '<br>';
print '</form>';
} }
else else
{ {
@ -244,21 +247,30 @@ else
print '</table>'; print '</table>';
print '<br>';
// Boutons d'action
print '<div class="tabsAction">';
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>';
} }
print '<br>'; print '<br>';
// Show logo for weather // Show logo for weather
print $langs->trans("DescWeather").'<br>'; print $langs->trans("DescWeather").'<br>';
if($action == 'edit') {
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoPercentageMod'));
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->trans('MeteoStdMod'));
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
else $str_mode_enabled = $str_mode_percentage;
print '<a href="#" onclick="return false;" id="change_mode">'.$str_mode_enabled.'</a>';
print '<input type="hidden" id="MAIN_USE_METEO_WITH_PERCENTAGE" name="MAIN_USE_METEO_WITH_PERCENTAGE" value="'.$conf->global->MAIN_USE_METEO_WITH_PERCENTAGE.'" />';
print '<br><br>';
} else {
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) print $langs->trans('MeteoStdModEnabled');
else print $langs->trans('MeteoPercentageModEnabled');
print '<br><br>';
}
$offset=0; $offset=0;
$cursor=10; // By default $cursor=10; // By default
//if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET; //if (! empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
@ -267,36 +279,143 @@ $level0=$offset; if (! empty($conf->global->MAIN_METEO_LEVEL0)) $level
$level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1; $level1=$offset+1*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL1)) $level1=$conf->global->MAIN_METEO_LEVEL1;
$level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2; $level2=$offset+2*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL2)) $level2=$conf->global->MAIN_METEO_LEVEL2;
$level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3; $level3=$offset+3*$cursor; if (! empty($conf->global->MAIN_METEO_LEVEL3)) $level3=$conf->global->MAIN_METEO_LEVEL3;
$text=''; $options='height="60px"'; $text=''; $options='class="valignmiddle" height="60px"';
print '<table>';
print '<tr>';
print '<td>';
print img_weather($text,'weather-clear.png',$options);
print '</td><td>= '.$level0.'</td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td>';
print img_weather($text,'weather-few-clouds.png',$options);
print '</td><td>&lt;= '.$level1.'</td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td>';
print img_weather($text,'weather-clouds.png',$options);
print '</td><td>&lt;= '.$level2.'</td>';
print '</tr>';
print '<tr><td>';
print img_weather($text,'weather-many-clouds.png',$options);
print '</td><td>&lt;= '.$level3.'</td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td>';
print img_weather($text,'weather-storm.png',$options);
print '</td><td>&gt; '.$level3.'</td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '<td> &nbsp; &nbsp; &nbsp; &nbsp; </td>';
print '</tr>';
print '</table>'; if ($action == 'edit') {
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clear.png', $options);
print '= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-few-clouds.png',$options);
print '&lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clouds.png',$options);
print '&lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-many-clouds.png',$options);
print '&lt;= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
print '</div>';
print '</div>';
print '</div>';
print '<div id="percentage" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>';
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clear.png',$options);
print '= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-few-clouds.png',$options);
print '&lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clouds.png',$options);
print '&lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-many-clouds.png',$options);
print '&lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/>&nbsp;%</td>';
print '</div>';
print '</div>';
print '</div>';
?>
<script type="text/javascript">
$(document).ready(function() {
$("#change_mode").click(function() {
var use_percent = $("#MAIN_USE_METEO_WITH_PERCENTAGE");
var str_mode_std = "<?php print $str_mode_std; ?>";
var str_mode_percentage = "<?php print $str_mode_percentage; ?>";
if(use_percent.val() == 1) {
use_percent.val(0);
$("#standard").show();
$("#percentage").hide();
$(this).html(str_mode_std);
} else {
use_percent.val(1);
$("#standard").hide();
$("#percentage").show();
$(this).html(str_mode_percentage);
}
});
});
</script>
<?php
} else {
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clear.png',$options);
print '= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-few-clouds.png',$options);
print '&lt;= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clouds.png',$options);
print '&lt;= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-many-clouds.png',$options);
print '&lt;= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-storm.png',$options);
print '&gt; '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'&nbsp;%</td>';
print '</div>';
print '</div>';
} else {
print '<div>';
print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clear.png',$options);
print '= '.$level0;
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-few-clouds.png',$options);
print '&lt;= '.$level1;
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-clouds.png',$options);
print '&lt;= '.$level2;
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-many-clouds.png',$options);
print '&lt;= '.$level3;
print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text,'weather-storm.png',$options);
print '&gt; '.$level3;
print '</div>';
print '</div>';
}
}
print '</div>';
if($action == 'edit') {
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
print '<br></form>';
} else {
// Boutons d'action
print '<br><div class="tabsAction">';
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>';
}
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -56,9 +56,14 @@ class DolibarrApi
$this->db = $db; $this->db = $db;
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
$this->r = new Restler($production_mode, $refreshCache); $this->r = new Restler($production_mode, $refreshCache);
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$this->r->setBaseUrls(DOL_MAIN_URL_ROOT, $urlwithroot);
$urlwithouturlrootautodetect=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim(DOL_MAIN_URL_ROOT));
$urlwithrootautodetect=$urlwithouturlroot.DOL_URL_ROOT; // This is to use local domain autodetected by dolibarr from url
$this->r->setBaseUrls($urlwithouturlroot, $urlwithouturlrootautodetect);
$this->r->setAPIVersion(1); $this->r->setAPIVersion(1);
} }

View File

@ -1,5 +1,9 @@
<?php <?php
/* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr> /* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
*
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -21,7 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/ccountry.class.php';
/** /**
* API class for payment type (content of the paiement dictionary) * API class for dictionaries
* *
* @access protected * @access protected
* @class DolibarrApiAccess {@requires user,external} * @class DolibarrApiAccess {@requires user,external}
@ -47,13 +51,14 @@ class Dictionary extends DolibarrApi
* @param int $limit Number of items per page * @param int $limit Number of items per page
* @param int $page Page number {@min 0} * @param int $page Page number {@min 0}
* @param int $active Payment type is active or not {@min 0} {@max 1} * @param int $active Payment type is active or not {@min 0} {@max 1}
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')" * @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
* *
* @url GET payments * @url GET payment/types
* *
* @return List of payment types * @return array [List of payment types]
* *
* @throws RestException * @throws 400 RestException
* @throws 200 OK
*/ */
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
@ -67,9 +72,9 @@ class Dictionary extends DolibarrApi
{ {
if (! DolibarrApi::_checkFilters($sqlfilters)) if (! DolibarrApi::_checkFilters($sqlfilters))
{ {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -94,7 +99,7 @@ class Dictionary extends DolibarrApi
$list[] = $this->db->fetch_object($result); $list[] = $this->db->fetch_object($result);
} }
} else { } else {
throw new RestException(503, 'Error when retrieving list of payment types : '.$this->db->lasterror()); throw new RestException(400, $this->db->lasterror());
} }
return $list; return $list;
@ -449,4 +454,66 @@ class Dictionary extends DolibarrApi
return $list; return $list;
} }
/**
* Get the list of payments terms.
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number {@min 0}
* @param int $active Payment term is active or not {@min 0} {@max 1}
* @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')"
*
* @url GET payment/terms
*
* @return array List of payment terms
*
* @throws 400 RestException
* @throws 200 OK
*/
function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
$list = array();
$sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module";
$sql.= " FROM ".MAIN_DB_PREFIX."c_payment_term as t";
$sql.= " WHERE t.active = ".$active;
// Add sql filters
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
$sql .= $this->db->plimit($limit, $offset);
}
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
for ($i = 0; $i < $min; $i++) {
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(400, $this->db->lasterror());
}
return $list;
}
} }

View File

@ -22,6 +22,7 @@ use Luracast\Restler\Format\UploadFormat;
require_once DOL_DOCUMENT_ROOT.'/main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
/** /**
* API class for receive files * API class for receive files
@ -54,13 +55,57 @@ class Documents extends DolibarrApi
* *
* @param string $module_part Name of module or area concerned by file download ('facture', ...) * @param string $module_part Name of module or area concerned by file download ('facture', ...)
* @param string $ref Reference of object (This will define subdir automatically) * @param string $ref Reference of object (This will define subdir automatically)
* @param string $subdir Subdirectory (Only if ref not provided) * @param string $subdir NOT YET AVAILABLE : Subdirectory (Only if ref not provided)
* @return array List of documents * @return array List of documents
* *
* @throws RestException * @throws 400
* @throws 401
* @throws 200 OK
*/ */
public function index($module_part, $ref='', $subdir='') { public function index($module_part, $ref='', $subdir='') {
return array('note'=>'FeatureNotYetAvailable'); global $conf;
if (empty($module_part)) {
throw new RestException(400, 'bad value for parameter modulepart');
}
if (empty($ref) && empty($subdir)) {
throw new RestException(400, 'bad value for parameter ref or subdir');
}
if (empty($ref)) {
throw new RestException(404, 'FeatureNotYetAvailable');
}
if (!DolibarrApiAccess::$user->rights->ecm->read) {
throw new RestException(401);
}
$original_file = str_replace("../","/", $ref.'/'.$ref.'.pdf');
$refname=basename(dirname($original_file)."/");
$entity=$conf->entity;
$check_access = dol_check_secure_access_document($module_part,$original_file,$entity,DolibarrApiAccess::$user);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file'];
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
{
throw new RestException(401);
}
if (!$accessallowed) {
throw new RestException(401);
}
$filename = basename($original_file);
$original_file_osencoded=dol_osencode($original_file); // New file name encoded in OS encoding charset
if (! file_exists($original_file_osencoded))
{
throw new RestException(404, 'File not found');
}
$file_content=file_get_contents($original_file_osencoded);
return array('filename'=>$filename, 'content'=>base64_encode($file_content), 'encoding'=>'MIME base64 (base64_encode php function, http://php.net/manual/en/function.base64-encode.php)' );
} }

View File

@ -1202,14 +1202,13 @@ if ($id > 0)
// Link to other agenda views // Link to other agenda views
$out=''; $out='';
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
$out.='<br>'; $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_week&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
$linkback.=$out; $linkback.=$out;

View File

@ -911,55 +911,62 @@ class ActionComm extends CommonObject
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Objet user * @param User $user Objet user
* @param int $load_state_board Charge indicateurs this->nb de tableau de bord
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user) function load_board($user, $load_state_board=0)
{ {
global $conf, $langs; global $conf, $langs;
$sql = "SELECT a.id, a.datep as dp"; if(empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp";
$sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a"; else {
$sql.= ")"; $this->nb=array();
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql = "SELECT count(a.id) as nb";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; }
$sql.= " WHERE a.percent >= 0 AND a.percent < 100"; $sql.= " FROM (".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " AND a.entity IN (".getEntity('agenda').")"; $sql.= ")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")"; $sql.= " WHERE 1";
if(empty($load_state_board)) $sql.= " AND a.percent >= 0 AND a.percent < 100";
$sql.= " AND a.entity IN (".getEntity('agenda').")";
if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";
if ($user->societe_id) $sql.=" AND a.fk_soc = ".$user->societe_id;
if (! $user->rights->agenda->allactions->read) $sql.= " AND (a.fk_user_author = ".$user->id . " OR a.fk_user_action = ".$user->id . " OR a.fk_user_done = ".$user->id . ")";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$agenda_static = new ActionComm($this->db); if(empty($load_state_board)) {
$agenda_static = new ActionComm($this->db);
$response = new WorkboardResponse();
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
$response->label = $langs->trans("ActionsToDo");
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&amp;mainmenu=agenda';
if ($user->rights->agenda->allactions->read) $response->url.='&amp;filtert=-1';
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"');
}
// This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql))
{
if(empty($load_state_board)) {
$response->nbtodo++;
$agenda_static->datep = $this->db->jdate($obj->dp);
if ($agenda_static->hasDelay()) $response->nbtodolate++;
} else $this->nb["actionscomm"]=$obj->nb;
}
$response = new WorkboardResponse(); $this->db->free($resql);
$response->warning_delay = $conf->agenda->warning_delay/60/60/24; if(empty($load_state_board)) return $response;
$response->label = $langs->trans("ActionsToDo"); else return 1;
$response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&amp;mainmenu=agenda'; }
if ($user->rights->agenda->allactions->read) $response->url.='&amp;filtert=-1'; else
$response->img = img_object('',"action",'class="inline-block valigntextmiddle"'); {
dol_print_error($this->db);
// This assignment in condition is not a bug. It allows walking the results. $this->error=$this->db->error();
while ($obj=$this->db->fetch_object($resql)) return -1;
{ }
$response->nbtodo++;
$agenda_static->datep = $this->db->jdate($obj->dp);
if ($agenda_static->hasDelay()) {
$response->nbtodolate++;
}
}
return $response;
}
else
{
$this->error=$this->db->error();
return -1;
}
} }

View File

@ -128,14 +128,13 @@ if ($object->id > 0)
// Link to other agenda views // Link to other agenda views
$out=''; $out='';
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
$out.='<br>'; $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
$linkback.=$out; $linkback.=$out;

View File

@ -51,6 +51,8 @@ $result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions|
* View * View
*/ */
$form=new Form($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url); llxHeader('',$langs->trans("Agenda"),$help_url);
@ -66,14 +68,13 @@ $linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("B
// Link to other agenda views // Link to other agenda views
$out=''; $out='';
$out.=img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/peruser.php?action=show_peruser&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewPerUser").'</a>';
$out.='<br>'; $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
$out.=img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_month&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewCal").'</a>';
$out.=img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewWeek").'</a>';
$out.=img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"'); $out.='</li><li class="noborder litext">'.img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"');
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>'; $out.='<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action=show_day&year='.dol_print_date($object->datep,'%Y').'&month='.dol_print_date($object->datep,'%m').'&day='.dol_print_date($object->datep,'%d').'">'.$langs->trans("ViewDay").'</a>';
$linkback.=$out; $linkback.=$out;

View File

@ -1716,7 +1716,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">'; print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onclick="javascript:history.go(-1)">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';

View File

@ -149,7 +149,7 @@ dol_fiche_head($head, 'annual', $langs->trans("FinancialAccount"), -1, 'account'
$title=$langs->trans("FinancialAccount")." : ".$object->label; $title=$langs->trans("FinancialAccount")." : ".$object->label;
$link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start+1)."'>".img_next('', 'class="valignbottom"')."</a>":""); $link=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start-1)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$object->id."&year_start=".($year_start+1)."'>".img_next('', 'class="valignbottom"')."</a>":"");
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
if (!empty($id)) if (!empty($id))

View File

@ -23,7 +23,7 @@
*/ */
/** /**
* \file htdocs/compta/bank/bankentries.php * \file htdocs/compta/bank/bankentries_list.php
* \ingroup banque * \ingroup banque
* \brief List of bank transactions * \brief List of bank transactions
*/ */
@ -405,7 +405,7 @@ if ($id > 0 || ! empty($ref))
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
@ -447,7 +447,7 @@ if ($id > 0 || ! empty($ref))
if ($object->canBeConciliated() > 0) { if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate // If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) { if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
} else { } else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }
@ -559,7 +559,7 @@ if (! empty($thirdparty)) $mode_balance_ok=false;
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
dol_syslog('compta/bank/bankentries.php', LOG_DEBUG); dol_syslog('compta/bank/bankentries_list.php', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@ -76,7 +76,7 @@ if ($result)
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries.php?bid=$objp->rowid\">$objp->label</a></td>"; print "<td><a href=\"".DOL_URL_ROOT."/compta/bank/bankentries_list.php?bid=$objp->rowid\">$objp->label</a></td>";
print '<td align="right">'.$objp->nombre.'</td>'; print '<td align="right">'.$objp->nombre.'</td>';
print '<td align="right">'.price(abs($objp->somme))."</td>"; print '<td align="right">'.price(abs($objp->somme))."</td>";
print '<td align="right">'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."</td>"; print '<td align="right">'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."</td>";

View File

@ -262,7 +262,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->
if ($result > 0) if ($result > 0)
{ {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php"); header("Location: ".DOL_URL_ROOT."/compta/bank/list.php");
exit; exit;
} }
else else
@ -576,7 +576,7 @@ else
// Print form confirm // Print form confirm
print $formconfirm; print $formconfirm;
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -1161,50 +1161,88 @@ class Account extends CommonObject
*/ */
function load_board(User $user, $filteraccountid = 0) function load_board(User $user, $filteraccountid = 0)
{ {
global $conf, $langs; global $conf, $langs;
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
$sql = "SELECT b.rowid, b.datev as datefin"; $sql = "SELECT b.rowid, b.datev as datefin";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.rappro=0"; $sql.= " WHERE b.rappro=0";
$sql.= " AND b.fk_account = ba.rowid"; $sql.= " AND b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")"; $sql.= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable $sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
$sql.= " AND clos = 0"; $sql.= " AND clos = 0";
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid; if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$langs->load("banks"); $langs->load("banks");
$now=dol_now(); $now=dol_now();
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24; $response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
$response->label=$langs->trans("TransactionsToConciliate"); $response->label=$langs->trans("TransactionsToConciliate");
$response->url=DOL_URL_ROOT.'/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank'; $response->url=DOL_URL_ROOT.'/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank';
$response->img=img_object('',"payment"); $response->img=img_object('',"payment");
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$response->nbtodo++; $response->nbtodo++;
if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) { if ($this->db->jdate($obj->datefin) < ($now - $conf->bank->rappro->warning_delay)) {
$response->nbtodolate++; $response->nbtodolate++;
} }
} }
return $response; return $response;
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
}
/**
* Charge indicateurs this->nb de tableau de bord
* @param int $filteraccountid To get info for a particular account id
* @return int <0 if ko, >0 if ok
*/
function load_state_board($filteraccountid = 0)
{
global $user;
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
$sql = "SELECT count(b.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND (ba.rappro = 1 AND ba.courant != 2)"; // Compte rapprochable
$sql.= " AND clos = 0";
if ($filteraccountid) $sql.=" AND ba.rowid = ".$filteraccountid;
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
$this->nb["banklines"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
return -1;
}
} }
@ -1241,14 +1279,15 @@ class Account extends CommonObject
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto Include picto into link * @param int $withpicto Include picto into link
* @param string $mode ''=Link to card, 'transactions'=Link to transactions card * @param string $mode ''=Link to card, 'transactions'=Link to transactions card
* @param string $option ''=Show ref, 'reflabel'=Show ref+label * @param string $option ''=Show ref, 'reflabel'=Show ref+label
* @return string Chaine avec URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0, $mode='', $option='') function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1)
{ {
global $conf, $langs; global $conf, $langs;
@ -1268,20 +1307,28 @@ class Account extends CommonObject
if (empty($mode)) if (empty($mode))
{ {
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id.$linkclose; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id;
$linkend='</a>';
} }
else if ($mode == 'transactions') else if ($mode == 'transactions')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$this->id.$linkclose; $url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id;
$linkend='</a>';
} }
else if ($mode == 'receipts') else if ($mode == 'receipts')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id.$linkclose; $url = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id;
$linkend='</a>';
} }
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$link = '<a href="'.$url.$linkclose;
$linkend='</a>';
if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' '); if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' ');
$result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend; $result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend;
return $result; return $result;

View File

@ -117,7 +117,7 @@ if ($id > 0 || !empty($ref)) {
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -760,7 +760,7 @@ $head=bank_prepare_head($object);
dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0,'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
if ($account) if ($account)
{ {

View File

@ -58,7 +58,7 @@ $h++;
dol_fiche_head($head, $hselected, $langs->trans("LineRecord"), -1, 'account'); dol_fiche_head($head, $hselected, $langs->trans("LineRecord"), -1, 'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); dol_banner_tab($object, 'rowid', $linkback);

View File

@ -297,7 +297,7 @@ if ($result)
dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account'); dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($bankline, 'rowid', $linkback); dol_banner_tab($bankline, 'rowid', $linkback);

View File

@ -19,7 +19,7 @@
*/ */
/** /**
* \file htdocs/compta/bank/index.php * \file htdocs/compta/bank/list.php
* \ingroup banque * \ingroup banque
* \brief Home page of bank module * \brief Home page of bank module
*/ */
@ -611,7 +611,7 @@ foreach ($accounts as $key=>$type)
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td align="right">'; print '<td align="right">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -1, $obj->currency_code).'</a>'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, 0, -1, $obj->currency_code).'</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield']; if (! $i) $totalarray['totalbalancefield']=$totalarray['nbfield'];

View File

@ -328,7 +328,7 @@ if (empty($numref))
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account'); dol_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0,'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
@ -340,7 +340,7 @@ if (empty($numref))
if ($object->canBeConciliated() > 0) { if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate // If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) { if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&search_conciliated=0'.$param.'">'.$langs->trans("Conciliate").'</a>';
} else { } else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }

View File

@ -93,7 +93,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$head=bank_prepare_head($object); $head=bank_prepare_head($object);
dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), -1, 'account'); dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), -1, 'account');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);

View File

@ -378,7 +378,59 @@ class Invoices extends DolibarrApi
} }
/** /**
* Validate an order * Sets an invoice as draft
*
* @param int $id Order ID
* @param int $idwarehouse Warehouse ID
*
* @url POST {id}/settodraft
*
* @return array
*
* @throws 200
* @throws 304
* @throws 401
* @throws 404
* @throws 500
*
*/
function settodraft($id, $idwarehouse=-1)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->set_draft(DolibarrApiAccess::$user, $idwarehouse);
if ($result == 0) {
throw new RestException(304, 'Nothing done.');
}
if ($result < 0) {
throw new RestException(500, 'Error : '.$this->invoice->error);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice);
}
/**
* Validate an invoice
* *
* @param int $id Order ID * @param int $id Order ID
* @param int $idwarehouse Warehouse ID * @param int $idwarehouse Warehouse ID
@ -411,20 +463,82 @@ class Invoices extends DolibarrApi
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger); $result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
if ($result == 0) { if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated'); throw new RestException(304, 'Error nothing done. May be object is already validated');
} }
if ($result < 0) { if ($result < 0) {
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error); throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
} }
return array(
'success' => array( $result = $this->invoice->fetch($id);
'code' => 200, if( ! $result ) {
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')' throw new RestException(404, 'Invoice not found');
) }
);
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice);
} }
/**
* Sets an invoice as paid
*
* @param int $id Order ID
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
*
* @url POST {id}/settopaid
*
* @return array An invoice object
*
* @throws 200
* @throws 304
* @throws 401
* @throws 404
* @throws 500
*/
function settopaid($id, $close_code='', $close_note='')
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note);
if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error : '.$this->invoice->error);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice);
}
/** /**
* Clean sensible object datas * Clean sensible object datas
* *

View File

@ -1076,18 +1076,19 @@ class Facture extends CommonInvoice
} }
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* *
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param string $option Where point the link * @param string $option Where point the link
* @param int $max Maxlength of ref * @param int $max Maxlength of ref
* @param int $short 1=Return just URL * @param int $short 1=Return just URL
* @param string $moretitle Add more text to title tooltip * @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param int $addlinktonotes 1=Add link to notes * @param int $addlinktonotes 1=Add link to notes
* @return string String with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip=0,$addlinktonotes=0) function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $moretitle='', $notooltip=0, $addlinktonotes=0, $save_lastsearch_value=-1)
{ {
global $langs, $conf, $user, $form; global $langs, $conf, $user, $form;
@ -1100,6 +1101,14 @@ class Facture extends CommonInvoice
if ($short) return $url; if ($short) return $url;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$picto='bill'; $picto='bill';
if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice
if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note
@ -1737,7 +1746,7 @@ class Facture extends CommonInvoice
* @param User $user User making the deletion. * @param User $user User making the deletion.
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @param int $idwarehouse Id warehouse to use for stock change. * @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0=Refused, >0 if OK
*/ */
function delete($user, $notrigger=0, $idwarehouse=-1) function delete($user, $notrigger=0, $idwarehouse=-1)
{ {
@ -1748,9 +1757,13 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);
// TODO Test if there is at least one payment. If yes, refuse to delete. // Test to avoid invoice deletion (allowed if draft)
$test = $this->is_erasable();
if ($test <= 0) return $test;
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
if (! $error && ! $notrigger) if (! $error && ! $notrigger)
@ -3356,9 +3369,9 @@ class Facture extends CommonInvoice
/** /**
* Return if an invoice can be deleted * Return if an invoice can be deleted
* Rule is: * Rule is:
* If hidden option INVOICE_CAN_ALWAYS_BE_REMOVED is on, we can
* If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule
* If invoice is draft and ha a temporary ref -> yes * If invoice is draft and ha a temporary ref -> yes
* If hidden option INVOICE_CAN_ALWAYS_BE_REMOVED is on, we can. If hidden option INVOICE_CAN_NEVER_BE_REMOVED is on, we can't.
* If invoice has a definitive ref, is last, without payment and not dipatched into accountancy -> yes end of rule
* *
* @return int <0 if KO, 0=no, 1=yes * @return int <0 if KO, 0=no, 1=yes
*/ */
@ -3366,30 +3379,36 @@ class Facture extends CommonInvoice
{ {
global $conf; global $conf;
// on verifie si la facture est en numerotation provisoire
$facref = substr($this->ref, 1, 4);
if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // If draft invoice and ref not yet defined
{
return 1;
}
if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) return 1; if (! empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) return 1;
if (! empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) return 0; if (! empty($conf->global->INVOICE_CAN_NEVER_BE_REMOVED)) return 0;
// on verifie si la facture est en numerotation provisoire // TODO Test if there is at least one payment. If yes, refuse to delete.
$facref = substr($this->ref, 1, 4); // ...
// If not a draft invoice and not temporary invoice // If not a draft invoice and not temporary invoice
if ($facref != 'PROV') if ($facref != 'PROV')
{ {
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last'); $maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
$ventilExportCompta = $this->getVentilExportCompta(); $ventilExportCompta = $this->getVentilExportCompta();
// If there is no invoice into the reset range and not already dispatched, we can delete // If there is no invoice into the reset range and not already dispatched, we can delete
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1; if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
// If invoice to delete is last one and not already dispatched, we can delete // If invoice to delete is last one and not already dispatched, we can delete
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1; if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
if ($this->situation_cycle_ref) { if ($this->situation_cycle_ref) {
$last = $this->is_last_in_cycle(); $last = $this->is_last_in_cycle();
return $last; return $last;
} }
} }
else if ($this->statut == self::STATUS_DRAFT && $facref == 'PROV') // Si facture brouillon et provisoire
{
return 1;
}
return 0; return 0;
} }

View File

@ -144,7 +144,7 @@ if ($id > 0 || ! empty($ref))
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -113,7 +113,7 @@ if ($id > 0 || ! empty($ref))
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -1169,7 +1169,7 @@ else
// Recurring invoice content // Recurring invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/invoicetemplate_list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/invoicetemplate_list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref=''; $morehtmlref='';
if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2); if ($action != 'editref') $morehtmlref.=$form->editfieldkey($object->ref, 'ref', $object->ref, $object, $user->rights->facture->creer, '', '', 0, 2);

View File

@ -58,7 +58,7 @@ $totalpaye = $object->getSommePaiement();
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -81,7 +81,7 @@ if ($id > 0 || ! empty($ref))
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -151,7 +151,7 @@ if ($object->id > 0)
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer

View File

@ -526,21 +526,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
* List of unpaid invoices * List of unpaid invoices
*/ */
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, '; $sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
$sql.= ' f.datef as df, f.fk_soc as socid'; $sql.= ' f.datef as df, f.fk_soc as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')';
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS)) {
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON (f.fk_soc = s.rowid)';
}
$sql.= ' WHERE f.entity = '.$conf->entity;
$sql.= ' AND (f.fk_soc = '.$facture->socid; $sql.= ' AND (f.fk_soc = '.$facture->socid;
// Can pay invoices of all child of parent company
if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) { if(!empty($conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS) && !empty($facture->thirdparty->parent)) {
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')'; $sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->parent.')';
} }
// Can pay invoices of all child of myself
if(!empty($conf->global->FACTURE_PAYMENTS_ON_SUBSIDIARY_COMPANIES)){
$sql.= ' OR f.fk_soc IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'societe WHERE parent = '.$facture->thirdparty->id.')';
}
$sql.= ') AND f.paye = 0'; $sql.= ') AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled $sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
if ($facture->type != 2) if ($facture->type != 2)

View File

@ -481,10 +481,10 @@ class RemiseCheque extends CommonObject
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Objet user * @param User $user Objet user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user) function load_board($user)
{ {
@ -533,6 +533,45 @@ class RemiseCheque extends CommonObject
} }
/**
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 if ko, >0 if ok
*/
function load_state_board()
{
global $user;
if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe
$sql = "SELECT count(b.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account').")";
$sql.= " AND b.fk_type = 'CHQ'";
$sql.= " AND b.amount > 0";
$resql=$this->db->query($sql);
if ($resql)
{
while ($obj=$this->db->fetch_object($resql))
{
$this->nb["cheques"]=$obj->nb;
}
$this->db->free($resql);
return 1;
}
else
{
dol_print_error($this->db);
$this->error=$this->db->error();
return -1;
}
}
/** /**
* Build document * Build document
* *

View File

@ -203,7 +203,7 @@ if ($resql)
// Bank // Bank
print '<td>'; print '<td>';
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>'; if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"),'account').' '.$objp->label.'</a>';
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';

View File

@ -214,6 +214,12 @@ if ($action == 'create')
$pastmonthyear--; $pastmonthyear--;
} }
$datespmonth = GETPOST('datespmonth', 'int');
$datespday = GETPOST('datespday', 'int');
$datespyear = GETPOST('datespyear', 'int');
$dateepmonth = GETPOST('dateepmonth', 'int');
$dateepday = GETPOST('dateepday', 'int');
$dateepyear = GETPOST('dateepyear', 'int');
$datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear); $datesp=dol_mktime(0, 0, 0, $datespmonth, $datespday, $datespyear);
$dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear); $dateep=dol_mktime(23, 59, 59, $dateepmonth, $dateepday, $dateepyear);
@ -253,7 +259,7 @@ if ($action == 'create')
// Label // Label
print '<tr><td>'; print '<tr><td>';
print fieldLabel('Label','label',1).'</td><td>'; print fieldLabel('Label','label',1).'</td><td>';
print '<input name="label" id="label" class="minwidth300" value="'.($_POST["label"]?GETPOST("label",'',2):$langs->trans("SalaryPayment")).'">'; print '<input name="label" id="label" class="minwidth300" value="'.(GETPOST("label")?GETPOST("label"):$langs->trans("SalaryPayment")).'">';
print '</td></tr>'; print '</td></tr>';
// Date start period // Date start period

View File

@ -210,7 +210,7 @@ else
dol_fiche_head($head, 'agenda', $title, -1, 'contact'); dol_fiche_head($head, 'agenda', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -1064,7 +1064,7 @@ else
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -987,38 +987,52 @@ class Contact extends CommonObject
* Return name of contact with link (and eventually picto) * Return name of contact with link (and eventually picto)
* Use $this->id, $this->lastname, $this->firstname, this->civility_id * Use $this->id, $this->lastname, $this->firstname, this->civility_id
* *
* @param int $withpicto Include picto with link * @param int $withpicto Include picto with link
* @param string $option Where the link point to * @param string $option Where the link point to
* @param int $maxlen Max length of * @param int $maxlen Max length of
* @param string $moreparam Add more param into URL * @param string $moreparam Add more param into URL
* @return string String with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='') function getNomUrl($withpicto=0, $option='', $maxlen=0, $moreparam='', $save_lastsearch_value=-1)
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowContact") . '</u>';
$label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
//if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
$label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
$phonelist=array();
if ($this->phone_pro) $phonelist[]=$this->phone_pro;
if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
if ($this->phone_perso) $phonelist[]=$this->phone_perso;
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"'; $label = '<u>' . $langs->trans("ShowContact") . '</u>';
$linkclose=""; $label.= '<br><b>' . $langs->trans("Name") . ':</b> '.$this->getFullName($langs);
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) //if ($this->civility_id) $label.= '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id; // TODO Translate cibilty_id code
{ if (! empty($this->poste)) $label.= '<br><b>' . $langs->trans("Poste") . ':</b> '.$this->poste;
$label=$langs->trans("ShowContact"); $label.= '<br><b>' . $langs->trans("EMail") . ':</b> '.$this->email;
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; $phonelist=array();
} if ($this->phone_pro) $phonelist[]=$this->phone_pro;
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; if ($this->phone_mobile) $phonelist[]=$this->phone_mobile;
$linkclose.= ' class="classfortooltip">'; if ($this->phone_perso) $phonelist[]=$this->phone_perso;
$label.= '<br><b>' . $langs->trans("Phone") . ':</b> '.join(', ',$phonelist);
$label.= '<br><b>' . $langs->trans("Address") . ':</b> '.dol_format_address($this, 1, ' ', $langs);
$url = DOL_URL_ROOT.'/contact/card.php?id='.$this->id;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$url .= $moreparam;
$linkstart = '<a href="'.$url.'"';
$linkclose="";
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowContact");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.= ' class="classfortooltip">';
if (! is_object($hookmanager)) if (! is_object($hookmanager))
{ {
@ -1030,18 +1044,17 @@ class Contact extends CommonObject
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $linkclose = $hookmanager->resPrint; if ($reshook > 0) $linkclose = $hookmanager->resPrint;
$link.=$linkclose; $linkstart.=$linkclose;
$linkend='</a>'; $linkend='</a>';
if ($option == 'xxx') if ($option == 'xxx')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkstart = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>'; $linkend='</a>';
} }
if ($withpicto) $result.=($link.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' '); if ($withpicto) $result.=($linkstart.img_object($label, 'contact', 'class="classfortooltip"').$linkend.' ');
$result.=$link.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend; $result.=$linkstart.($maxlen?dol_trunc($this->getFullName($langs),$maxlen):$this->getFullName($langs)).$linkend;
return $result; return $result;
} }

View File

@ -107,7 +107,7 @@ if ($object->id)
$totalsize+=$file['size']; $totalsize+=$file['size'];
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -61,7 +61,7 @@ if ($id > 0)
dol_fiche_head($head, 'info', $title, -1, 'contact'); dol_fiche_head($head, 'info', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');

View File

@ -90,6 +90,8 @@ $head = contact_prepare_head($object);
dol_fiche_head($head, 'ldap', $title, -1, 'contact'); dol_fiche_head($head, 'ldap', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '<div class="fichecenter">'; print '<div class="fichecenter">';

View File

@ -75,7 +75,7 @@ if ($id > 0)
dol_fiche_head($head, 'note', $title, -1, 'contact'); dol_fiche_head($head, 'note', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -231,7 +231,7 @@ else
dol_fiche_head($head, 'perso', $title, -1, 'contact'); dol_fiche_head($head, 'perso', $title, -1, 'contact');
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))

View File

@ -1311,7 +1311,7 @@ else
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -1938,19 +1938,29 @@ class Contrat extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlength Max length of ref * @param int $maxlength Max length of ref
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0,$maxlength=0,$notooltip=0) function getNomUrl($withpicto=0, $maxlength=0, $notooltip=0, $save_lastsearch_value=-1)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
$result=''; $result='';
$url = DOL_URL_ROOT.'/contrat/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/contrat/card.php?id='.$this->id;
$picto = 'contract';
//if ($option !== 'nolink')
//{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
//}
$picto = 'contract';
$label = ''; $label = '';
if ($user->rights->contrat->lire) { if ($user->rights->contrat->lire) {

View File

@ -134,7 +134,7 @@ if ($id > 0 || ! empty($ref))
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -107,7 +107,7 @@ if ($object->id)
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -62,7 +62,7 @@ dol_fiche_head($head, 'info', $langs->trans("Contract"), -1, 'contract');
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -323,16 +323,17 @@ if ($resql)
} }
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall != '') $param.='&sall='.$sall; if ($sall != '') $param.='&sall='.urlencode($sall);
if ($search_contract != '') $param.='&search_contract='.$search_contract; if ($search_contract != '') $param.='&search_contract='.urlencode($search_contract);
if ($search_name != '') $param.='&search_name='.$search_name; if ($search_name != '') $param.='&search_name='.urlencode($search_name);
if ($search_email != '') $param.='&search_email='.$search_email; if ($search_email != '') $param.='&search_email='.urlencode($search_email);
if ($search_ref_supplier != '') $param.='&search_ref_supplier='.$search_ref_supplier; if ($search_ref_customer != '') $param.='&search_ref_customer='.urlencode($search_ref_customer);
if ($search_sale != '') $param.='&search_sale=' .$search_sale; if ($search_ref_supplier != '') $param.='&search_ref_supplier='.urlencode($search_ref_supplier);
if ($show_files) $param.='&show_files=' .$show_files; if ($search_sale != '') $param.='&search_sale=' .urlencode($search_sale);
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($show_files) $param.='&show_files=' .urlencode($show_files);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {
@ -600,6 +601,11 @@ if ($resql)
$contracttmp->ref_customer=$obj->ref_customer; $contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier; $contracttmp->ref_supplier=$obj->ref_supplier;
if ($obj->socid > 0)
{
$result=$socstatic->fetch($obj->socid);
}
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['c.ref']['checked'])) if (! empty($arrayfields['c.ref']['checked']))
{ {
@ -631,7 +637,13 @@ if ($resql)
} }
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>'; print '<td>';
//print '<a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a>';
if ($obj->socid > 0)
{
print $socstatic->getNomUrl(1, '');
}
print '</td>';
} }
if (! empty($arrayfields['s.email']['checked'])) if (! empty($arrayfields['s.email']['checked']))
{ {
@ -683,7 +695,6 @@ if ($resql)
print '<td>'; print '<td>';
if ($obj->socid > 0) if ($obj->socid > 0)
{ {
$result=$socstatic->fetch($obj->socid);
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user); $listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db); if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative=count($listsalesrepresentatives); $nbofsalesrepresentative=count($listsalesrepresentatives);

View File

@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref))
// Contract card // Contract card
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref=''; $morehtmlref='';

View File

@ -30,9 +30,9 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
if ($object->id) if ($object->id)
{ {
if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) if (! empty($upload_dirold) && ! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
$result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask')); $result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
else else
$result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask')); $result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'));
} }
} }
elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
@ -57,7 +57,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
if ($object->id) if ($object->id)
{ {
$urlfile = GETPOST('urlfile', 'alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). $urlfile = GETPOST('urlfile', 'alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
if (GETPOST('section')) $file = $upload_dir . "/" . $urlfile; // For a delete of GED module urlfile contains full path from upload_dir if (GETPOST('section', 'alpha')) $file = $upload_dir . "/" . $urlfile; // For a delete of GED module urlfile contains full path from upload_dir
else // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. else // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile.
{ {
$urlfile=basename($urlfile); $urlfile=basename($urlfile);
@ -116,7 +116,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
exit; exit;
} }
} }
elseif ($action == 'confirm_updateline' && GETPOST('save') && GETPOST('link', 'alpha')) elseif ($action == 'confirm_updateline' && GETPOST('save','alpha') && GETPOST('link', 'alpha'))
{ {
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$langs->load('link'); $langs->load('link');
@ -150,8 +150,8 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave'))
//var_dump($upload_dir);exit; //var_dump($upload_dir);exit;
if (! empty($upload_dir)) if (! empty($upload_dir))
{ {
$filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom')); $filenamefrom=dol_sanitizeFileName(GETPOST('renamefilefrom','alpha'));
$filenameto=dol_sanitizeFileName(GETPOST('renamefileto')); $filenameto=dol_sanitizeFileName(GETPOST('renamefileto','alpha'));
// Security: // Security:
// Disallow file with some extensions. We rename them. // Disallow file with some extensions. We rename them.

View File

@ -418,6 +418,21 @@ abstract class CommonDocGenerator
$resarray[$array_key.'_total_discount_ht'] = ''; $resarray[$array_key.'_total_discount_ht'] = '';
} }
// Fetch project information if there is a project assigned to this object
if ($object->element != "project" && ! empty($object->fk_project) && $object->fk_project > 0)
{
if (! is_object($object->project))
{
$object->fetch_projet();
}
$resarray[$array_key.'_project_ref'] = $object->project->ref;
$resarray[$array_key.'_project_title'] = $object->project->title;
$resarray[$array_key.'_project_description'] = $object->project->description;
$resarray[$array_key.'_project_date_start'] = dol_print_date($object->project->date_start, 'day');
$resarray[$array_key.'_project_date_end'] = dol_print_date($object->project->date_end, 'day');
}
// Add vat by rates // Add vat by rates
if (is_array($object->lines) && count($object->lines)>0) if (is_array($object->lines) && count($object->lines)>0)
{ {

View File

@ -4594,23 +4594,28 @@ abstract class CommonObject
}else { }else {
$colspan='3'; $colspan='3';
} }
switch($mode) { switch($mode) {
case "view": case "view":
$value=$this->array_options["options_".$key]; $value=$this->array_options["options_".$key];
break; break;
case "edit": case "edit":
if (isset($_POST["options_" . $key])) { // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
if (is_array($_POST["options_" . $key])) { $getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values.
// $_POST["options"] is an array but following code expects a comma separated string if (isset($getposttemp)) {
$value = implode(",", $_POST["options_" . $key]); if (is_array($getposttemp)) {
// $getposttemp is an array but following code expects a comma separated string
$value = implode(",", $getposttemp);
} else { } else {
$value = $_POST["options_" . $key]; $value = $getposttemp;
} }
} else { } else {
$value = $this->array_options["options_" . $key]; $value = $this->array_options["options_" . $key]; // No GET, no POST, no default value, so we take value of object.
} }
break; break;
} }
//var_dump($value);
if ($extrafields->attribute_type[$key] == 'separate') if ($extrafields->attribute_type[$key] == 'separate')
{ {
$out .= $extrafields->showSeparator($key); $out .= $extrafields->showSeparator($key);

View File

@ -893,7 +893,7 @@ class ExtraFields
if (! is_object($form)) $form=new Form($this->db); if (! is_object($form)) $form=new Form($this->db);
// TODO Must also support $moreparam // TODO Must also support $moreparam
$out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1); $out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, ($keysuffix != 'search_' ? 1 : 0), 1, 0, 1);
} }
elseif (in_array($type,array('int'))) elseif (in_array($type,array('int')))
{ {
@ -1323,7 +1323,8 @@ class ExtraFields
} }
elseif ($type == 'password') elseif ($type == 'password')
{ {
$out='<input type="password" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>'; // If prefix is 'search_', field is used as a filter, we use a common text field.
$out='<input type="'.($keysuffix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
} }
if (!empty($hidden)) { if (!empty($hidden)) {
$out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>'; $out='<input type="hidden" value="'.$value.'" name="'.$keysuffix.'options_'.$key.$keyprefix.'" id="'.$keysuffix.'options_'.$key.$keyprefix.'"/>';

View File

@ -5973,7 +5973,7 @@ class Form
if ($previous_ref || $next_ref || $morehtml) if ($previous_ref || $next_ref || $morehtml)
{ {
$ret.='<div class="pagination"><ul>'; $ret.='<div class="pagination paginationref"><ul class="right">';
} }
if ($morehtml) if ($morehtml)
{ {

View File

@ -57,21 +57,22 @@ class FormFile
/** /**
* Show form to upload a new file * Show form to upload a new file
* *
* @param string $url Url * @param string $url Url
* @param string $title Title zone (Title or '' or 'none') * @param string $title Title zone (Title or '' or 'none')
* @param int $addcancel 1=Add 'Cancel' button * @param int $addcancel 1=Add 'Cancel' button
* @param int $sectionid If upload must be done inside a particular ECM section * @param int $sectionid If upload must be done inside a particular ECM section
* @param int $perm Value of permission to allow upload * @param int $perm Value of permission to allow upload
* @param int $size Length of input file area. Deprecated. * @param int $size Length of input file area. Deprecated.
* @param Object $object Object to use (when attachment is done on an element) * @param Object $object Object to use (when attachment is done on an element)
* @param string $options Add an option column * @param string $options Add an option column
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
* @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
* @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile') function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile', $accept='')
{ {
global $conf,$langs, $hookmanager; global $conf,$langs, $hookmanager;
$hookmanager->initHooks(array('formfile')); $hookmanager->initHooks(array('formfile'));
@ -130,6 +131,7 @@ class FormFile
$out .= '<input class="flat minwidth400" type="file"'; $out .= '<input class="flat minwidth400" type="file"';
$out .= ((! empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic')?' name="userfile"':' name="userfile[]" multiple'); $out .= ((! empty($conf->global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic')?' name="userfile"':' name="userfile[]" multiple');
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
$out .= (!empty($accept)?' accept="'.$accept.'"':'accept=""');
$out .= '>'; $out .= '>';
$out .= ' '; $out .= ' ';
$out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"'; $out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';

View File

@ -506,26 +506,26 @@ function getDateFromFormat(val,format)
if (substr == "MM" ||substr == "M") if (substr == "MM" ||substr == "M")
{ {
month=getIntegerInString(val,d,1,2); month=getIntegerInString(val,d,1,2);
d -= 2- month.length; if (month) d -= 2- month.length;
} }
if (substr == "dd") if (substr == "dd")
{ {
day=getIntegerInString(val,d,1,2); day=getIntegerInString(val,d,1,2);
d -= 2- day.length; if (day) d -= 2- day.length;
} }
if (substr == "HH" ||substr == "hh" ) if (substr == "HH" ||substr == "hh" )
{ {
hour=getIntegerInString(val,d,1,2); hour=getIntegerInString(val,d,1,2);
d -= 2- hour.length; if (dhouray) d -= 2- hour.length;
} }
if (substr == "mm"){ if (substr == "mm"){
minute=getIntegerInString(val,d,1,2); minute=getIntegerInString(val,d,1,2);
d -= 2- minute.length; if (minute) d -= 2- minute.length;
} }
if (substr == "ss") if (substr == "ss")
{ {
seconde=getIntegerInString(val,d,1,2); seconde=getIntegerInString(val,d,1,2);
d -= 2- seconde.length; if (seconde) d -= 2- seconde.length;
} }
i+=substr.length; i+=substr.length;

View File

@ -42,7 +42,7 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'bankname'; $head[$h][2] = 'bankname';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries.php?id=" . $object->id; $head[$h][0] = DOL_URL_ROOT . "/compta/bank/bankentries_list.php?id=" . $object->id;
$head[$h][1] = $langs->trans("BankTransactions"); $head[$h][1] = $langs->trans("BankTransactions");
$head[$h][2] = 'journal'; $head[$h][2] = 'journal';
$h++; $h++;

View File

@ -1475,19 +1475,17 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
$destfull=$upload_dir . "/" . $TFile['name'][$i]; $destfull=$upload_dir . "/" . $TFile['name'][$i];
$destfile=$TFile['name'][$i]; $destfile=$TFile['name'][$i];
$savingdocmask = dol_sanitizeFileName($savingdocmask);
if ($savingdocmask) if ($savingdocmask)
{ {
$destfull=$upload_dir . "/" . preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask); $destfull=$upload_dir . "/" . preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
$destfile=preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask); $destfile=preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
} }
// lowercase extension // dol_sanitizeFileName the file name and lowercase extension
$info = pathinfo($destfull); $info = pathinfo($destfull);
$destfull = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']); $destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
$info = pathinfo($destfile); $info = pathinfo($destfile);
$destfile = $info['filename'].'.'.strtolower($info['extension']); $destfile = dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles); $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);

View File

@ -312,111 +312,126 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
{ {
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{ {
if (! empty($user->default_values)) // $user->default_values defined from menu default values if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
{ {
$qualified=1; if (isset($user->default_values[$relativepathstring]['createform']))
if (isset($user->default_values[$relativepathstring]['createform_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
{
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['createform_queries']);
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
foreach($tmpqueryarraytohave as $tmpquerytohave)
{
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
}
}
if ($qualified)
{ {
//var_dump($user->default_values[$relativepathstring]['createform']); foreach($user->default_values[$relativepathstring]['createform'] as $defkey => $defval)
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname]; {
$qualified = 0;
if ($defkey != '_noquery_')
{
$tmpqueryarraytohave=explode('&', $defkey);
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
$foundintru=0;
foreach($tmpqueryarraytohave as $tmpquerytohave)
{
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
}
if (! $foundintru) $qualified=1;
//var_dump($defkey.'-'.$qualified);
}
else $qualified = 1;
if ($qualified)
{
//var_dump($user->default_values[$relativepathstring][$defkey]['createform']);
if (isset($user->default_values[$relativepathstring]['createform'][$defkey][$paramname]))
{
$out = $user->default_values[$relativepathstring]['createform'][$defkey][$paramname];
break;
}
}
}
} }
} }
} }
// Management of default search_filters and sort order // Management of default search_filters and sort order
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) //elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{ {
if (! empty($user->default_values)) // $user->default_values defined from menu default values if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
{ {
//var_dump($user->default_values[$relativepathstring]); //var_dump($user->default_values[$relativepathstring]);
if ($paramname == 'sortfield') // Sorted on which fields ? if ($paramname == 'sortfield' || $paramname == 'sortorder') // Sorted on which fields ? ASC or DESC ?
{ {
$qualified=1; if (isset($user->default_values[$relativepathstring]['sortorder'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
{ {
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']); foreach($user->default_values[$relativepathstring]['sortorder'] as $defkey => $defval)
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
foreach($tmpqueryarraytohave as $tmpquerytohave)
{ {
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0; $qualified = 0;
} if ($defkey != '_noquery_')
} {
if ($qualified) $tmpqueryarraytohave=explode('&', $defkey);
{ $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the key of $user->default_values[path][sortorder] $foundintru=0;
{ foreach($tmpqueryarraytohave as $tmpquerytohave)
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , {
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val) if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
{ }
if ($out) $out.=', '; if (! $foundintru) $qualified=1;
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace); //var_dump($defkey.'-'.$qualified);
} }
else $qualified = 1;
if ($qualified)
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
foreach($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val)
{
if ($out) $out.=', ';
if ($paramname == 'sortfield')
{
$out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
}
if ($paramname == 'sortorder')
{
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
}
}
//break; // No break for sortfield and sortorder so we can cumulate fields (is it realy usefull ?)
}
} }
} }
} }
elseif ($paramname == 'sortorder') // ASC or DESC ? elseif (isset($user->default_values[$relativepathstring]['filters']))
{ {
$qualified=1; foreach($user->default_values[$relativepathstring]['filters'] as $defkey => $defval)
if (isset($user->default_values[$relativepathstring]['sortorder_queries']))
{ {
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']); $qualified = 0;
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); if ($defkey != '_noquery_')
foreach($tmpqueryarraytohave as $tmpquerytohave)
{
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
}
}
if ($qualified)
{
if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the val of $user->default_values[path][sortorder]
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
{
if ($out) $out.=', ';
$out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
}
}
}
}
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname]))
{
$qualified=1;
if (isset($user->default_values[$relativepathstring]['filters_queries']))
{
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['filters_queries']);
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
foreach($tmpqueryarraytohave as $tmpquerytohave)
{
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
}
}
if ($qualified)
{
if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
{ {
// We made a search from quick search menu, do we still use default filter ? $tmpqueryarraytohave=explode('&', $defkey);
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
$foundintru=0;
foreach($tmpqueryarraytohave as $tmpquerytohave)
{ {
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
} }
if (! $foundintru) $qualified=1;
//var_dump($defkey.'-'.$qualified);
} }
else else $qualified = 1;
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and , if ($qualified)
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace); {
} if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
} {
// We made a search from quick search menu, do we still use default filter ?
if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
}
}
else
{
$forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
}
break;
}
}
} }
} }
} }
@ -424,14 +439,14 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
} }
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters) // Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
// Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ... // Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
// We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
if (! is_array($out) && empty($_POST[$paramname])) if (! is_array($out) && empty($_POST[$paramname]))
{
$maxloop=20; $loopnb=0; // Protection against infinite loop
while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
{ {
$maxloop=20; $loopnb=0; // Protection against infinite loop
while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
{
$loopnb++; $newout = ''; $loopnb++; $newout = '';
if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; } if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; }
@ -462,57 +477,57 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
else $newout = ''; // Key not found, we replace with empty string else $newout = ''; // Key not found, we replace with empty string
//var_dump('__'.$reg[1].'__ -> '.$newout); //var_dump('__'.$reg[1].'__ -> '.$newout);
$out = preg_replace('/__'.preg_quote($reg[1],'/').'__/', $newout, $out); $out = preg_replace('/__'.preg_quote($reg[1],'/').'__/', $newout, $out);
}
} }
}
// Check is done after replacement // Check is done after replacement
switch ($check) switch ($check)
{ {
case 'none': case 'none':
break; break;
case 'int': // Check param is a numeric value (integer but also float or hexadecimal) case 'int': // Check param is a numeric value (integer but also float or hexadecimal)
if (! is_numeric($out)) { $out=''; } if (! is_numeric($out)) { $out=''; }
break; break;
case 'intcomma': case 'intcomma':
if (preg_match('/[^0-9,]+/i',$out)) $out=''; if (preg_match('/[^0-9,]+/i',$out)) $out='';
break; break;
case 'alpha': case 'alpha':
$out=trim($out); $out=trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
if (preg_match('/"/',$out)) $out=''; if (preg_match('/"/',$out)) $out='';
else if (preg_match('/\.\.\//',$out)) $out=''; else if (preg_match('/\.\.\//',$out)) $out='';
break; break;
case 'san_alpha': case 'san_alpha':
$out=filter_var($out,FILTER_SANITIZE_STRING); $out=filter_var($out,FILTER_SANITIZE_STRING);
break; break;
case 'aZ': case 'aZ':
$out=trim($out); $out=trim($out);
if (preg_match('/[^a-z]+/i',$out)) $out=''; if (preg_match('/[^a-z]+/i',$out)) $out='';
break; break;
case 'aZ09': case 'aZ09':
$out=trim($out); $out=trim($out);
if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out=''; if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
break; break;
case 'array': case 'array':
if (! is_array($out) || empty($out)) $out=array(); if (! is_array($out) || empty($out)) $out=array();
break; break;
case 'nohtml': case 'nohtml':
$out=dol_string_nohtmltag($out); $out=dol_string_nohtmltag($out);
break; break;
case 'alphanohtml': // Recommended for search params case 'alphanohtml': // Recommended for search params
$out=trim($out); $out=trim($out);
// '"' is dangerous because param in url can close the href= or src= and add javascript functions. // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
// '../' is dangerous because it allows dir transversals // '../' is dangerous because it allows dir transversals
if (preg_match('/"/',$out)) $out=''; if (preg_match('/"/',$out)) $out='';
else if (preg_match('/\.\.\//',$out)) $out=''; else if (preg_match('/\.\.\//',$out)) $out='';
$out=dol_string_nohtmltag($out); $out=dol_string_nohtmltag($out);
break; break;
case 'custom': case 'custom':
if (empty($filter)) return 'BadFourthParameterForGETPOST'; if (empty($filter)) return 'BadFourthParameterForGETPOST';
$out=filter_var($out, $filter, $options); $out=filter_var($out, $filter, $options);
break; break;
} }
// Code for search criteria persistence. // Code for search criteria persistence.
// Save data into session if key start with 'search_' or is 'smonth', 'syear', 'month', 'year' // Save data into session if key start with 'search_' or is 'smonth', 'syear', 'month', 'year'
@ -745,7 +760,7 @@ function dol_size($size,$type='')
*/ */
function dol_sanitizeFileName($str,$newstr='_',$unaccent=1) function dol_sanitizeFileName($str,$newstr='_',$unaccent=1)
{ {
$filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"','°'); $filesystem_forbidden_chars = array('<','>','/','\\','?','*','|','"','°');
return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars); return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars);
} }

View File

@ -159,3 +159,19 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
return $rep; return $rep;
} }
/**
* Function get second level domain name.
* For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain'
*
* @param string $url Full URL.
* @return string Returns domaine name
*/
function getDomainFromURL($url)
{
$tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s)://
$tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain
$tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...)
$tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name
return $tmpdomain;
}

View File

@ -252,7 +252,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
{ {
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; //print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
if (empty($user->rights->$feature->creer) if (empty($user->rights->$feature->creer)
&& empty($user->rights->$feature->write)) { $createok=0; $nbko++; } && empty($user->rights->$feature->write)
&& empty($user->rights->$feature->create)) { $createok=0; $nbko++; }
} }
} }
@ -307,6 +308,10 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
{ {
if (! $user->rights->ftp->write) $deleteok=0; if (! $user->rights->ftp->write) $deleteok=0;
} }
else if ($feature == 'salaries')
{
if (! $user->rights->salaries->delete) $deleteok=0;
}
else if (! empty($feature2)) // This should be used for future changes else if (! empty($feature2)) // This should be used for future changes
{ {
foreach($feature2 as $subfeature) foreach($feature2 as $subfeature)

View File

@ -14,7 +14,7 @@ insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, left
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('propal|commande|fournisseur|contrat|ficheinter', '$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled', 5__+MAX_llx_menu__, __HANDLER__, 'top', 'commercial', '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 40, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('facture|don|tax|salaries|loan|banque', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 6__+MAX_llx_menu__, __HANDLER__, 'top', 'billing', '', 0, '/compta/index.php?mainmenu=billing&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read || $user->rights->banque->lire', '', 2, 50, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('comptabilite|accounting', '$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled || $conf->banque->enabled', 9__+MAX_llx_menu__, __HANDLER__, 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=accountancy', 'Accountancy', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 2, 51, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/index.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('banque|prelevement', '$conf->banque->enabled || $conf->prelevement->enabled', 14__+MAX_llx_menu__, __HANDLER__, 'top', 'bank', '', 0, '/compta/bank/list.php?mainmenu=bank&amp;leftmenu=bank', 'MenuBankCash', -1, 'banks', '$user->rights->banque->lire || $user->rights->prelevement->bons->lire', '', 0, 60, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('projet', '$conf->projet->enabled', 7__+MAX_llx_menu__, __HANDLER__, 'top', 'project', '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 2, 70, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '', 8__+MAX_llx_menu__, __HANDLER__, 'top', 'tools', '', 0, '/core/tools.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '', '', 2, 90, __ENTITY__);
insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__); insert into llx_menu (module, enabled, rowid, menu_handler, type, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('adherent', '$conf->adherent->enabled', 13__+MAX_llx_menu__, __HANDLER__, 'top', 'members', '', 0, '/adherents/index.php?mainmenu=members&amp;leftmenu=', 'Members', -1, 'members', '$user->rights->adherent->lire', '', 2, 110, __ENTITY__);
@ -224,7 +224,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 41, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuBankAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 51, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 52, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 52, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 53, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 53, __ENTITY__);
@ -283,10 +283,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2506__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/rejets.php?leftmenu=withdraw', 'Rejects', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->prelevement->enabled && $leftmenu=="withdraw"', __HANDLER__, 'left', 2507__+MAX_llx_menu__, 'accountancy', '', 2500__+MAX_llx_menu__, '/compta/prelevement/stats.php?leftmenu=withdraw', 'Statistics', 1, 'withdrawals', '$user->rights->prelevement->bons->lire', '', 2, 6, __ENTITY__);
-- Bank -- Bank
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled', __HANDLER__, 'left', 2600__+MAX_llx_menu__, 'accountancy', 'bank', 14__+MAX_llx_menu__, '/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&amp;leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/card.php?action=create&amp;leftmenu=bank', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0, __ENTITY__);
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__); -- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php?leftmenu=bank', 'Rubriques', 1, 'categories', '$user->rights->banque->configurer', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/bankentries_list.php?leftmenu=bank', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php?leftmenu=bank', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->banque->enabled && ($leftmenu=="bank" || $leftmenu=="checks" || $leftmenu=="withdraw")', __HANDLER__, 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/transfer.php?leftmenu=bank', 'BankTransfers', 1, 'banks', '$user->rights->banque->transfer', '', 0, 5, __ENTITY__);
-- Bank - Categories -- Bank - Categories

View File

@ -339,7 +339,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$numr = $db->num_rows($resql); $numr = $db->num_rows($resql);
$i = 0; $i = 0;
if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire); if ($numr > 0) $newmenu->add('/compta/bank/list.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr) while ($i < $numr)
{ {
@ -347,7 +347,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{ {
$newmenu->add('/compta/bank/bankentries.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $newmenu->add('/compta/bank/bankentries_list.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }
$i++; $i++;
} }

View File

@ -183,7 +183,7 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false)) || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{ {
// We add sub entry // We add sub entry
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic

View File

@ -201,7 +201,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='bank'; $idsel='bank';
$menu->add('/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname); $menu->add('/compta/bank/list.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname);
} }
// Projects // Projects
@ -977,7 +977,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/index.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 51); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 51);
} }
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)) if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
{ {
@ -1146,11 +1146,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Bank-Caisse // Bank-Caisse
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
$newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("MenuBankCash"),0,$user->rights->banque->lire, '', $mainmenu, 'bank');
$newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer); $newmenu->add("/compta/bank/card.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
$newmenu->add("/compta/bank/index.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank'); $newmenu->add("/compta/bank/list.php?leftmenu=bank&amp;mainmenu=bank",$langs->trans("List"),1,$user->rights->banque->lire, '', $mainmenu, 'bank');
$newmenu->add("/compta/bank/bankentries.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/bankentries_list.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire); $newmenu->add("/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
$newmenu->add("/compta/bank/transfer.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer); $newmenu->add("/compta/bank/transfer.php",$langs->trans("MenuBankInternalTransfer"),1,$user->rights->banque->transfer);
@ -1498,7 +1498,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$numr = $db->num_rows($resql); $numr = $db->num_rows($resql);
$i = 0; $i = 0;
if ($numr > 0) $newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire); if ($numr > 0) $newmenu->add('/compta/bank/list.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
while ($i < $numr) while ($i < $numr)
{ {
@ -1506,7 +1506,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire); $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{ {
$newmenu->add('/compta/bank/bankentries.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate); $newmenu->add('/compta/bank/bankentries_list.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
} }
$i++; $i++;
} }

View File

@ -193,7 +193,7 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false)) || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{ {
// We add sub entry // We add sub entry
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic

View File

@ -199,7 +199,7 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools'))) if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false)) || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
{ {
// We add sub entry // We add sub entry
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic

View File

@ -122,6 +122,8 @@ class pdf_paiement
$month = sprintf("%02d",$month); $month = sprintf("%02d",$month);
$year = sprintf("%04d",$year); $year = sprintf("%04d",$year);
$file = $dir . "/payments-".$year."-".$month.".pdf";
switch ($this->doc_type) { switch ($this->doc_type) {
case "client": case "client":
$file = $dir . "/payments-".$year."-".$month.".pdf"; $file = $dir . "/payments-".$year."-".$month.".pdf";

View File

@ -311,7 +311,7 @@ llxHeader($head, $langs->trans("Image"), '', '', 0, 0, array('/includes/jquery/p
print load_fiche_titre($langs->trans("ImageEditor")); print load_fiche_titre($langs->trans("ImageEditor"));
$infoarray=dol_getImageSize($dir."/".GETPOST("file")); $infoarray=dol_getImageSize($dir."/".GETPOST("file",'alpha'));
$height=$infoarray['height']; $height=$infoarray['height'];
$width=$infoarray['width']; $width=$infoarray['width'];
print $langs->trans("CurrentInformationOnImage").': '; print $langs->trans("CurrentInformationOnImage").': ';
@ -373,7 +373,7 @@ if (! empty($conf->use_javascript_ajax))
print $langs->trans("DefineNewAreaToPick").'...<br>'; print $langs->trans("DefineNewAreaToPick").'...<br>';
print '<br><div class="center">'; print '<br><div class="center">';
print '<div style="border: 1px solid #888888; width: '.$widthforcrop.'px;">'; print '<div style="border: 1px solid #888888; width: '.$widthforcrop.'px;">';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$object->entity.'&file='.$original_file.'" alt="" id="cropbox" width="'.$widthforcrop.'px"/>'; print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$object->entity.'&file='.urlencode($original_file).'" alt="" id="cropbox" width="'.$widthforcrop.'px"/>';
print '</div>'; print '</div>';
print '</div><br>'; print '</div><br>';
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST"> print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="POST">

View File

@ -79,7 +79,7 @@ $formfile->form_attach_new_file(
); );
$disablemove=1; $disablemove=1;
if ($modulepart == 'produit') $disablemove=0; if ($modulepart == 'product' || $modulepart == 'produit') $disablemove=0; // Drag and drop for up and down allowed on product
// List of document // List of document
$formfile->list_of_documents( $formfile->list_of_documents(

View File

@ -17,15 +17,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// $permission must be defined by caller. // $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create
// $cssclass must be defined by caller. For example cssclass='fieldtitle" // $cssclass must be defined by caller. For example $cssclass='fieldtitle"
$module = $object->element; $module = $object->element;
$note_public = 'note_public'; $note_public = 'note_public';
$note_private = 'note_private'; $note_private = 'note_private';
$colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':'')); $colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));
// Set $permission from the $permissionnote var defined on calling page
$permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page $permission=(isset($permissionnote)?$permissionnote:(isset($permission)?$permission:(isset($user->rights->$module->create)?$user->rights->$module->create:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0))));
$moreparam=(isset($moreparam)?$moreparam:''); $moreparam=(isset($moreparam)?$moreparam:'');
$value_public=$object->note_public; $value_public=$object->note_public;
$value_private=$object->note_private; $value_private=$object->note_private;

View File

@ -1439,7 +1439,7 @@ else if ($id || $ref)
} }
// Shipment card // Shipment card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer shipment
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1);

View File

@ -1486,14 +1486,15 @@ class Expedition extends CommonObject
/** /**
* Return clicable link of object (with eventually picto) * Return clicable link of object (with eventually picto)
* *
* @param int $withpicto Add picto into link * @param int $withpicto Add picto into link
* @param int $option Where point the link * @param int $option Where point the link
* @param int $max Max length to show * @param int $max Max length to show
* @param int $short Use short labels * @param int $short Use short labels
* @param int $notooltip 1=No tooltip * @param int $notooltip 1=No tooltip
* @return string String with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0) function getNomUrl($withpicto=0, $option=0, $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1)
{ {
global $langs; global $langs;
@ -1506,6 +1507,14 @@ class Expedition extends CommonObject
if ($short) return $url; if ($short) return $url;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose=''; $linkclose='';
if (empty($notooltip)) if (empty($notooltip))
{ {

View File

@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref))
// Shipment card // Shipment card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer shipment

View File

@ -42,9 +42,10 @@ $result = restrictedArea($user, 'expedition',$expeditionid,'');
$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id; $diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;
$search_ref_exp = GETPOST("search_ref_exp"); $search_ref_exp = GETPOST("search_ref_exp", 'alpha');
$search_ref_liv = GETPOST('search_ref_liv'); $search_ref_liv = GETPOST('search_ref_liv', 'alpha');
$search_company = GETPOST("search_company"); $search_ref_customer = GETPOST('search_ref_customer', 'alpha');
$search_company = GETPOST("search_company", 'alpha');
$search_town=GETPOST('search_town','alpha'); $search_town=GETPOST('search_town','alpha');
$search_zip=GETPOST('search_zip','alpha'); $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state")); $search_state=trim(GETPOST("search_state"));
@ -133,6 +134,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
{ {
$search_ref_exp=''; $search_ref_exp='';
$search_ref_liv=''; $search_ref_liv='';
$search_ref_customer='';
$search_company=''; $search_company='';
$search_town=''; $search_town='';
$search_zip=""; $search_zip="";
@ -213,6 +215,7 @@ if ($socid)
if ($viewstatut <> '' && $viewstatut >= 0) { if ($viewstatut <> '' && $viewstatut >= 0) {
$sql.= " AND e.fk_statut = ".$viewstatut; $sql.= " AND e.fk_statut = ".$viewstatut;
} }
if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer);
if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed; if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed;
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);
@ -262,13 +265,14 @@ if ($resql)
$expedition = new Expedition($db); $expedition = new Expedition($db);
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall) $param.= "&amp;sall=".$sall; if ($sall) $param.= "&amp;sall=".urlencode($sall);
if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp; if ($search_ref_exp) $param.= "&amp;search_ref_exp=".urlencode($search_ref_exp);
if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv; if ($search_ref_liv) $param.= "&amp;search_ref_liv=".urlencode($search_ref_liv);
if ($search_company) $param.= "&amp;search_company=".$search_company; if ($search_ref_customer) $param.= "&amp;search_ref_customer=".urlencode($search_ref_customer);
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss; if ($search_company) $param.= "&amp;search_company=".urlencode($search_company);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
foreach ($search_array_options as $key => $val) foreach ($search_array_options as $key => $val)
{ {

View File

@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref))
// Shipment card // Shipment card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer shipment

View File

@ -270,7 +270,7 @@ if ($id > 0 || ! empty($ref))
// Order card // Order card
$linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';

View File

@ -1454,7 +1454,7 @@ else
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
} }
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print '<table class="border" style="width:100%;">'; print '<table class="border" style="width:100%;">';
@ -1614,7 +1614,7 @@ else
print $formconfirm; print $formconfirm;
// Expense report card // Expense report card
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
/* /*

View File

@ -828,7 +828,7 @@ class ExpenseReport extends CommonObject
print '<tr>'; print '<tr>';
print '<td><a href="'.DOL_URL_ROOT.'/expensereport/card.php?id='.$objp->rowid.'">'.$objp->ref_num.'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/expensereport/card.php?id='.$objp->rowid.'">'.$objp->ref_num.'</a></td>';
print '<td align="center">'.dol_print_date($objp->date,'day').'</td>'; print '<td align="center">'.dol_print_date($objp->date,'day').'</td>';
print '<td>'.$author->getNomUrl().'</td>'; print '<td>'.$author->getNomUrl(1).'</td>';
print '<td>'.$objp->comments.'</td>'; print '<td>'.$objp->comments.'</td>';
print '<td align="right">'.price($objp->total_ht).'</td>'; print '<td align="right">'.price($objp->total_ht).'</td>';
print '<td align="right">'.price($objp->total_ttc).'</td>'; print '<td align="right">'.price($objp->total_ttc).'</td>';
@ -1525,14 +1525,15 @@ class ExpenseReport extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $max Max length of shown ref * @param int $max Max length of shown ref
* @param int $short 1=Return just URL * @param int $short 1=Return just URL
* @param string $moretitle Add more text to title tooltip * @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$max=0,$short=0,$moretitle='',$notooltip=0) function getNomUrl($withpicto=0, $max=0, $short=0, $moretitle='', $notooltip=0, $save_lastsearch_value=-1)
{ {
global $langs, $conf; global $langs, $conf;
@ -1554,6 +1555,14 @@ class ExpenseReport extends CommonObject
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if ($moretitle) $label.=' - '.$moretitle; if ($moretitle) $label.=' - '.$moretitle;
//if ($option != 'nolink')
//{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
//}
$ref=$this->ref; $ref=$this->ref;
if (empty($ref)) $ref=$this->id; if (empty($ref)) $ref=$this->id;

View File

@ -93,7 +93,7 @@ if ($object->id)
dol_fiche_head($head, 'documents', $langs->trans("ExpenseReport"), -1, 'trip'); dol_fiche_head($head, 'documents', $langs->trans("ExpenseReport"), -1, 'trip');
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
$morehtmlref.='</div>'; $morehtmlref.='</div>';

View File

@ -56,7 +56,7 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'info', $langs->trans("ExpenseReport"), -1, 'trip'); dol_fiche_head($head, 'info', $langs->trans("ExpenseReport"), -1, 'trip');
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
$morehtmlref.='</div>'; $morehtmlref.='</div>';

View File

@ -80,7 +80,7 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'note', $langs->trans("ExpenseReport"), -1, 'trip'); dol_fiche_head($head, 'note', $langs->trans("ExpenseReport"), -1, 'trip');
$linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
$morehtmlref.='</div>'; $morehtmlref.='</div>';

View File

@ -1148,7 +1148,7 @@ else if ($id > 0 || ! empty($ref))
// Intervention card // Intervention card
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';

View File

@ -655,28 +655,52 @@ class Fichinter extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only * @param int $withpicto 0=_No picto, 1=Includes the picto in the linkn, 2=Picto only
* @param string $option Options * @param string $option Options
* @return string String with URL * @param int $notooltip 1=Disable tooltip
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='') function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
{ {
global $langs; global $langs;
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowIntervention") . '</u>'; $label = '<u>' . $langs->trans("ShowIntervention") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref))
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref; $label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
$link = '<a href="'.DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $picto='intervention';
$url = DOL_URL_ROOT.'/fichinter/card.php?id='.$this->id;
//if ($option !== 'nolink')
//{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
//}
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowIntervention");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
$picto='intervention'; if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
if ($withpicto && $withpicto != 2) $result.=' '; if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.$this->ref.$linkend; if ($withpicto != 2) $result.=$linkstart.$this->ref.$linkend;
return $result; return $result;
} }

View File

@ -126,7 +126,7 @@ if ($id > 0 || ! empty($ref))
// Intervention card // Intervention card
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';

View File

@ -102,7 +102,7 @@ if ($object->id)
// Intervention card // Intervention card
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';

View File

@ -63,7 +63,7 @@ $head = fichinter_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), -1, 'intervention'); dol_fiche_head($head, 'info', $langs->trans('InterventionCard'), -1, 'intervention');
// Intervention card // Intervention card
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';

View File

@ -66,7 +66,7 @@ if ($id > 0 || ! empty($ref))
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), -1, 'intervention'); dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), -1, 'intervention');
// Intervention card // Intervention card
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';

View File

@ -594,12 +594,13 @@ class CommandeFournisseur extends CommonOrder
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option On what the link points * @param string $option On what the link points
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chain with URL * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chain with URL
*/ */
public function getNomUrl($withpicto=0,$option='',$notooltip=0) public function getNomUrl($withpicto=0, $option='', $notooltip=0, $save_lastsearch_value=-1)
{ {
global $langs, $conf; global $langs, $conf;
@ -619,6 +620,14 @@ class CommandeFournisseur extends CommonOrder
$picto='order'; $picto='order';
$url = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$this->id; $url = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$this->id;
if ($option !== 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkclose=''; $linkclose='';
if (empty($notooltip)) if (empty($notooltip))
{ {

Some files were not shown because too many files have changed in this diff Show More