Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop
@ -76,12 +76,34 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
|
||||
$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']))
|
||||
{
|
||||
// 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.= " u.tms as date_modification, u.entity";
|
||||
$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);
|
||||
if ($result)
|
||||
@ -97,8 +119,8 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
throw new RestException(503, 'Error when fetching user api_key :'.$db->error_msg);
|
||||
}
|
||||
|
||||
if ($stored_key != $_GET['api_key']) {
|
||||
$userClass::setCacheIdentifier($_GET['api_key']);
|
||||
if ($stored_key != $api_key) {
|
||||
$userClass::setCacheIdentifier($api_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -121,7 +143,7 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
}
|
||||
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);
|
||||
|
||||
@ -34,12 +34,14 @@ class 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)
|
||||
*
|
||||
* @param string $login Username
|
||||
* 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).
|
||||
* 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 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
|
||||
*
|
||||
* @throws RestException
|
||||
|
||||
@ -56,6 +56,16 @@ if (empty($conf->global->MAIN_MODULE_API))
|
||||
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);
|
||||
|
||||
|
||||
@ -59,7 +59,18 @@ top_htmlhead('','',0,0,'',$arrayofcss);
|
||||
<div class="conteneur_img_droite">
|
||||
|
||||
<div class="menu_principal hideonsmartphone">
|
||||
<div class="logo"><?php print '<img class="logopos" alt="Logo company" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&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&file='.urlencode('/thumbs/'.$mysoc->logo_small).'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="logopos">'.$mysoc->name.'</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="contenu">
|
||||
|
||||
@ -259,52 +259,50 @@ dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
//if (empty($socid))
|
||||
//{
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
|
||||
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
// Status
|
||||
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$liststatus=array(
|
||||
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"),
|
||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
|
||||
);
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4);
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$formorder->selectSupplierOrderStatus((strstr($object_status, ',')?-1:$object_status), 0, 'object_status');
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
//}
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td align="left">'.$langs->trans("ThirdParty").'</td><td align="left">';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1,0,0,array(),0,'','style="width: 95%"');
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
|
||||
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
// Status
|
||||
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$liststatus=array(
|
||||
Commande::STATUS_DRAFT=>$langs->trans("StatusOrderDraft"),
|
||||
Commande::STATUS_VALIDATED=>$langs->trans("StatusOrderValidated"),
|
||||
Commande::STATUS_ACCEPTED=>$langs->trans("StatusOrderSent"),
|
||||
Commande::STATUS_CLOSED=>$langs->trans("StatusOrderDelivered"),
|
||||
Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceled")
|
||||
);
|
||||
print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4);
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$formorder->selectSupplierOrderStatus((strstr($object_status, ',')?-1:$object_status), 0, 'object_status');
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
if (! in_array($nowyear,$arrayyears)) $arrayyears[$nowyear]=$nowyear;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre" height="24">';
|
||||
@ -328,7 +326,6 @@ foreach ($data as $val)
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].' height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.($socid>0?'&socid='.$socid:'').($userid>0?'&userid='.$userid:'').'">'.$oldyear.'</a></td>';
|
||||
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right">0</td>';
|
||||
|
||||
@ -38,22 +38,29 @@ if ($user->societe_id > 0)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affichage
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
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.=", c.libelle as paiement_type, p.num_paiement";
|
||||
@ -70,10 +77,20 @@ if ($socid)
|
||||
$sql.= " AND f.fk_soc = ".$socid;
|
||||
}
|
||||
$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)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@ -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>';
|
||||
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
|
||||
@ -280,6 +281,8 @@ if (! empty($conf->banque->enabled))
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
/*
|
||||
* List of invoices
|
||||
@ -298,7 +301,14 @@ if ($resql)
|
||||
|
||||
$i = 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 '<td>'.$langs->trans('Bill').'</td>';
|
||||
print '<td>'.$langs->trans('Company').'</td>';
|
||||
@ -363,6 +373,8 @@ if ($resql)
|
||||
$var=!$var;
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
@ -370,7 +382,6 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -471,7 +471,10 @@ if ($action == 'new')
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
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 '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").' ';
|
||||
print "</td>\n";
|
||||
@ -539,7 +542,8 @@ if ($action == 'new')
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
if ($user->rights->banque->cheque)
|
||||
{
|
||||
|
||||
@ -37,33 +37,57 @@ $socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$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');
|
||||
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
|
||||
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="p.datec";
|
||||
|
||||
// Get supervariables
|
||||
$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"));
|
||||
|
||||
$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.= ", p.datec";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
if ($search_ref) $sql.=natural_search("p.ref", $search_ref);
|
||||
|
||||
$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);
|
||||
if ($result)
|
||||
@ -73,9 +97,22 @@ if ($result)
|
||||
|
||||
$urladd= "&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_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 class="liste_titre">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="'. $search_line.'" size="10"></td>';
|
||||
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"> </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 '</form>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
{
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
@ -113,6 +151,10 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
* \ingroup prelevement
|
||||
* \brief Page liste des prelevements
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.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;
|
||||
$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');
|
||||
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
|
||||
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "p.datec" : GETPOST('sortfield','alpha');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$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_bon = GETPOST('search_bon','alpha');
|
||||
$search_code = GETPOST('search_code','alpha');
|
||||
@ -51,9 +60,12 @@ $statut = GETPOST('statut','int');
|
||||
$bon=new BonPrelevement($db,"");
|
||||
$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_bon="";
|
||||
@ -62,10 +74,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$statut="";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("WithdrawalsLines"));
|
||||
|
||||
$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.entity = ".$conf->entity;
|
||||
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.= " 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);
|
||||
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -111,11 +124,15 @@ if ($result)
|
||||
$urladd = "&statut=".$statut;
|
||||
$urladd .= "&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 '<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_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]);
|
||||
@ -144,7 +161,7 @@ if ($result)
|
||||
|
||||
$var=True;
|
||||
|
||||
while ($i < min($num,$conf->liste_limit))
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
@ -185,6 +202,7 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -641,7 +641,9 @@ if (! empty($conf->don->enabled))
|
||||
$totentrees=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"> </td>';
|
||||
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
@ -735,7 +737,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -530,9 +530,9 @@ else
|
||||
|
||||
// Name
|
||||
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><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
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
@ -567,7 +567,7 @@ else
|
||||
// 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
|
||||
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)
|
||||
{
|
||||
@ -612,20 +612,20 @@ else
|
||||
// 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
|
||||
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><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
|
||||
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><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
|
||||
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 '<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))
|
||||
{
|
||||
print '<td><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
|
||||
|
||||
@ -1482,11 +1482,11 @@ else
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
//$var=!$var;
|
||||
|
||||
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
|
||||
{
|
||||
print '<tr '.$bc[$var].' valign="top">';
|
||||
print '<tr '.$bcnd[$var].' valign="top">';
|
||||
// Libelle
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
@ -1575,7 +1575,7 @@ else
|
||||
$colspan = 7;
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<tr '.$bcnd[$var].'>';
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
|
||||
// Date planned
|
||||
@ -1611,10 +1611,10 @@ else
|
||||
|
||||
// Display lines extrafields
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0) {
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<tr '.$bcnd[$var].'>';
|
||||
$line = new ContratLigne($db);
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
@ -1622,7 +1622,7 @@ else
|
||||
else
|
||||
{
|
||||
// Ligne carac
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
print '<td>';
|
||||
if ($objp->fk_product)
|
||||
{
|
||||
@ -1676,7 +1676,7 @@ else
|
||||
if($conf->global->PRODUCT_USE_UNITS) $colspan++;
|
||||
|
||||
// Ligne dates prevues
|
||||
print "<tr ".$bc[$var].">";
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
print '<td colspan="'.$colspan.'">';
|
||||
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");
|
||||
@ -1685,10 +1685,10 @@ else
|
||||
print '</td>';
|
||||
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0) {
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<tr '.$bcnd[$var].'>';
|
||||
$line = new ContratLigne($db);
|
||||
$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>';
|
||||
}
|
||||
|
||||
@ -1704,7 +1704,7 @@ else
|
||||
|
||||
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 "</tr>\n";
|
||||
}
|
||||
@ -1773,7 +1773,7 @@ else
|
||||
{
|
||||
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 width="30" align="right">';
|
||||
if ($user->societe_id == 0)
|
||||
@ -1781,10 +1781,18 @@ else
|
||||
if ($object->statut > 0 && $action != 'activateline' && $action != 'unactivateline')
|
||||
{
|
||||
$tmpaction='activateline';
|
||||
if ($objp->statut == 4) $tmpaction='unactivateline';
|
||||
if (($tmpaction=='activateline' && $user->rights->contrat->activer) || ($tmpaction=='unactivateline' && $user->rights->contrat->desactiver)) {
|
||||
$tmpactionpicto='play';
|
||||
$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 . '&ligne=' . $object->lines[$cursorline - 1]->id . '&action=' . $tmpaction . '">';
|
||||
print img_edit();
|
||||
print img_picto($tmpactiontext, $tmpactionpicto);
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
@ -1792,7 +1800,7 @@ else
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<tr '.$bcnd[$var].'>';
|
||||
|
||||
print '<td>';
|
||||
// Si pas encore active
|
||||
@ -1915,7 +1923,7 @@ else
|
||||
print '</td>';
|
||||
|
||||
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 '</td></tr>';
|
||||
|
||||
|
||||
@ -489,7 +489,7 @@ class ExpenseReport extends CommonObject
|
||||
* Returns the label of a 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
|
||||
*/
|
||||
function LibStatut($status,$mode=0)
|
||||
@ -514,6 +514,8 @@ class ExpenseReport extends CommonObject
|
||||
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]);
|
||||
|
||||
if ($mode == 6)
|
||||
return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -59,9 +59,9 @@ class ExpenseReportStats extends Stats
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as e";
|
||||
$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.entity IN ('.getEntity('expensereport', 1).')';
|
||||
$this->where.= ' e.entity IN ('.getEntity('expensereport', 1).')';
|
||||
|
||||
//$this->where.= " AND entity = ".$conf->entity;
|
||||
if ($this->socid)
|
||||
@ -88,7 +88,7 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
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.= " GROUP BY dm DESC";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
@ -105,7 +105,7 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
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.= " WHERE YEAR(e.date_valid) = ".$year;
|
||||
$sql.= " AND ".$this->where;
|
||||
@ -126,9 +126,9 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
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.= " 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.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -146,9 +146,9 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
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.= " 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.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm','DESC');
|
||||
@ -163,7 +163,7 @@ class ExpenseReportStats extends Stats
|
||||
*/
|
||||
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.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
|
||||
@ -33,6 +33,9 @@ $langs->load("companies");
|
||||
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
$object_status=GETPOST('object_status');
|
||||
|
||||
$userid=GETPOST('userid','int');
|
||||
$socid=GETPOST('socid','int'); if ($socid < 0) $socid=0;
|
||||
$id = GETPOST('id','int');
|
||||
@ -52,7 +55,6 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear;
|
||||
$startyear=$year-1;
|
||||
$endyear=$year;
|
||||
|
||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
|
||||
|
||||
/*
|
||||
@ -60,18 +62,19 @@ $mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
$tmpexpensereport=new ExpenseReport($db);
|
||||
|
||||
$title=$langs->trans("TripsAndExpensesStatistics");
|
||||
$dir=$conf->expensereport->dir_temp;
|
||||
|
||||
llxHeader('', $title);
|
||||
|
||||
print load_fiche_titre($title, $mesg);
|
||||
|
||||
dol_mkdir($dir);
|
||||
|
||||
$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
|
||||
// $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';
|
||||
print $form->select_dolusers($userid, 'userid', 1, '', 0, $include, '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
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
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
@ -247,20 +255,24 @@ print '<td align="right">'.$langs->trans("AmountAverage").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$oldyear=0;
|
||||
$var=true;
|
||||
foreach ($data as $val)
|
||||
{
|
||||
$year = $val['year'];
|
||||
while ($year && $oldyear > $year+1)
|
||||
{ // If we have empty year
|
||||
$oldyear--;
|
||||
print '<tr height="24">';
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].' height="24">';
|
||||
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&mode='.$mode.'">'.$oldyear.'</a></td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right">0</td>';
|
||||
print '<td align="right">0</td>';
|
||||
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.'&mode='.$mode.'">'.$year.'</a></td>';
|
||||
print '<td align="right">'.$val['nb'].'</td>';
|
||||
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';
|
||||
|
||||
@ -967,7 +967,7 @@ if ($action == 'create')
|
||||
// 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 '<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>';
|
||||
|
||||
// Project
|
||||
|
||||
@ -251,7 +251,8 @@ if ($result)
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$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">';
|
||||
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);
|
||||
@ -527,6 +528,8 @@ if ($result)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
@ -221,6 +221,8 @@ else
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
// User
|
||||
print '<td>';
|
||||
$userstatic->id=$users['rowid'];
|
||||
$userstatic->lastname=$users['lastname'];
|
||||
@ -232,6 +234,7 @@ else
|
||||
print $userstatic->getNomUrl(-1);
|
||||
print '</td>';
|
||||
|
||||
// Amount for each type
|
||||
if (count($typeleaves))
|
||||
{
|
||||
foreach($typeleaves as $key => $val)
|
||||
@ -249,8 +252,10 @@ else
|
||||
{
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
// Note
|
||||
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>';
|
||||
if (! empty($user->rights->holiday->define_holiday))
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Api Explorer</title>
|
||||
<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='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='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/reset.css' media='print' rel='stylesheet' type='text/css'/>
|
||||
@ -56,11 +56,18 @@
|
||||
log("key: " + key);
|
||||
if(key && key.trim() != "") {
|
||||
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();
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@ -70,7 +77,7 @@
|
||||
<a id="logo" href="#">API Explorer</a>
|
||||
<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="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>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -1505,10 +1505,11 @@ EndPointIs=SOAP clients must send their requests to the Dolibarr endpoint availa
|
||||
##### API ####
|
||||
ApiSetup=API module setup
|
||||
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
|
||||
OnlyActiveElementsAreExposed=Only elements from enabled modules are exposed
|
||||
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 #####
|
||||
BankSetupModule=Bank module setup
|
||||
FreeLegalTextOnChequeReceipts=Free text on cheque receipts
|
||||
|
||||
@ -81,7 +81,7 @@ LT2PaymentES=IRPF Payment
|
||||
LT2PaymentsES=IRPF Payments
|
||||
VATPayment=Sales tax payment
|
||||
VATPayments=Sales tax payments
|
||||
VATRefund=Sales tax refund Refund
|
||||
VATRefund=Sales tax refund
|
||||
Refund=Refund
|
||||
SocialContributionsPayments=Social/fiscal taxes payments
|
||||
ShowVatPayment=Show VAT payment
|
||||
|
||||
|
Before Width: | Height: | Size: 653 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 828 B After Width: | Height: | Size: 474 B |
BIN
htdocs/theme/eldy/img/playstop.png
Normal file
|
After Width: | Height: | Size: 250 B |
@ -644,7 +644,7 @@ div.fiche>form>div.div-table-responsive {
|
||||
.clearboth { clear:both; }
|
||||
.hideobject { display: none; }
|
||||
.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)
|
||||
{
|
||||
.minwidth100 { min-width: 100px; }
|
||||
@ -733,7 +733,7 @@ div.fiche>form>div.div-table-responsive {
|
||||
|
||||
.hideonsmartphone { display: none; }
|
||||
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
|
||||
.maxwidthonsmartphone { max-width: 100px; }
|
||||
.maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
|
||||
.maxwidth50onsmartphone { max-width: 40px; }
|
||||
.maxwidth75onsmartphone { max-width: 50px; }
|
||||
.maxwidth100onsmartphone { max-width: 70px; }
|
||||
|
||||
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 828 B After Width: | Height: | Size: 474 B |
BIN
htdocs/theme/md/img/playstop.png
Normal file
|
After Width: | Height: | Size: 250 B |
@ -621,7 +621,7 @@ div.fiche>form>div.div-table-responsive {
|
||||
.clearboth { clear:both; }
|
||||
.hideobject { display: none; }
|
||||
.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)
|
||||
{
|
||||
.minwidth100 { min-width: 100px; }
|
||||
@ -711,7 +711,7 @@ div.fiche>form>div.div-table-responsive {
|
||||
|
||||
.hideonsmartphone { display: none; }
|
||||
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
|
||||
.maxwidthonsmartphone { max-width: 100px; }
|
||||
.maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
|
||||
.maxwidth50onsmartphone { max-width: 40px; }
|
||||
.maxwidth75onsmartphone { max-width: 50px; }
|
||||
.maxwidth100onsmartphone { max-width: 70px; }
|
||||
|
||||