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

This commit is contained in:
Laurent Destailleur 2017-01-22 21:23:35 +01:00
commit 5fd8b1efcb
30 changed files with 352 additions and 178 deletions

View File

@ -76,12 +76,34 @@ class DolibarrApiAccess implements iAuthenticate
$userClass = Defaults::$userIdentifierClass; $userClass = Defaults::$userIdentifierClass;
/*foreach ($_SERVER as $key => $val)
{
dol_syslog($key.' - '.$val);
}*/
// api key can be provided in url with parameter api_key=xxx or ni header with header DOLAPIKEY:xxx
$api_key = '';
if (isset($_GET['api_key'])) if (isset($_GET['api_key']))
{
// TODO Add option to disable use of api key on url. Return errors if used.
$api_key = $_GET['api_key']; // For backward compatibility
}
if (isset($_GET['DOLAPIKEY']))
{
// TODO Add option to disable use of api key on url. Return errors if used.
$api_key = $_GET['DOLAPIKEY']; // With GET method
}
if (isset($_SERVER['HTTP_DOLAPIKEY']))
{
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
}
if ($api_key)
{ {
$sql = "SELECT u.login, u.datec, u.api_key, "; $sql = "SELECT u.login, u.datec, u.api_key, ";
$sql.= " u.tms as date_modification, u.entity"; $sql.= " u.tms as date_modification, u.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.api_key = '".$db->escape($_GET['api_key'])."'"; $sql.= " WHERE u.api_key = '".$db->escape($api_key)."'";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -97,8 +119,8 @@ class DolibarrApiAccess implements iAuthenticate
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg); throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
} }
if ($stored_key != $_GET['api_key']) { if ($stored_key != $api_key) {
$userClass::setCacheIdentifier($_GET['api_key']); $userClass::setCacheIdentifier($api_key);
return false; return false;
} }
@ -121,7 +143,7 @@ class DolibarrApiAccess implements iAuthenticate
} }
else else
{ {
throw new RestException(401, "Failed to login to API. No parameter 'api_key' provided"); throw new RestException(401, "Failed to login to API. No parameter 'DOLAPIKEY' on HTTP header (neither in URL).");
} }
$userClass::setCacheIdentifier(static::$role); $userClass::setCacheIdentifier(static::$role);

View File

