New: PDF event report show project and status of event

Fix: Can edit description of intervention
New: Show status of object on refere page.
This commit is contained in:
Laurent Destailleur 2014-09-15 12:48:24 +02:00
parent 2dbbc76645
commit 0d6d064e7e
8 changed files with 55 additions and 17 deletions

View File

@ -5,6 +5,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* *****
For users:
- New: PDF event report show project and status of event.
- New: Can filter on status on interventions.
- New: Add help info of field type into dictionary of payment types.
- New: Add proposals into referer page of thirdparty.

View File

@ -92,7 +92,7 @@ if ($resql)
{
$num = $db->num_rows($resql);
print_barre_liste($langs->trans("Actions"), $page, "index.php",'',$sortfield,$sortorder,'',$num);
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
$i = 0;
print '<table class="noborder" width="100%">';

View File

@ -27,6 +27,8 @@
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
/**
* Class to generate event report
@ -59,6 +61,7 @@ class CommActionRapport
{
global $conf,$langs;
$langs->load("commercial");
$langs->load("projects");
$this->db = $db;
$this->description = "";
@ -197,9 +200,9 @@ class CommActionRapport
$y++;
$pdf->SetFont('','',8);
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,";
$sql = "SELECT s.nom as thirdparty, s.rowid as socid, s.client,";
$sql.= " a.id, a.datep as dp, a.datep2 as dp2,";
$sql.= " a.fk_contact, a.note, a.percent as percent, a.label,";
$sql.= " a.fk_contact, a.note, a.percent as percent, a.label, a.fk_project,";
$sql.= " c.code, c.libelle,";
$sql.= " u.login";
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
@ -209,6 +212,9 @@ class CommActionRapport
$sql.= " AND '".$this->db->idate(dol_get_last_day($this->year,$this->month,false))."'";
$sql.= " ORDER BY a.datep DESC";
$eventstatic=new ActionComm($this->db);
$projectstatic=new Project($this->db);
dol_syslog(get_class($this)."::_page", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@ -221,6 +227,11 @@ class CommActionRapport
{
$obj = $this->db->fetch_object($resql);
$eventstatic->id=$obj->id;
$eventstatic->percentage=$obj->percentage;
$eventstatic->fulldayevent=$obj->fulldayevent;
$eventstatic->punctual=$obj->punctual;
$y = max($y, $pdf->GetY(), $y0, $y1, $y2, $y3);
// Calculate height of text
@ -228,6 +239,16 @@ class CommActionRapport
if (! preg_match('/^'.preg_quote($obj->label).'/',$obj->note)) $text=$obj->label."\n";
$text.=$obj->note;
$text=dol_trunc(dol_htmlentitiesbr_decode($text),150);
// Add status to text
$text.="\n";
$status=dol_htmlentitiesbr_decode($eventstatic->getLibStatut(1,1));
$text.=$status;
if ($obj->fk_project > 0)
{
$projectstatic->fetch($obj->fk_project);
$text.=($status?' - ':'').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->getNomUrl(0, 'nolink'));
}
//print 'd'.$text; exit;
$nboflines=dol_nboflines($text);
$heightlinemax=max(2*$height,$nboflines*$height);
@ -249,7 +270,7 @@ class CommActionRapport
// Third party
$pdf->SetXY(26, $y);
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->societe),32), 0, 'L', 0);
$pdf->MultiCell(32, $height, dol_trunc($outputlangs->convToOutputCharset($obj->thirdparty),32), 0, 'L', 0);
$y1 = $pdf->GetY();
// Action code

View File

@ -796,7 +796,7 @@ class Fichinter extends CommonObject
*
* @param User $user Object user who modify
* @param string $description description
* @return int <0 if ko, >0 if ok
* @return int <0 if KO, >0 if OK
*/
function set_description($user, $description)
{
@ -808,7 +808,6 @@ class Fichinter extends CommonObject
$sql.= " SET description = '".$this->db->escape($description)."'";
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND fk_statut = 0";
if ($this->db->query($sql))
{

View File

@ -1627,8 +1627,10 @@ else if ($id > 0 || ! empty($ref))
// Modify
if ($object->statut == 1 && $user->rights->ficheinter->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?id='.$object->id.'&action=modify"';
print '>'.$langs->trans("Modify").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="fiche.php?id='.$object->id.'&action=modify">';
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) print $langs->trans("Modify");
else print $langs->trans("SetToDraft");
print '</a></div>';
}
// Send

View File

@ -645,6 +645,7 @@ OptionalFieldsSetup=Extra attributes setup
URLPhoto=URL of photo/logo
SetLinkToThirdParty=Link to another third party
CreateDraft=Create draft
SetToDraft=Back to draft
ClickToEdit=Click to edit
ObjectDeleted=Object %s deleted
ByCountry=By country

View File

@ -645,6 +645,7 @@ OptionalFieldsSetup=Configuration des attributs complémentaires
URLPhoto=URL de la photo/logo
SetLinkToThirdParty=Lier vers un autre tiers
CreateDraft=Créer brouillon
SetToDraft=Repasser en brouillon
ClickToEdit=Cliquer ici pour éditer
ObjectDeleted=Objet %s supprimé
ByCountry=Par pays

View File

@ -179,7 +179,7 @@ if ($type_element == 'fichinter')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$documentstatic=new Fichinter($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, ';
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, ';
$tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines.
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND f.entity = ".$conf->entity;
@ -190,7 +190,7 @@ if ($type_element == 'invoice')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$documentstatic=new Facture($db);
$sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as dateprint, ';
$sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, ';
$tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_facture = f.rowid";
@ -203,7 +203,7 @@ if ($type_element == 'propal')
{
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$documentstatic=new Propal($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as datePrint, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as datePrint, c.fk_statut as status, ';
$tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_propal = c.rowid";
@ -216,7 +216,7 @@ if ($type_element == 'order')
{
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$documentstatic=new Commande($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, ';
$tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_commande = c.rowid";
@ -229,7 +229,7 @@ if ($type_element == 'supplier_invoice')
{ // Supplier : Show products from invoices.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$documentstatic=new FactureFournisseur($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, ';
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, ';
$tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_facture_fourn = f.rowid";
@ -241,7 +241,7 @@ if ($type_element == 'supplier_order')
{ // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$documentstatic=new CommandeFournisseur($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, ';
$tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_commande = c.rowid";
@ -296,6 +296,7 @@ print '<table class="liste" width="100%">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
// Filters
@ -307,6 +308,8 @@ print '<td class="liste_titre">'; // date
print $formother->select_month($month?$month:-1,'month',1);
$formother->select_year($year?$year:-1,'year',1, 20, 1);
print '</td>';
print '<td class="liste_titre" align="center">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).'">';
print '</td>';
@ -323,16 +326,26 @@ if ($sql_select)
$i = 0;
while (($objp = $db->fetch_object($resql)) && $i < $conf->liste_limit )
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td class="nobordernopadding nowrap" width="100">';
$documentstatic->id=$objp->doc_id;
$documentstatic->ref=$objp->doc_number;
$documentstatic->type=$objp->type;
$documentstatic->fk_statut=$objp->status;
$documentstatic->fk_status=$objp->status;
$documentstatic->statut=$objp->status;
$documentstatic->status=$objp->status;
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td class="nobordernopadding nowrap" width="100">';
print $documentstatic->getNomUrl(1);
print '</td>';
print '<td align="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),'day').'</td>';
// Status
print '<td align="center">';
print $documentstatic->getLibStatut(2);
print '</td>';
print '<td>';
// Define text, description and type