mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Add box for expired services
This commit is contained in:
parent
c614118e88
commit
71e0f825b2
|
|
@ -27,6 +27,7 @@ For users:
|
|||
- New: Add hidden option PROJECT_HIDE_UNSELECTABLES to hide project you can't select into combo list.
|
||||
- New: Add option INVOICE_POSITIVE_CREDIT_NOTE.
|
||||
- New: Support zip/town autocompletion into warehouses.
|
||||
- New: Add box for last expired services.
|
||||
- Fix: Can use POS module with several concurrent users.
|
||||
|
||||
For developers:
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ $sql = "SELECT rowid, file, note, tms";
|
|||
$sql.= " FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
$var=True;
|
||||
$var=true;
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
|
|
@ -325,6 +325,7 @@ if ($resql)
|
|||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||
}
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
|
@ -421,6 +422,7 @@ if ($resql)
|
|||
$logo=preg_replace("/^object_/i","",$box->boximg);
|
||||
}
|
||||
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.img_object("",$logo).' '.$box->boxlabel.'</td>';
|
||||
print '<td>' . ($obj->note?$obj->note:' ') . '</td>';
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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 '<td class="liste_titre">';
|
||||
print '<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.$search_contract.'">';
|
||||
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
|
||||
print '</td>';
|
||||
// Service label
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="18" name="search_service" value="'.$search_service.'">';
|
||||
print '<input type="text" class="flat" size="18" name="search_service" value="'.dol_escape_htmltag($search_service).'">';
|
||||
print '</td>';
|
||||
// Third party
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="24" name="search_nom" value="'.$search_nom.'">';
|
||||
print '<input type="text" class="flat" size="24" name="search_nom" value="'.dol_escape_htmltag($search_nom).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$arrayofoperators=array('<'=>'<','>'=>'>');
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
151
htdocs/core/boxes/box_services_expired.php
Normal file
151
htdocs/core/boxes/box_services_expired.php
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
NoRecordedContracts=No recorded contracts
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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é
|
||||
NoRecordedContracts=Pas de contrat enregistré
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user