@ -34,12 +34,14 @@ class Login
/** /**
* Login * Login
* *
* Log user with username and password. Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass) * Request the API token for a couple username / password.
* * Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass into server log file).
* @param string $login Username * Both method are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "api_key" into field at the top right of page (Note: "api_key" can be found/set on the user page).
*
* @param string $login User login
* @param string $password User password * @param string $password User password
* @param int $entity Entity (when multicompany module is used). Empty means 1=first company. * @param int $entity Entity (when multicompany module is used). Empty means 1=first company.
* @param int $reset Reset token (0=get current token, 1=ask a new token, meaning that all future access using current token will failed) * @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
* @return array Response status and user token * @return array Response status and user token
* *
* @throws RestException * @throws RestException

View File

@ -56,6 +56,16 @@ if (empty($conf->global->MAIN_MODULE_API))
exit; exit;
} }
// Test if explorer is not disabled
if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($conf->global->API_EXPLORER_DISABLED))
{
$langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
exit;
}
$api = new DolibarrApi($db); $api = new DolibarrApi($db);

View File

@ -59,7 +59,18 @@ top_htmlhead('','',0,0,'',$arrayofcss);
<div class="conteneur_img_droite"> <div class="conteneur_img_droite">
<div class="menu_principal hideonsmartphone"> <div class="menu_principal hideonsmartphone">
<div class="logo"><?php print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">'; ?></div> <div class="logo">
<?php
if (! empty($mysoc->logo_small))
{
print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&amp;file='.urlencode('/thumbs/'.$mysoc->logo_small).'">';
}
else
{
print '<div class="logopos">'.$mysoc->name.'</div>';
}
?>
</div>
</div> </div>
<div class="contenu"> <div class="contenu">

View File

@ -259,52 +259,50 @@ dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
print '<div class="fichecenter"><div class="fichethirdleft">'; print '<div class="fichecenter"><div class="fichethirdleft">';
//if (empty($socid)) // Show filter box
//{ print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
// Show filter box print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<table class="noborder" width="100%">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
print '<table class="noborder" width="100%">'; // Company
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
// Company if ($mode == 'customer') $filter='s.client in (1,2,3)';
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">'; if ($mode == 'supplier') $filter='s.fournisseur = 1';
if ($mode == 'customer') $filter='s.client in (1,2,3)'; print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
if ($mode == 'supplier') $filter='s.fournisseur = 1'; print '</td></tr>';
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"'); // User
print '</td></tr>'; print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
// User print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">'; // Status
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
// Status if ($mode == 'customer')
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">'; {
if ($mode == 'customer') $liststatus=array(
{ Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"),
$liststatus=array( Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"), Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"),
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"), Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"), Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"), );
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled") print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4);
); }
print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4); if ($mode == 'supplier')
} {
if ($mode == 'supplier') $formorder->selectSupplierOrderStatus((strstr($object_status, ',')?-1:$object_status), 0, 'object_status');
{ }
$formorder->selectSupplierOrderStatus((strstr($object_status, ',')?-1:$object_status), 0, 'object_status'); print '</td></tr>';
} // Year
print '</td></tr>'; print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
// Year if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">'; if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; arsort($arrayyears);
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear; print $form->selectarray('year',$arrayyears,$year,0);
arsort($arrayyears); print '</td></tr>';
print $form->selectarray('year',$arrayyears,$year,0); print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
print '</td></tr>'; print '</table>';
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>'; print '</form>';
print '</table>'; print '<br><br>';
print '</form>';
print '<br><br>';
//}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre" height="24">'; print '<tr class="liste_titre" height="24">';
@ -328,7 +326,6 @@ foreach ($data as $val)
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].' height="24">'; print '<tr '.$bc[$var].' height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right"></td>'; print '<td align="right"></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';

View File

@ -38,22 +38,29 @@ if ($user->societe_id > 0)
} }
/* $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
* Affichage $sortfield = GETPOST('sortfield','alpha');
*/ $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
llxHeader();
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="p.rowid"; if (! $sortfield) $sortfield="p.rowid";
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
/*
* Actions
*/
/*
* View
*/
llxHeader();
$sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut"; $sql = "SELECT p.rowid, p.datep as dp, p.amount, p.statut";
$sql.=", c.libelle as paiement_type, p.num_paiement"; $sql.=", c.libelle as paiement_type, p.num_paiement";
@ -70,10 +77,20 @@ if ($socid)
$sql.= " AND f.fk_soc = ".$socid; $sql.= " AND f.fk_soc = ".$socid;
} }
$sql.= " AND p.statut = 0"; $sql.= " AND p.statut = 0";
$sql.= " ORDER BY $sortfield $sortorder";
$sql.= $db->plimit($limit+1, $offset);
$resql = $db->query($sql);
$sql.= $db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit + 1,$offset);
$resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@ -199,11 +199,12 @@ if ($action == 'valide')
} }
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/paiement/list.php">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/paiement/list.php">' . $langs->trans("BackToList") . '</a>';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Ref // Ref
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
@ -280,6 +281,8 @@ if (! empty($conf->banque->enabled))
print '</table>'; print '</table>';
dol_fiche_end();
/* /*
* List of invoices * List of invoices
@ -298,7 +301,14 @@ if ($resql)
$i = 0; $i = 0;
$total = 0; $total = 0;
print '<br><table class="noborder" width="100%">';
$moreforfilter='';
print '<br>';
print '<div class="div-table-responsive">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Bill').'</td>'; print '<td>'.$langs->trans('Bill').'</td>';
print '<td>'.$langs->trans('Company').'</td>'; print '<td>'.$langs->trans('Company').'</td>';
@ -363,6 +373,8 @@ if ($resql)
$var=!$var; $var=!$var;
print "</table>\n"; print "</table>\n";
print '</div>';
$db->free($resql); $db->free($resql);
} }
else else
@ -370,7 +382,6 @@ else
dol_print_error($db); dol_print_error($db);
} }
print '</div>';
/* /*

View File

@ -471,7 +471,10 @@ if ($action == 'new')
print '<input type="hidden" name="action" value="create">'; print '<input type="hidden" name="action" value="create">';
print '<input type="hidden" name="accountid" value="'.$bid.'">'; print '<input type="hidden" name="accountid" value="'.$bid.'">';
print '<table class="noborder" width="100%">'; $moreforfilter='';
print '<div class="div-table-responsive-no-min">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").' '; print '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").' ';
print "</td>\n"; print "</td>\n";
@ -539,7 +542,8 @@ if ($action == 'new')
$i++; $i++;
} }
print "</table>"; print "</table>";
print '</div>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->banque->cheque) if ($user->rights->banque->cheque)
{ {

View File

@ -37,33 +37,57 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement','','','bons'); $result = restrictedArea($user, 'prelevement','','','bons');
// Get supervariables $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha'); if ($page == -1) { $page = 0; }
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha'); $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="p.datec";
// Get supervariables
$statut = GETPOST('statut','int'); $statut = GETPOST('statut','int');
$search_line = GETPOST('search_ligne','int'); $search_ref = GETPOST('search_ref','alpha');
/*
* Actions
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$search_ref="";
}
/*
* View
*/
llxHeader('',$langs->trans("WithdrawalsReceipts")); llxHeader('',$langs->trans("WithdrawalsReceipts"));
$bon=new BonPrelevement($db,""); $bon=new BonPrelevement($db,"");
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Mode List
*
*/
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut"; $sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
$sql.= ", p.datec"; $sql.= ", p.datec";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " ORDER BY $sortfield $sortorder "; if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
$sql.= $db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit + 1,$offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -73,9 +97,22 @@ if ($result)
$urladd= "&amp;statut=".$statut; $urladd= "&amp;statut=".$statut;
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); // Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
print '<table class="liste" width="100%">'; $moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"'); print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
@ -84,17 +121,18 @@ if ($result)
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_ref" value="'. $db->escape($search_ref).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="'. $search_line.'" size="10"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>'; print '<td class="liste_titre" align="right">';
print '</form>'; $searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print '</tr>'; print '</tr>';
$var=True; $var=True;
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$var=!$var; $var=!$var;
@ -113,6 +151,10 @@ if ($result)
$i++; $i++;
} }
print "</table>"; print "</table>";
print '</div>';
print '</form>';
$db->free($result); $db->free($result);
} }
else else

