diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 68ec526ec7e..407f94ac915 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -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); diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 439308fcaea..704ec1b6874 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -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 diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 8ad60c4b340..37be4d8cc26 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -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").'.

'; + exit; +} + + $api = new DolibarrApi($db); diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 4a892f909e5..9a61a50b38a 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -59,7 +59,18 @@ top_htmlhead('','',0,0,'',$arrayofcss);
diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 55b82d1063c..d900709b835 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -259,52 +259,50 @@ dol_fiche_head($head,'byyear',$langs->trans("Statistics")); print '
'; -//if (empty($socid)) -//{ - // Show filter box - print '
'; - print ''; - print ''; - print ''; - // Company - print ''; - // User - print ''; - // Year - print ''; - print ''; - print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; - 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 '
'.$langs->trans("CreatedBy").''; - print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); - // Status - print '
'.$langs->trans("Status").''; - 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 '
'.$langs->trans("Year").''; - 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 '
'; - print '
'; - print '

'; -//} +// Show filter box +print '
'; +print ''; +print ''; +print ''; +// Company +print ''; +// User +print ''; +// Year +print ''; +print ''; +print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; +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 '
'.$langs->trans("CreatedBy").''; +print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +// Status +print '
'.$langs->trans("Status").''; +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 '
'.$langs->trans("Year").''; +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 '
'; +print '
'; +print '

'; + print ''; print ''; @@ -328,7 +326,6 @@ foreach ($data as $val) $var=!$var; print ''; print ''; - print ''; print ''; print ''; diff --git a/htdocs/compta/paiement/avalider.php b/htdocs/compta/paiement/avalider.php index 02201093830..a244a1feb60 100644 --- a/htdocs/compta/paiement/avalider.php +++ b/htdocs/compta/paiement/avalider.php @@ -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); diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 07b8d95ddbc..7de97eba2e0 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -199,11 +199,12 @@ if ($action == 'valide') } -print '
0?'&userid='.$userid:'').'">'.$oldyear.'00
'; $linkback = '' . $langs->trans("BackToList") . ''; +print '
'."\n"; + // Ref print '
'.$langs->trans('Ref').''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); @@ -280,6 +281,8 @@ if (! empty($conf->banque->enabled)) print '
'; +dol_fiche_end(); + /* * List of invoices @@ -298,7 +301,14 @@ if ($resql) $i = 0; $total = 0; - print '
'; + + $moreforfilter=''; + + print '
'; + + print '
'; + print '
'; + print ''; print ''; print ''; @@ -363,6 +373,8 @@ if ($resql) $var=!$var; print "
'.$langs->trans('Bill').''.$langs->trans('Company').'
\n"; + print '
'; + $db->free($resql); } else @@ -370,7 +382,6 @@ else dol_print_error($db); } -print '
'; /* diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 94686162687..5b42fdb6825 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -471,7 +471,10 @@ if ($action == 'new') print ''; print ''; - print ''; + $moreforfilter=''; + print '
'; + print '
'."\n"; + print ''; print '\n"; @@ -539,7 +542,8 @@ if ($action == 'new') $i++; } print "
'.$langs->trans("DateChequeReceived").' '; print "
"; - + print '
'; + print '
'; if ($user->rights->banque->cheque) { diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 695afb7562f..8f90183f0f7 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -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 '
'; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); - print ''; + $moreforfilter=''; + + print '
'; + print '
'."\n"; print ''; print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"'); @@ -84,17 +121,18 @@ if ($result) print "\n"; print ''; - print ''; - print ''; + print ''; print ''; - print ''; - print ''; + print ''; print ''; $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 "
 '; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + print '
"; + print '
'; + + print ''; + $db->free($result); } else diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 9e33bac4046..7a7eeb7610a 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -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\n"; print '
'; - print ''; + + $moreforfilter=''; + + print '
'; + print '
'."\n"; print ''; 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 "
"; + print '
'; print ''; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 74b80ec0e82..5b2c6b70a13 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -641,7 +641,9 @@ if (! empty($conf->don->enabled)) $totentrees=array(); $totsorties=array(); -print ''; +print '
'; +print '
'."\n"; + print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) @@ -735,7 +737,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) print "\n"; print "
 
