';
print '| '.img_object("",$logo).' '.$box->boxlabel.' | ';
print '' . ($obj->note?$obj->note:' ') . ' | ';
diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php
index a5e8743de4c..623909b2ba8 100644
--- a/htdocs/compta/bank/search.php
+++ b/htdocs/compta/bank/search.php
@@ -33,19 +33,20 @@ require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/bankcateg.class.php");
if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'banque');
-$description=$_REQUEST["description"];
-$debit=$_REQUEST["debit"];
-$credit=$_REQUEST["credit"];
-$type=$_REQUEST["type"];
-$account=$_REQUEST["account"];
+$description=GETPOST("description");
+$debit=GETPOST("debit");
+$credit=GETPOST("credit");
+$type=GETPOST("type");
+$account=GETPOST("account");
+$bid=GETPOST("bid");
$param='';
-if (! empty($_REQUEST["description"])) $param.='&description='.$_REQUEST["description"];
-if (! empty($_REQUEST["type"])) $param.='&type='.$_REQUEST["type"];
-if (! empty($_REQUEST["debit"])) $param.='&debit='.$_REQUEST["debit"];
-if (! empty($_REQUEST["credit"])) $param.='&credit='.$_REQUEST["credit"];
-if (! empty($_REQUEST["account"])) $param.='&account='.$_REQUEST["account"];
-if (! empty($_REQUEST["bid"])) $param.='&bid='.$_REQUEST["bid"];
+if ($description) $param.='&description='.$description;
+if ($type) $param.='&type='.$type;
+if ($debit) $param.='&debit='.$debit;
+if ($credit) $param.='&credit='.$credit;
+if ($account) $param.='&account='.$account;
+if ($bid) $param.='&bid='.$bid;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index eab9105745c..e6d3ddd2e8c 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -32,10 +32,10 @@ $langs->load("products");
$langs->load("contracts");
$langs->load("companies");
-$mode = isset($_GET["mode"])?$_GET["mode"]:$_POST["mode"];
-$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
-$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
-$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
+$mode = GETPOST("mode");
+$sortfield = GETPOST("sortfield",'alpha');
+$sortorder = GETPOST("sortorder",'alpha');
+$page = GETPOST("page");
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
@@ -43,15 +43,15 @@ $offset = $limit * $page ;
if (! $sortfield) $sortfield="c.rowid";
if (! $sortorder) $sortorder="ASC";
-$filter=isset($_GET["filter"])?$_GET["filter"]:$_POST["filter"];
-$search_nom=isset($_GET["search_nom"])?$_GET["search_nom"]:$_POST["search_nom"];
-$search_contract=isset($_GET["search_contract"])?$_GET["search_contract"]:$_POST["search_contract"];
-$search_service=isset($_GET["search_service"])?$_GET["search_service"]:$_POST["search_service"];
+$filter=GETPOST("filter");
+$search_nom=GETPOST("search_nom");
+$search_contract=GETPOST("search_contract");
+$search_service=GETPOST("search_service");
$statut=isset($_GET["statut"])?$_GET["statut"]:1;
-$socid=$_GET["socid"];
+$socid=GETPOST("socid");
// Security check
-$contratid = isset($_GET["id"])?$_GET["id"]:'';
+$contratid = GETPOST("id");
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contrat',$contratid,'');
@@ -152,15 +152,15 @@ if ($resql)
print '';
print '';
print '';
- print '';
+ print '';
print ' | ';
// Service label
print '';
- print '';
+ print '';
print ' | ';
// Third party
print '';
- print '';
+ print '';
print ' | ';
print '';
$arrayofoperators=array('<'=>'<','>'=>'>');
diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php
index 223d9259d8f..de4a2347f2d 100644
--- a/htdocs/core/boxes/box_contracts.php
+++ b/htdocs/core/boxes/box_contracts.php
@@ -39,7 +39,7 @@ class box_contracts extends ModeleBoxes {
/**
- * \brief Constructeur de la classe
+ * Constructor
*/
function box_contracts()
{
@@ -51,8 +51,9 @@ class box_contracts extends ModeleBoxes {
}
/**
- * \brief Charge les donnees en memoire pour affichage ulterieur
- * \param $max Nombre maximum d'enregistrements a charger
+ * Load data for box to show them later
+ *
+ * @param int $max Maximum number of records to load
*/
function loadBox($max=5)
{
diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php
new file mode 100644
index 00000000000..dc030a46a5a
--- /dev/null
+++ b/htdocs/core/boxes/box_services_expired.php
@@ -0,0 +1,151 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/core/boxes/box_services_expired.php
+ * \ingroup contracts
+ * \brief Module to show the box of last expired services
+ */
+
+include_once(DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php");
+
+
+class box_services_expired extends ModeleBoxes {
+
+ var $boxcode="expiredservices";
+ var $boximg="object_contract";
+ var $boxlabel;
+ var $depends = array("contrat"); // conf->propal->enabled
+
+ var $db;
+ var $param;
+
+ var $info_box_head = array();
+ var $info_box_contents = array();
+
+
+ /**
+ * Constructor
+ */
+ function box_services_expired()
+ {
+ global $langs;
+
+ $langs->load("contracts");
+
+ $this->boxlabel=$langs->trans("BoxOldestExpiredServices");
+ }
+
+ /**
+ * Load data for box to show them later
+ *
+ * @param int $max Maximum number of records to load
+ */
+ function loadBox($max=5)
+ {
+ global $user, $langs, $db, $conf;
+
+ $this->max=$max;
+
+ $now=dol_now('tzref');
+
+ $this->info_box_head = array('text' => $langs->trans("BoxLastExpiredServices",$max));
+
+ if ($user->rights->contrat->lire)
+ {
+ // Select contracts with at least one expired service
+ $sql = "SELECT ";
+ $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat,";
+ $sql.= " s.nom, s.rowid as socid,";
+ $sql.= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
+ $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
+ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql.= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$db->idate($now)."'";
+ $sql.= " AND c.fk_soc=s.rowid AND cd.fk_contrat=c.rowid AND c.statut > 0";
+ if ($user->societe_id) $sql.=' AND c.fk_soc = '.$user->societe_id;
+ if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
+ $sql.= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, s.nom, s.rowid";
+ $sql.= " ORDER BY date_line ASC";
+ $sql.= $db->plimit($max, 0);
+
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+
+ $i = 0;
+
+ while ($i < $num)
+ {
+ $late='';
+
+ $objp = $db->fetch_object($resql);
+
+ $dateline=$db->jdate($objp->date_line);
+ if (($dateline + $conf->contrat->services->expires->warning_delay) < $now) $late=img_warning($langs->trans("Late"));
+
+ $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
+ 'logo' => $this->boximg,
+ 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
+
+ $this->info_box_contents[$i][1] = array('td' => 'align="left"',
+ 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref
+ 'url' => DOL_URL_ROOT."/contrat/fiche.php?id=".$objp->rowid);
+
+ $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"',
+ 'logo' => 'company',
+ 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
+
+ $this->info_box_contents[$i][3] = array('td' => 'align="left"',
+ 'text' => dol_trunc($objp->nom,40),
+ 'url' => DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->socid);
+
+ $this->info_box_contents[$i][4] = array('td' => 'align="center"',
+ 'text' => dol_print_date($dateline,'day'),
+ 'text2'=> $late);
+
+ $this->info_box_contents[$i][5] = array('td' => 'align="right"',
+ 'text' => $objp->nb_services);
+
+
+ $i++;
+ }
+
+ if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoExpiredServices"));
+ }
+ else
+ {
+ dol_print_error($db);
+ }
+
+
+ }
+ else
+ {
+ $this->info_box_contents[0][0] = array('td' => 'align="left"',
+ 'text' => $langs->trans("ReadPermissionNotAllowed"));
+ }
+ }
+
+ function showBox()
+ {
+ parent::showBox($this->info_box_head, $this->info_box_contents);
+ }
+
+}
+
+?>
diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php
index 0de06eb5e6a..7ba03b23c9e 100644
--- a/htdocs/core/modules/modContrat.class.php
+++ b/htdocs/core/modules/modContrat.class.php
@@ -79,6 +79,7 @@ class modContrat extends DolibarrModules
// Boxes
$this->boxes = array();
$this->boxes[0][1] = "box_contracts.php";
+ $this->boxes[1][1] = "box_services_expired.php";
// Permissions
$this->rights = array();
diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang
index e60083b6258..6644af2ece3 100644
--- a/htdocs/langs/en_US/boxes.lang
+++ b/htdocs/langs/en_US/boxes.lang
@@ -46,16 +46,18 @@ BoxTitleTotalUnpaidCustomerBills=Unpaid customer's invoices
BoxTitleTotalUnpaidSuppliersBills=Unpaid supplier's invoices
BoxTitleLastModifiedContacts=Last %s modified contacts/addresses
BoxMyLastBookmarks=My last %s bookmarks
+BoxOldestExpiredServices=Oldest active expired services
+BoxLastExpiredServices=Last %s oldest contacts with active expired services
+BoxTitleLastActionsToDo=Last %s actions to do
+BoxTitleLastContracts=Last %s contracts
+BoxTitleLastModifiedDonations=Last %s modified donations
+BoxTitleLastModifiedExpenses=Last %s modified expenses
FailedToRefreshDataInfoNotUpToDate=Failed to refresh RSS flux. Last successfull refresh date: %s
LastRefreshDate=Last refresh date
NoRecordedBookmarks=No bookmarks defined.
ClickToAdd=Click here to add.
NoRecordedCustomers=No recorded customers
NoRecordedContacts=No recorded contacts
-BoxTitleLastActionsToDo=Last %s actions to do
-BoxTitleLastContracts=Last %s contracts
-BoxTitleLastModifiedDonations=Last %s modified donations
-BoxTitleLastModifiedExpenses=Last %s modified expenses
NoActionsToDo=No actions to do
NoRecordedOrders=No recorded customer's orders
NoRecordedProposals=No recorded proposals
@@ -67,4 +69,4 @@ NoModifiedSupplierBills=No recorded supplier's invoices
NoRecordedProducts=No recorded products/services
NoRecordedProspects=No recorded prospects
NoContractedProducts=No products/services contracted
-NoRecordedContracts=No recorded contracts
\ No newline at end of file
+NoRecordedContracts=No recorded contracts
diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang
index d3f64feef96..c15fd25536d 100644
--- a/htdocs/langs/en_US/contracts.lang
+++ b/htdocs/langs/en_US/contracts.lang
@@ -85,6 +85,7 @@ ConfirmMoveToAnotherContractQuestion=Choose in which existing contract (of same
PaymentRenewContractId=Renew contract line (number %s)
ExpiredSince=Expiration date
RelatedContracts=Related contracts
+NoExpiredServices=No expired active services
##### Types de contacts #####
TypeContact_contrat_internal_SALESREPSIGN=Sales representative signing contract
TypeContact_contrat_internal_SALESREPFOLL=Sales representative following-up contract
diff --git a/htdocs/langs/fr_FR/boxes.lang b/htdocs/langs/fr_FR/boxes.lang
index 9d027f04938..b70f098fc02 100644
--- a/htdocs/langs/fr_FR/boxes.lang
+++ b/htdocs/langs/fr_FR/boxes.lang
@@ -46,16 +46,18 @@ BoxTitleTotalUnpaidSuppliersBills=Impayés fournisseurs
BoxTitleLastModifiedContacts=Les %s derniers contacts/adresses modifiés
BoxTitleLastModifiedMembers=Les %s derniers adhérents modifiés
BoxMyLastBookmarks=Mes %s derniers marque-pages
+BoxOldestExpiredServices=Plus anciens services expirés
+BoxLastExpiredServices=Les %s plus anciens contrats avec services actifs expirés
+BoxTitleLastActionsToDo=Les %s derniers événements à réaliser
+BoxTitleLastContracts=Les %s derniers contrats
+BoxTitleLastModifiedDonations=Les %s derniers dons modifiés
+BoxTitleLastModifiedExpenses=Les %s dernières note de frais modifiées
FailedToRefreshDataInfoNotUpToDate=Échec du rafraichissement du flux RSS. Date du dernier rafraichissement: %s
LastRefreshDate=Date dernier rafraichissement
NoRecordedBookmarks=Pas de bookmarks personnels.
ClickToAdd=Cliquer ici pour ajouter.
NoRecordedCustomers=Pas de client enregistré
NoRecordedContacts=Pas de contact enregistré
-BoxTitleLastActionsToDo=Les %s derniers événements à réaliser
-BoxTitleLastContracts=Les %s derniers contrats
-BoxTitleLastModifiedDonations=Les %s derniers dons modifiés
-BoxTitleLastModifiedExpenses=Les %s dernières note de frais modifiées
NoActionsToDo=Pas d'événements à réaliser
NoRecordedOrders=Pas de commande client enregistrée
NoRecordedProposals=Pas de proposition commerciale enregistrée
@@ -67,4 +69,4 @@ NoModifiedSupplierBills=Pas de facture fournisseur modifiée
NoRecordedProducts=Pas de produit/service enregistré
NoRecordedProspects=Pas de prospect enregistré
NoContractedProducts=Pas de produit/service contracté
-NoRecordedContracts=Pas de contrat enregistré
\ No newline at end of file
+NoRecordedContracts=Pas de contrat enregistré
diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang
index 36e28880dac..48524434588 100644
--- a/htdocs/langs/fr_FR/contracts.lang
+++ b/htdocs/langs/fr_FR/contracts.lang
@@ -85,6 +85,7 @@ ConfirmMoveToAnotherContractQuestion=Choisissez vers quel autre contrat de ce m
PaymentRenewContractId=Renouvellement service (numéro %s)
ExpiredSince=Expiré le
RelatedContracts=Contrats associés
+NoExpiredServices=Pas de services actifs expirés
##### Types de contacts #####
TypeContact_contrat_internal_SALESREPSIGN=Commercial signataire du contrat
TypeContact_contrat_internal_SALESREPFOLL=Commercial suivi du contrat
|