View File

@ -23,6 +23,7 @@
* \ingroup prelevement * \ingroup prelevement
* \brief Page liste des prelevements * \brief Page liste des prelevements
*/ */
require('../../main.inc.php'); require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
@ -38,10 +39,18 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'prelevement','','','bons'); $result = restrictedArea($user, 'prelevement','','','bons');
// Get supervariables
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha'); if ($page == -1) { $page = 0; }
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha'); $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="p.datec";
$search_line = GETPOST('search_line','alpha'); $search_line = GETPOST('search_line','alpha');
$search_bon = GETPOST('search_bon','alpha'); $search_bon = GETPOST('search_bon','alpha');
$search_code = GETPOST('search_code','alpha'); $search_code = GETPOST('search_code','alpha');
@ -51,9 +60,12 @@ $statut = GETPOST('statut','int');
$bon=new BonPrelevement($db,""); $bon=new BonPrelevement($db,"");
$ligne=new LignePrelevement($db,$user); $ligne=new LignePrelevement($db,$user);
$offset = $conf->liste_limit * $page ;
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers /*
* Actions
*/
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{ {
$search_line=""; $search_line="";
$search_bon=""; $search_bon="";
@ -62,10 +74,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$statut=""; $statut="";
} }
/* /*
* View * View
*/ */
$form=new Form($db);
llxHeader('',$langs->trans("WithdrawalsLines")); llxHeader('',$langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut, p.datec"; $sql = "SELECT p.rowid, p.ref, p.statut, p.datec";
@ -83,24 +98,22 @@ $sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_line) if ($search_line) $sql.= " AND pl.rowid = '".$db->escape($search_line)."'";
if ($search_bon) $sql.= natural_search("p.ref", $search_bon);
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
if ($search_company) natural_search("s.nom", $search_company);
$sql.= $db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$sql.= " AND pl.rowid = '".$db->escape($search_line)."'"; $result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
} }
if ($search_bon)
{ $sql.= $db->plimit($limit + 1,$offset);
$sql.= " AND p.ref LIKE '%".$db->escape($search_bon)."%'";
}
if ($search_code)
{
$sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
}
if ($search_company)
{
$sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'";
}
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
@ -111,11 +124,15 @@ if ($result)
$urladd = "&amp;statut=".$statut; $urladd = "&amp;statut=".$statut;
$urladd .= "&amp;search_bon=".$search_bon; $urladd .= "&amp;search_bon=".$search_bon;
print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num); print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
print"\n<!-- debut table -->\n"; print"\n<!-- debut table -->\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<table class="liste" width="100%">';
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]); print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]);
@ -144,7 +161,7 @@ if ($result)
$var=True; $var=True;
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
@ -185,6 +202,7 @@ if ($result)
$i++; $i++;
} }
print "</table>"; print "</table>";
print '</div>';
print '</form>'; print '</form>';

View File