"; - +print ''; llxFooter(); $db->close(); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index e6429fdc6d7..37bd3078c7d 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -530,9 +530,9 @@ else // Name print ''; - print 'lastname).'" autofocus="autofocus">'; + print 'lastname).'" autofocus="autofocus">'; print ''; - print 'firstname).'">'; + print 'firstname).'">'; // 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 ''; - print ''; + print ''; 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 ''; - print 'phone_pro).'">'; + print 'phone_pro).'">'; print ''; - print 'phone_perso).'">'; + print 'phone_perso).'">'; 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 ''; - print 'phone_mobile).'">'; + print 'phone_mobile).'">'; print ''; - print 'fax).'">'; + print 'fax).'">'; // 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 ''; - print 'email).'">'; + print 'email).'">'; if (! empty($conf->mailing->enabled)) { print ''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 1bc6b21de9d..3c88eb64e26 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1482,11 +1482,11 @@ else $objp = $db->fetch_object($result); - $var=!$var; + //$var=!$var; if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) { - print ''; + print ''; // Libelle if ($objp->fk_product > 0) { @@ -1575,7 +1575,7 @@ else $colspan = 7; } - print ''; + print ''; print ''; // Date planned @@ -1611,10 +1611,10 @@ else // Display lines extrafields if (is_array($extralabelslines) && count($extralabelslines)>0) { - print ''; + print ''; $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 ''; } } @@ -1622,7 +1622,7 @@ else else { // Ligne carac - print ""; + print ""; print ''; if ($objp->fk_product) { @@ -1676,7 +1676,7 @@ else if($conf->global->PRODUCT_USE_UNITS) $colspan++; // Ligne dates prevues - print ""; + print ""; print ''; 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 ''; if (is_array($extralabelslines) && count($extralabelslines)>0) { - print ''; + print ''; $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 ''; } @@ -1704,7 +1704,7 @@ else if ($object->statut > 0) { - print ''; + print ''; print '
'; print "\n"; } @@ -1773,7 +1773,7 @@ else { print ''; - print ''; + print ''; print ''; print ''; print "\n"; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index d21e04cc37f..dd0a8e1e901 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -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 ''.$langs->transnoentities($this->statuts_short[$status]).' '.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]); } diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 25ead4de0c1..d68483cb32b 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -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"; diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index b92405424c6..c81996fda3b 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -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 ''; +// Status +print ''; // Year print ''; print ''; $oldyear=0; +$var=true; foreach ($data as $val) { $year = $val['year']; while ($year && $oldyear > $year+1) { // If we have empty year $oldyear--; - print ''; + $var=!$var; + print ''; print ''; print ''; print ''; print ''; print ''; } - print ''; + + $var=!$var; + print ''; print ''; print ''; print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 827fd5c5e4a..4ed3ecb7cef 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -967,7 +967,7 @@ if ($action == 'create') // Description (must be a textarea and not html must be allowed (used in list view) print ''; print ''; // Project diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 9d01643825a..563c57f5ad7 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -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 '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; 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 ''; - print img_edit(); + print img_picto($tmpactiontext, $tmpactionpicto); print ''; } } @@ -1792,7 +1800,7 @@ else print '
'; // Si pas encore active @@ -1915,7 +1923,7 @@ else print ''; - print '
'; + print '
'; print ''; print '
'.$langs->trans("Status").''; +$liststatus=$tmpexpensereport->statuts; +print $form->selectarray('object_status', $liststatus, GETPOST('object_status'), -4, 0, 0, '', 1); +print '
'.$langs->trans("Year").''; if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year; @@ -247,20 +255,24 @@ print ''.$langs->trans("AmountAverage").'
'.$oldyear.'000
'.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).'
'.$langs->trans("Description").''; - print ''; + print ''; print '
'; + print '
'; + print '
'."\n"; print ''; 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 '
'; + print ''; + print "\n"; $db->free($result); } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index cd0c3fc1598..414bcf709f4 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -221,6 +221,8 @@ else } print ''; + + // User print ''; $userstatic->id=$users['rowid']; $userstatic->lastname=$users['lastname']; @@ -232,6 +234,7 @@ else print $userstatic->getNomUrl(-1); print ''; + // Amount for each type if (count($typeleaves)) { foreach($typeleaves as $key => $val) @@ -249,8 +252,10 @@ else { print ''; } + + // Note print ''; - if ($canedit) print ''; + if ($canedit) print ''; print ''; print ''; if (! empty($user->rights->holiday->define_holiday)) diff --git a/htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html b/htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html index 27f0d4f53da..a433b80056b 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html +++ b/htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html @@ -2,8 +2,8 @@ Api Explorer - - + @@ -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(); }); + @@ -70,7 +77,7 @@
-
+
Explore
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f88736e93d1..df9eec12906 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -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 diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index c4cd1b53d71..1afd69b73e0 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -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 diff --git a/htdocs/theme/eldy/img/play.png b/htdocs/theme/eldy/img/play.png index 4922ea1ec12..b506d9eb9b9 100644 Binary files a/htdocs/theme/eldy/img/play.png and b/htdocs/theme/eldy/img/play.png differ diff --git a/htdocs/theme/eldy/img/playdisabled.png b/htdocs/theme/eldy/img/playdisabled.png index 1cf122679e2..08116b68f93 100644 Binary files a/htdocs/theme/eldy/img/playdisabled.png and b/htdocs/theme/eldy/img/playdisabled.png differ diff --git a/htdocs/theme/eldy/img/playstop.png b/htdocs/theme/eldy/img/playstop.png new file mode 100644 index 00000000000..72031b31b5d Binary files /dev/null and b/htdocs/theme/eldy/img/playstop.png differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index cd2b9e7b6f6..2f1e61e48ce 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -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: 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; } diff --git a/htdocs/theme/md/img/play.png b/htdocs/theme/md/img/play.png index 96021dc5081..b506d9eb9b9 100644 Binary files a/htdocs/theme/md/img/play.png and b/htdocs/theme/md/img/play.png differ diff --git a/htdocs/theme/md/img/playdisabled.png b/htdocs/theme/md/img/playdisabled.png index 1cf122679e2..08116b68f93 100644 Binary files a/htdocs/theme/md/img/playdisabled.png and b/htdocs/theme/md/img/playdisabled.png differ diff --git a/htdocs/theme/md/img/playstop.png b/htdocs/theme/md/img/playstop.png new file mode 100644 index 00000000000..72031b31b5d Binary files /dev/null and b/htdocs/theme/md/img/playstop.png differ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 95a2eb68895..080b50e1c8c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -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: 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; }