@ -641,7 +641,9 @@ if (! empty($conf->don->enabled))
$totentrees=array(); $totentrees=array();
$totsorties=array(); $totsorties=array();
print '<table class="noborder" width="100%">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste">'."\n";
print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>'; print '<tr class="liste_titre"><td class="liste_titre">&nbsp;</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)
@ -735,7 +737,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
print "</tr>\n"; print "</tr>\n";
print "</table>"; print "</table>";
print '</div>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -530,9 +530,9 @@ else
// Name // Name
print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>'; print '<tr><td class="titlefieldcreate fieldrequired"><label for="lastname">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</label></td>';
print '<td><input name="lastname" id="lastname" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname")?GETPOST("lastname"):$object->lastname).'" autofocus="autofocus"></td>'; print '<td><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname")?GETPOST("lastname"):$object->lastname).'" autofocus="autofocus"></td>';
print '<td><label for="firstname">'.$langs->trans("Firstname").'</label></td>'; print '<td><label for="firstname">'.$langs->trans("Firstname").'</label></td>';
print '<td><input name="firstname" id="firstname"type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname")?GETPOST("firstname"):$object->firstname).'"></td></tr>'; print '<td><input name="firstname" id="firstname"type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname")?GETPOST("firstname"):$object->firstname).'"></td></tr>';
// Company // Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
@ -567,7 +567,7 @@ else
// Address // Address
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) $object->address = $objsoc->address; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->address)) == 0) $object->address = $objsoc->address; // Predefined with third party
print '<tr><td><label for="address">'.$langs->trans("Address").'</label></td>'; print '<tr><td><label for="address">'.$langs->trans("Address").'</label></td>';
print '<td colspan="'.$colspan.'"><textarea class="flat" name="address" id="address" cols="70">'.(GETPOST("address",'alpha')?GETPOST("address",'alpha'):$object->address).'</textarea></td>'; print '<td colspan="'.$colspan.'"><textarea class="flat quatrevingtpercent" name="address" id="address" rows="'.ROWS_2.'">'.(GETPOST("address",'alpha')?GETPOST("address",'alpha'):$object->address).'</textarea></td>';
if ($conf->use_javascript_ajax && $socid > 0) if ($conf->use_javascript_ajax && $socid > 0)
{ {
@ -612,20 +612,20 @@ else
// Phone / Fax // Phone / Fax
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->phone; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->phone_pro)) == 0) $object->phone_pro = $objsoc->phone; // Predefined with third party
print '<tr><td><label for="phone_pro">'.$langs->trans("PhonePro").'</label></td>'; print '<tr><td><label for="phone_pro">'.$langs->trans("PhonePro").'</label></td>';
print '<td><input name="phone_pro" id="phone_pro" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("phone_pro")?GETPOST("phone_pro"):$object->phone_pro).'"></td>'; print '<td><input name="phone_pro" id="phone_pro" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("phone_pro")?GETPOST("phone_pro"):$object->phone_pro).'"></td>';
print '<td><label for="phone_perso">'.$langs->trans("PhonePerso").'</label></td>'; print '<td><label for="phone_perso">'.$langs->trans("PhonePerso").'</label></td>';
print '<td><input name="phone_perso" id="phone_perso" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("phone_perso")?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>'; print '<td><input name="phone_perso" id="phone_perso" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("phone_perso")?GETPOST("phone_perso"):$object->phone_perso).'"></td></tr>';
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->fax)) == 0) $object->fax = $objsoc->fax; // Predefined with third party
print '<tr><td><label for="phone_mobile">'.$langs->trans("PhoneMobile").'</label></td>'; print '<tr><td><label for="phone_mobile">'.$langs->trans("PhoneMobile").'</label></td>';
print '<td><input name="phone_mobile" id="phone_mobile" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("phone_mobile")?GETPOST("phone_mobile"):$object->phone_mobile).'"></td>'; print '<td><input name="phone_mobile" id="phone_mobile" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("phone_mobile")?GETPOST("phone_mobile"):$object->phone_mobile).'"></td>';
print '<td><label for="fax">'.$langs->trans("Fax").'</label></td>'; print '<td><label for="fax">'.$langs->trans("Fax").'</label></td>';
print '<td><input name="fax" id="fax" type="text" class="minwidth100" maxlength="80" value="'.dol_escape_htmltag(GETPOST("fax",'alpha')?GETPOST("fax",'alpha'):$object->fax).'"></td></tr>'; print '<td><input name="fax" id="fax" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("fax",'alpha')?GETPOST("fax",'alpha'):$object->fax).'"></td></tr>';
// EMail // EMail
if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || ! empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party
print '<tr><td><label for="email">'.$langs->trans("Email").'</label></td>'; print '<tr><td><label for="email">'.$langs->trans("Email").'</label></td>';
print '<td><input name="email" id="email" type="text" class="minwidth200" maxlength="80" value="'.(GETPOST("email",'alpha')?GETPOST("email",'alpha'):$object->email).'"></td>'; print '<td><input name="email" id="email" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.(GETPOST("email",'alpha')?GETPOST("email",'alpha'):$object->email).'"></td>';
if (! empty($conf->mailing->enabled)) if (! empty($conf->mailing->enabled))
{ {
print '<td><label for="no_email">'.$langs->trans("No_Email").'</label></td>'; print '<td><label for="no_email">'.$langs->trans("No_Email").'</label></td>';

View File

@ -1482,11 +1482,11 @@ else
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var=!$var; //$var=!$var;
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{ {
print '<tr '.$bc[$var].' valign="top">'; print '<tr '.$bcnd[$var].' valign="top">';
// Libelle // Libelle
if ($objp->fk_product > 0) if ($objp->fk_product > 0)
{ {
@ -1575,7 +1575,7 @@ else
$colspan = 7; $colspan = 7;
} }
print '<tr '.$bc[$var].'>'; print '<tr '.$bcnd[$var].'>';
print '<td colspan="'.$colspan.'">'; print '<td colspan="'.$colspan.'">';
// Date planned // Date planned
@ -1611,10 +1611,10 @@ else
// Display lines extrafields // Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bc[$var].'>'; print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db); $line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid,$extralabelslines); $line->fetch_optionals($objp->rowid,$extralabelslines);
print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan)); print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcnd[$var], 'colspan'=>$colspan));
print '</tr>'; print '</tr>';
} }
} }
@ -1622,7 +1622,7 @@ else
else else
{ {
// Ligne carac // Ligne carac
print "<tr ".$bc[$var].">"; print "<tr ".$bcnd[$var].">";
print '<td>'; print '<td>';
if ($objp->fk_product) if ($objp->fk_product)
{ {
@ -1676,7 +1676,7 @@ else
if($conf->global->PRODUCT_USE_UNITS) $colspan++; if($conf->global->PRODUCT_USE_UNITS) $colspan++;
// Ligne dates prevues // Ligne dates prevues
print "<tr ".$bc[$var].">"; print "<tr ".$bcnd[$var].">";
print '<td colspan="'.$colspan.'">'; print '<td colspan="'.$colspan.'">';
print $langs->trans("DateStartPlanned").' '; print $langs->trans("DateStartPlanned").' ';
$form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update"); $form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update");
@ -1685,10 +1685,10 @@ else
print '</td>'; print '</td>';
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines)>0) {
print '<tr '.$bc[$var].'>'; print '<tr '.$bcnd[$var].'>';
$line = new ContratLigne($db); $line = new ContratLigne($db);
$line->fetch_optionals($objp->rowid,$extralabelslines); $line->fetch_optionals($objp->rowid,$extralabelslines);
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan)); print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$colspan));
print '</tr>'; print '</tr>';
} }
@ -1704,7 +1704,7 @@ else
if ($object->statut > 0) if ($object->statut > 0)
{ {
print '<tr '.$bc[$var].'>'; print '<tr '.$bcnd[$var].'>';
print '<td colspan="'.($conf->margin->enabled?7:6).'"><hr class="opacitymedium"></td>'; print '<td colspan="'.($conf->margin->enabled?7:6).'"><hr class="opacitymedium"></td>';
print "</tr>\n"; print "</tr>\n";
} }
@ -1773,7 +1773,7 @@ else
{ {
print '<table class="notopnoleftnoright tableforservicepart2" width="100%">'; print '<table class="notopnoleftnoright tableforservicepart2" width="100%">';
print '<tr '.$bc[$var].'>'; print '<tr '.$bcnd[$var].'>';
print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).'</td>'; print '<td>'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).'</td>';
print '<td width="30" align="right">'; print '<td width="30" align="right">';
if ($user->societe_id == 0) if ($user->societe_id == 0)
@ -1781,10 +1781,18 @@ else
if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline') if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline')
{ {
$tmpaction='activateline'; $tmpaction='activateline';
if ($objp->statut == 4) $tmpaction='unactivateline'; $tmpactionpicto='play';
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) { $tmpactiontext=$langs->trans("Activate");
if ($objp->statut == 4)
{
$tmpaction='unactivateline';
$tmpactionpicto='playstop';
$tmpactiontext=$langs->trans("Unactivate");
}
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver))
{
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;ligne=' . $object->lines[$cursorline - 1]->id . '&amp;action=' . $tmpaction . '">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;ligne=' . $object->lines[$cursorline - 1]->id . '&amp;action=' . $tmpaction . '">';
print img_edit(); print img_picto($tmpactiontext, $tmpactionpicto);
print '</a>'; print '</a>';
} }
} }
@ -1792,7 +1800,7 @@ else
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr '.$bc[$var].'>'; print '<tr '.$bcnd[$var].'>';
print '<td>'; print '<td>';
// Si pas encore active // Si pas encore active
@ -1915,7 +1923,7 @@ else
print '</td>'; print '</td>';
print '<td align="right" rowspan="2" class="nohover">'; print '<td align="right" rowspan="2" class="nohover">';
print '<input type="submit" class="button" name="close" value="'.$langs->trans("Close").'"><br>'; print '<input type="submit" class="button" name="close" value="'.$langs->trans("Unactivate").'"><br>';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>'; print '</td></tr>';

View File

@ -489,7 +489,7 @@ class ExpenseReport extends CommonObject
* Returns the label of a statut * Returns the label of a statut
* *
* @param int $status id statut * @param int $status id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($status,$mode=0) function LibStatut($status,$mode=0)
@ -514,6 +514,8 @@ class ExpenseReport extends CommonObject
if ($mode == 5) if ($mode == 5)
return '<span class="hideonsmartphone">'.$langs->transnoentities($this->statuts_short[$status]).' </span>'.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]); return '<span class="hideonsmartphone">'.$langs->transnoentities($this->statuts_short[$status]).' </span>'.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]);
if ($mode == 6)
return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]);
} }

View File

@ -59,9 +59,9 @@ class ExpenseReportStats extends Stats
$this->from = MAIN_DB_PREFIX.$object->table_element." as e"; $this->from = MAIN_DB_PREFIX.$object->table_element." as e";
$this->field='total_ht'; $this->field='total_ht';
$this->where = " e.fk_statut > 0"; //$this->where = " e.fk_statut > 0";
//$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have. //$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have.
$this->where.= ' AND e.entity IN ('.getEntity('expensereport', 1).')'; $this->where.= ' e.entity IN ('.getEntity('expensereport', 1).')';
//$this->where.= " AND entity = ".$conf->entity; //$this->where.= " AND entity = ".$conf->entity;
if ($this->socid) if ($this->socid)
@ -88,7 +88,7 @@ class ExpenseReportStats extends Stats
*/ */
function getNbByYear() function getNbByYear()
{ {
$sql = "SELECT YEAR(date_valid) as dm, count(*)"; $sql = "SELECT YEAR(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').") as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " GROUP BY dm DESC"; $sql.= " GROUP BY dm DESC";
$sql.= " WHERE ".$this->where; $sql.= " WHERE ".$this->where;
@ -105,7 +105,7 @@ class ExpenseReportStats extends Stats
*/ */
function getNbByMonth($year) function getNbByMonth($year)
{ {
$sql = "SELECT MONTH(e.date_valid) as dm, count(*)"; $sql = "SELECT MONTH(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').") as dm, count(*)";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " WHERE YEAR(e.date_valid) = ".$year; $sql.= " WHERE YEAR(e.date_valid) = ".$year;
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
@ -126,9 +126,9 @@ class ExpenseReportStats extends Stats
*/ */
function getAmountByMonth($year) function getAmountByMonth($year)
{ {
$sql = "SELECT date_format(e.date_valid,'%m') as dm, sum(".$this->field.")"; $sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').",'%m') as dm, sum(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(e.date_valid,'%Y') = '".$year."'"; $sql.= " WHERE date_format(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').",'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -146,9 +146,9 @@ class ExpenseReportStats extends Stats
*/ */
function getAverageByMonth($year) function getAverageByMonth($year)
{ {
$sql = "SELECT date_format(e.date_valid,'%m') as dm, avg(".$this->field.")"; $sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').",'%m') as dm, avg(".$this->field.")";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " WHERE date_format(e.date_valid,'%Y') = '".$year."'"; $sql.= " WHERE date_format(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').",'%Y') = '".$year."'";
$sql.= " AND ".$this->where; $sql.= " AND ".$this->where;
$sql.= " GROUP BY dm"; $sql.= " GROUP BY dm";
$sql.= $this->db->order('dm','DESC'); $sql.= $this->db->order('dm','DESC');
@ -163,7 +163,7 @@ class ExpenseReportStats extends Stats
*/ */
function getAllByYear() function getAllByYear()
{ {
$sql = "SELECT date_format(e.date_valid,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql = "SELECT date_format(".$this->db->ifsql('e.date_valid IS NULL','e.date_create','e.date_valid').",'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
$sql.= " FROM ".$this->from; $sql.= " FROM ".$this->from;
$sql.= " WHERE ".$this->where; $sql.= " WHERE ".$this->where;
$sql.= " GROUP BY year"; $sql.= " GROUP BY year";

View File

@ -33,6 +33,9 @@ $langs->load("companies");
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width'); $WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height'); $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
$object_status=GETPOST('object_status');
$userid=GETPOST('userid','int'); $userid=GETPOST('userid','int');
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0; $socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
$id = GETPOST('id','int'); $id = GETPOST('id','int');
@ -52,7 +55,6 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear;
$startyear=$year-1; $startyear=$year-1;
$endyear=$year; $endyear=$year;
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
/* /*
@ -60,18 +62,19 @@ $mode=GETPOST("mode")?GETPOST("mode"):'customer';
*/ */
$form=new Form($db); $form=new Form($db);
$tmpexpensereport=new ExpenseReport($db);
llxHeader();
$title=$langs->trans("TripsAndExpensesStatistics"); $title=$langs->trans("TripsAndExpensesStatistics");
$dir=$conf->expensereport->dir_temp; $dir=$conf->expensereport->dir_temp;
llxHeader('', $title);
print load_fiche_titre($title, $mesg); print load_fiche_titre($title, $mesg);
dol_mkdir($dir); dol_mkdir($dir);
$stats = new ExpenseReportStats($db, $socid, $userid); $stats = new ExpenseReportStats($db, $socid, $userid);
if ($object_status != '' && $object_status >= -1) $stats->where .= ' AND e.fk_statut IN ('.$object_status.')';
// Build graphic number of object // Build graphic number of object
// $data = array(array('Lib',val1,val2,val3),...) // $data = array(array('Lib',val1,val2,val3),...)
@ -227,6 +230,11 @@ $include='';
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $include='hierarchy'; if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $include='hierarchy';
print $form->select_dolusers($userid, 'userid', 1, '', 0, $include, '', 0, 0, 0, '', 0, '', 'maxwidth300'); print $form->select_dolusers($userid, 'userid', 1, '', 0, $include, '', 0, 0, 0, '', 0, '', 'maxwidth300');
print '</td></tr>'; print '</td></tr>';
// Status
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
$liststatus=$tmpexpensereport->statuts;
print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4, 0, 0, '', 1);
print '</td></tr>';
// Year // Year
print '<tr><td>'.$langs->trans("Year").'</td><td>'; print '<tr><td>'.$langs->trans("Year").'</td><td>';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
@ -247,20 +255,24 @@ print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
print '</tr>'; print '</tr>';
$oldyear=0; $oldyear=0;
$var=true;
foreach ($data as $val) foreach ($data as $val)
{ {
$year = $val['year']; $year = $val['year'];
while ($year && $oldyear > $year+1) while ($year && $oldyear > $year+1)
{ // If we have empty year { // If we have empty year
$oldyear--; $oldyear--;
print '<tr height="24">'; $var=!$var;
print '<tr '.$bc[$var].' height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '</tr>'; print '</tr>';
} }
print '<tr height="24">';
$var=!$var;
print '<tr '.$bc[$var].' height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>'; print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';

View File

@ -967,7 +967,7 @@ if ($action == 'create')
// Description (must be a textarea and not html must be allowed (used in list view) // Description (must be a textarea and not html must be allowed (used in list view)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td>'; print '<td>';
print '<textarea name="description" cols="80" rows="'.ROWS_3.'">'.GETPOST('description').'</textarea>'; print '<textarea name="description" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('description').'</textarea>';
print '</td></tr>'; print '</td></tr>';
// Project // Project

View File

@ -251,7 +251,8 @@ if ($result)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,'',$sortfield,$sortorder);
@ -527,6 +528,8 @@ if ($result)
} }
print '</table>'; print '</table>';
print '</div>';
print "</form>\n"; print "</form>\n";
$db->free($result); $db->free($result);
} }

View File

@ -221,6 +221,8 @@ else
} }
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
// User
print '<td>'; print '<td>';
$userstatic->id=$users['rowid']; $userstatic->id=$users['rowid'];
$userstatic->lastname=$users['lastname']; $userstatic->lastname=$users['lastname'];
@ -232,6 +234,7 @@ else
print $userstatic->getNomUrl(-1); print $userstatic->getNomUrl(-1);
print '</td>'; print '</td>';
// Amount for each type
if (count($typeleaves)) if (count($typeleaves))
{ {
foreach($typeleaves as $key => $val) foreach($typeleaves as $key => $val)
@ -249,8 +252,10 @@ else
{ {
print '<td></td>'; print '<td></td>';
} }
// Note
print '<td style="text-align:center">'; print '<td style="text-align:center">';
if ($canedit) print '<input type="text"'.($canedit?'':' disabled="disabled"').' value="" name="note_holiday['.$users['rowid'].']" size="30"/>'; if ($canedit) print '<input type="text"'.($canedit?'':' disabled="disabled"').' class="maxwidthonsmartphone" value="" name="note_holiday['.$users['rowid'].']" size="30"/>';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if (! empty($user->rights->holiday->define_holiday)) if (! empty($user->rights->holiday->define_holiday))

View File

@ -2,8 +2,8 @@
<html> <html>
<head> <head>
<title>Api Explorer</title> <title>Api Explorer</title>
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/> <!-- <link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">-->
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/> <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/> <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
@ -56,11 +56,18 @@
log("key: " + key); log("key: " + key);
if(key && key.trim() != "") { if(key && key.trim() != "") {
log("added key " + key); log("added key " + key);
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
window.authorizations.add("key", new ApiKeyAuthorization("DOLAPIKEY", key, "query"));
console.log("param api_key added with value "+key);
window.authorizations.add("key2", new ApiKeyAuthorization("DOLAPIKEY", key, "header"));
console.log("header DOLAPIKEY added with value "+key);
} }
}) })
window.swaggerUi.load(); window.swaggerUi.load();
}); });
</script> </script>
</head> </head>
@ -70,7 +77,7 @@
<a id="logo" href="#">API Explorer</a> <a id="logo" href="#">API Explorer</a>
<form id='api_selector'> <form id='api_selector'>
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="hidden" value="resources.json"/></div> <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="hidden" value="resources.json"/></div>
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div> <div class='input'><input placeholder="DOLAPIKEY" id="input_apiKey" name="apiKey" type="text"/></div>
<div class='input'><a id="explore" href="#">Explore</a></div> <div class='input'><a id="explore" href="#">Explore</a></div>
</form> </form>
</div> </div>

View File

@ -1505,10 +1505,11 @@ EndPointIs=SOAP clients must send their requests to the Dolibarr endpoint availa
##### API #### ##### API ####
ApiSetup=API module setup ApiSetup=API module setup
ApiDesc=By enabling this module, Dolibarr become a REST server to provide miscellaneous web services. ApiDesc=By enabling this module, Dolibarr become a REST server to provide miscellaneous web services.
ApiProductionMode=Enable production mode (this will activate use of a caches for services management) ApiProductionMode=Enable production mode (this will activate use of a cache for services management)
ApiExporerIs=You can explore the APIs at url ApiExporerIs=You can explore the APIs at url
OnlyActiveElementsAreExposed=Only elements from enabled modules are exposed OnlyActiveElementsAreExposed=Only elements from enabled modules are exposed
ApiKey=Key for API ApiKey=Key for API
WarningAPIExplorerDisabled=The API explorer has been disabled. API explorer is not required to provide API services. It is a tool for developer to find/test REST APIs. If you need this tool, go into setup of module API REST to activate it.
##### Bank ##### ##### Bank #####
BankSetupModule=Bank module setup BankSetupModule=Bank module setup
FreeLegalTextOnChequeReceipts=Free text on cheque receipts FreeLegalTextOnChequeReceipts=Free text on cheque receipts

View File

@ -81,7 +81,7 @@ LT2PaymentES=IRPF Payment
LT2PaymentsES=IRPF Payments LT2PaymentsES=IRPF Payments
VATPayment=Sales tax payment VATPayment=Sales tax payment
VATPayments=Sales tax payments VATPayments=Sales tax payments
VATRefund=Sales tax refund Refund VATRefund=Sales tax refund
Refund=Refund Refund=Refund
SocialContributionsPayments=Social/fiscal taxes payments SocialContributionsPayments=Social/fiscal taxes payments
ShowVatPayment=Show VAT payment ShowVatPayment=Show VAT payment

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

View File

@ -644,7 +644,7 @@ div.fiche>form>div.div-table-responsive {
.clearboth { clear:both; } .clearboth { clear:both; }
.hideobject { display: none; } .hideobject { display: none; }
.minwidth50 { min-width: 50px; } .minwidth50 { min-width: 50px; }
/* rule to reduce top menu - 3rd reduction */ /* rule for not too small screen only */
@media only screen and (min-width: <?php echo round($nbtopmenuentries * $fontsize * 3.4, 0) + 7; ?>px) @media only screen and (min-width: <?php echo round($nbtopmenuentries * $fontsize * 3.4, 0) + 7; ?>px)
{ {
.minwidth100 { min-width: 100px; } .minwidth100 { min-width: 100px; }
@ -733,7 +733,7 @@ div.fiche>form>div.div-table-responsive {
.hideonsmartphone { display: none; } .hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone { max-width: 100px; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
.maxwidth50onsmartphone { max-width: 40px; } .maxwidth50onsmartphone { max-width: 40px; }
.maxwidth75onsmartphone { max-width: 50px; } .maxwidth75onsmartphone { max-width: 50px; }
.maxwidth100onsmartphone { max-width: 70px; } .maxwidth100onsmartphone { max-width: 70px; }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

View File

@ -621,7 +621,7 @@ div.fiche>form>div.div-table-responsive {
.clearboth { clear:both; } .clearboth { clear:both; }
.hideobject { display: none; } .hideobject { display: none; }
.minwidth50 { min-width: 50px; } .minwidth50 { min-width: 50px; }
/* rule to reduce top menu - 3rd reduction */ /* rule for not too small screen only */
@media only screen and (min-width: <?php echo round($nbtopmenuentries * $fontsize * 3.4, 0) + 7; ?>px) @media only screen and (min-width: <?php echo round($nbtopmenuentries * $fontsize * 3.4, 0) + 7; ?>px)
{ {
.minwidth100 { min-width: 100px; } .minwidth100 { min-width: 100px; }
@ -711,7 +711,7 @@ div.fiche>form>div.div-table-responsive {
.hideonsmartphone { display: none; } .hideonsmartphone { display: none; }
.noenlargeonsmartphone { width : 50px !important; display: inline !important; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; }
.maxwidthonsmartphone { max-width: 100px; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
.maxwidth50onsmartphone { max-width: 40px; } .maxwidth50onsmartphone { max-width: 40px; }
.maxwidth75onsmartphone { max-width: 50px; } .maxwidth75onsmartphone { max-width: 50px; }
.maxwidth100onsmartphone { max-width: 70px; } .maxwidth100onsmartphone { max-width: 70px; }