Enhance donation module
This commit is contained in:
parent
4425166996
commit
f139eb83b1
@ -20,6 +20,7 @@ For users:
|
||||
- When creating a contract, sales representative are preset to user. This save
|
||||
4 clicks.
|
||||
- Can edit several fields in bank transaction line page into one update.
|
||||
- New: Enhance donation module. Add a status "canceled".
|
||||
- New: Usage of Jquery Notify to show result or error messages on action.
|
||||
- New: If a service contains subproducts, subrpoducts are decrease when service
|
||||
is decrease.
|
||||
|
||||
@ -223,19 +223,6 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print list of errors
|
||||
*/
|
||||
function print_error_list()
|
||||
{
|
||||
$num = sizeof($this->error);
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
print "<li>" . $this->error[$i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie le libelle traduit de la nature d'un adherent (physique ou morale)
|
||||
* @param morphy Nature physique ou morale de l'adherent
|
||||
|
||||
@ -64,18 +64,6 @@ class AdherentOptions
|
||||
$this->attribute_size = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief fonction qui imprime un liste d'erreurs
|
||||
*/
|
||||
function print_error_list()
|
||||
{
|
||||
$num = sizeof($this->error);
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
print "<li>" . $this->error[$i];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new optionnal attribute
|
||||
* @param attrname code of attribute
|
||||
@ -95,7 +83,7 @@ class AdherentOptions
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -225,7 +213,7 @@ class AdherentOptions
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -61,19 +61,6 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief print_error_list
|
||||
*/
|
||||
function print_error_list()
|
||||
{
|
||||
$num = sizeof($this->error);
|
||||
for ($i = 0 ; $i < $num ; $i++)
|
||||
{
|
||||
print "<li>" . $this->error[$i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction qui permet de creer le status de l'adherent
|
||||
* \param userid userid de l'adherent
|
||||
|
||||
@ -120,7 +120,6 @@ if ($resql)
|
||||
$db->free($resql);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</td></tr>'."\n";
|
||||
$var=true;
|
||||
$listofstatus=array(0,1,2,3,3,-1);
|
||||
$bool=false;
|
||||
foreach ($listofstatus as $status)
|
||||
@ -136,6 +135,7 @@ if ($resql)
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
$var=true;
|
||||
$bool=false;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-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
|
||||
@ -20,13 +20,14 @@
|
||||
/**
|
||||
* \file htdocs/compta/dons/fiche.php
|
||||
* \ingroup don
|
||||
* \brief Page de fiche de don
|
||||
* \brief Page of donation card
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/dons/modules_don.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/lib/project.lib.php');
|
||||
@ -36,6 +37,7 @@ $langs->load("donations");
|
||||
$langs->load("bills");
|
||||
|
||||
$mesg="";
|
||||
$mesgs=array();
|
||||
|
||||
$don = new Don($db);
|
||||
$donation_date=dol_mktime(12, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
@ -55,18 +57,18 @@ if ($_POST["action"] == 'update')
|
||||
|
||||
$error=0;
|
||||
|
||||
if (empty($donation_date))
|
||||
{
|
||||
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date"));
|
||||
$_GET["action"] = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $_POST["amount"] > 0)
|
||||
{
|
||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
|
||||
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
|
||||
$_GET["action"] = "create";
|
||||
$error=1;
|
||||
}
|
||||
|
||||
if (empty($donation_date))
|
||||
{
|
||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date"));
|
||||
$_GET["action"] = "create";
|
||||
$error=1;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -79,8 +81,10 @@ if ($_POST["action"] == 'update')
|
||||
$don->societe = $_POST["societe"];
|
||||
$don->adresse = $_POST["adresse"];
|
||||
$don->amount = price2num($_POST["amount"]);
|
||||
$don->cp = $_POST["cp"];
|
||||
$don->ville = $_POST["ville"];
|
||||
$don->cp = $_POST["zipcode"];
|
||||
$don->ville = $_POST["town"];
|
||||
$don->zip = $_POST["zipcode"];
|
||||
$don->town = $_POST["town"];
|
||||
$don->email = $_POST["email"];
|
||||
$don->date = $donation_date;
|
||||
$don->note = $_POST["note"];
|
||||
@ -108,18 +112,18 @@ if ($_POST["action"] == 'add')
|
||||
|
||||
$error=0;
|
||||
|
||||
if (empty($donation_date))
|
||||
{
|
||||
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Date"));
|
||||
$_GET["action"] = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $_POST["amount"] > 0)
|
||||
{
|
||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
|
||||
$mesgs[]=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
|
||||
$_GET["action"] = "create";
|
||||
$error=1;
|
||||
}
|
||||
|
||||
if (empty($donation_date))
|
||||
{
|
||||
$mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date"));
|
||||
$_GET["action"] = "create";
|
||||
$error=1;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -129,8 +133,10 @@ if ($_POST["action"] == 'add')
|
||||
$don->societe = $_POST["societe"];
|
||||
$don->adresse = $_POST["adresse"];
|
||||
$don->amount = price2num($_POST["amount"]);
|
||||
$don->cp = $_POST["cp"];
|
||||
$don->ville = $_POST["ville"];
|
||||
$don->cp = $_POST["zipcode"];
|
||||
$don->ville = $_POST["town"];
|
||||
$don->zip = $_POST["zipcode"];
|
||||
$don->town = $_POST["town"];
|
||||
$don->email = $_POST["email"];
|
||||
$don->date = $donation_date;
|
||||
$don->note = $_POST["note"];
|
||||
@ -162,27 +168,39 @@ if ($_POST["action"] == 'commentaire')
|
||||
}
|
||||
if ($_GET["action"] == 'valid_promesse')
|
||||
{
|
||||
if ($don->valid_promesse($_GET["rowid"], $user->id))
|
||||
if ($don->valid_promesse($_GET["rowid"], $user->id) >= 0)
|
||||
{
|
||||
Header("Location: fiche.php?rowid=".$_GET["rowid"]);
|
||||
exit;
|
||||
}
|
||||
else $mesg=$don->error;
|
||||
}
|
||||
if ($_GET["action"] == 'set_cancel')
|
||||
{
|
||||
if ($don->set_cancel($_GET["rowid"]) >= 0)
|
||||
{
|
||||
Header("Location: fiche.php?rowid=".$_GET["rowid"]);
|
||||
exit;
|
||||
}
|
||||
else $mesg=$don->error;
|
||||
}
|
||||
if ($_GET["action"] == 'set_paid')
|
||||
{
|
||||
if ($don->set_paye($_GET["rowid"], $modepaiement))
|
||||
if ($don->set_paye($_GET["rowid"], $modepaiement) >= 0)
|
||||
{
|
||||
Header("Location: fiche.php?rowid=".$_GET["rowid"]);
|
||||
exit;
|
||||
}
|
||||
else $mesg=$don->error;
|
||||
}
|
||||
if ($_GET["action"] == 'set_encaisse')
|
||||
{
|
||||
if ($don->set_encaisse($_GET["rowid"]))
|
||||
if ($don->set_encaisse($_GET["rowid"]) >= 0)
|
||||
{
|
||||
Header("Location: liste.php");
|
||||
Header("Location: fiche.php?rowid=".$_GET["rowid"]);
|
||||
exit;
|
||||
}
|
||||
else $mesg=$don->error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -230,6 +248,7 @@ llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:M
|
||||
|
||||
$html=new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
$htmlcompany = new FormCompany($db);
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -242,7 +261,7 @@ if ($_GET["action"] == 'create')
|
||||
{
|
||||
print_fiche_titre($langs->trans("AddDonation"));
|
||||
|
||||
if ($mesg) print '<div class="error">'.$mesg.'</div>';
|
||||
dol_htmloutput_errors($mesg,$mesgs);
|
||||
|
||||
print '<form name="add" action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -250,28 +269,20 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
// Date
|
||||
$nbrows=11;
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
$html->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1);
|
||||
print '</td>';
|
||||
|
||||
$nbrows=11;
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$_POST["comment"]."</textarea></td>";
|
||||
print "</tr>";
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$_POST["comment"]."</textarea></td></tr>";
|
||||
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
$html->select_types_paiements('', 'modepaiement', 'CRDT', 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
// Si module projet actif
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
select_projects('',$_POST["projectid"],"projectid");
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
// Amount
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.$_POST["amount"].'" size="10"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
|
||||
print $html->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
|
||||
@ -282,10 +293,29 @@ if ($_GET["action"] == 'create')
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="nom" value="'.$_POST["nom"].'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$_POST["adresse"].'</textarea></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" value="'.$_POST["cp"].'" size="8"> <input type="text" name="ville" value="'.$_POST["ville"].'" size="40"></td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $htmlcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectpays_id','departement_id'),6);
|
||||
print ' ';
|
||||
print $htmlcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectpays_id','departement_id'));
|
||||
print '</tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" value="'.$_POST["pays"].'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.$_POST["email"].'" size="40"></td></tr>';
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.$_POST["amount"].'" size="10"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
$html->select_types_paiements('', 'modepaiement', 'CRDT', 0, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
// Si module projet actif
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
select_projects('',$_POST["projectid"],"projectid");
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '<br><center><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||
print "</form>\n";
|
||||
@ -324,25 +354,20 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
$nbrows=12;
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
|
||||
// Date
|
||||
print "<tr>".'<td width="25%" class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
$html->select_date($don->date,'','','','',"update");
|
||||
print '</td>';
|
||||
|
||||
$nbrows=12;
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note."</textarea></td>";
|
||||
print "</tr>";
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note."</textarea></td></tr>";
|
||||
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
|
||||
select_projects($soc->id, isset($_POST["projectid"])?$_POST["projectid"]:$don->fk_project, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Amount
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$don->amount.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
|
||||
print $html->selectyesno("public",1,1);
|
||||
@ -355,17 +380,32 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="nom" size="40" value="'.$don->nom.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="'.ROWS_3.'">'.$don->adresse.'</textarea></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.$don->cp.'"> <input type="text" name="ville" size="40" value="'.$don->ville.'"></td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $htmlcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectpays_id','departement_id'),6);
|
||||
print ' ';
|
||||
print $htmlcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectpays_id','departement_id'));
|
||||
print '</tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40" value="'.$don->pays.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$don->email.'"></td></tr>';
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$don->amount.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
$html->select_types_paiements('', 'modepaiement', 'CRDT', 0);
|
||||
print "</td></tr>\n";
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
$html->select_types_paiements('', 'modepaiement', 'CRDT', 0, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||
select_projects($soc->id, isset($_POST["projectid"])?$_POST["projectid"]:$don->fk_project, 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br><center><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||
@ -385,7 +425,7 @@ if ($_GET["rowid"] && $_GET["action"] == 'edit')
|
||||
if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
{
|
||||
$don->id = $_GET["rowid"];
|
||||
$don->fetch($_GET["rowid"]);
|
||||
$result=$don->fetch($_GET["rowid"]);
|
||||
|
||||
|
||||
$h=0;
|
||||
@ -400,6 +440,9 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$nbrows=12;
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
|
||||
// Ref
|
||||
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||
print $html->showrefnav($don,'rowid','',1,'rowid','ref','');
|
||||
@ -407,21 +450,14 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print "<tr><td>".$langs->trans("Date")."</td><td>";
|
||||
print '<tr><td width="25%">'.$langs->trans("Date").'</td><td>';
|
||||
print dol_print_date($don->date,"day");
|
||||
print "</td>";
|
||||
|
||||
$nbrows=12;
|
||||
if ($conf->projet->enabled) $nbrows++;
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
|
||||
print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
|
||||
print nl2br($don->note).'</td></tr>';
|
||||
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
print "<tr>".'<td>'.$langs->trans("Project").'</td><td>'.$don->projet.'</td></tr>';
|
||||
}
|
||||
print "<tr>".'<td>'.$langs->trans("Amount").'</td><td>'.price($don->amount).' '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("PublicDonation")."</td><td>";
|
||||
print yn($don->public);
|
||||
@ -430,17 +466,30 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
print "<tr>".'<td>'.$langs->trans("Company").'</td><td>'.$don->societe.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td>'.$don->prenom.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td>'.$don->nom.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>'.nl2br($don->adresse).'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'.$don->cp.' '.$don->ville.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>'.dol_nl2br($don->adresse).'</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print "<tr>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'.$don->cp.($don->cp && $don->ville?' / ':'').$don->ville.'</td></tr>';
|
||||
|
||||
// Country
|
||||
print "<tr>".'<td>'.$langs->trans("Country").'</td><td>'.$don->pays.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td>'.$don->email.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Amount").'</td><td>'.price($don->amount).' '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
||||
|
||||
// EMail
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($don->email).'</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||
print $don->modepaiement;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Project
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
print "<tr>".'<td>'.$langs->trans("Project").'</td><td>'.$don->projet.'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print "</form>\n";
|
||||
|
||||
@ -462,6 +511,11 @@ if ($_GET["rowid"] && $_GET["action"] != 'edit')
|
||||
print '<a class="butAction" href="fiche.php?rowid='.$don->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a>';
|
||||
}
|
||||
|
||||
if (($don->statut == 0 || $don->statut == 1) && $resteapayer == 0 && $don->paye == 0)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$don->id&action=set_cancel\">".$langs->trans("ClassifyCanceled")."</a>";
|
||||
}
|
||||
|
||||
// TODO Gerer action emettre paiement
|
||||
if ($don->statut == 1 && $resteapayer > 0)
|
||||
{
|
||||
|
||||
@ -29,6 +29,15 @@ require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php");
|
||||
|
||||
$langs->load("donations");
|
||||
|
||||
$donation_static=new Don($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -67,29 +76,47 @@ print_fiche_titre($langs->trans("DonationsArea"));
|
||||
|
||||
print '<table width="100%" class="notopnoleftnoright">';
|
||||
|
||||
print '<tr><td class="notopnoleft">';
|
||||
// Left area
|
||||
print '<tr><td class="notopnoleft" width="30%" valign="top">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="50%">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4">'.$langs->trans("Statistics").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$listofstatus=array(0,1,-1,2);
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[]=array('label'=>$donstatic->LibStatut($status,1),'values'=>array(0=>(isset($nb[$status])?$nb[$status]:0)));
|
||||
}
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<tr><td align="center" colspan="4">';
|
||||
$data=array('series'=>$dataseries);
|
||||
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Status").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Number").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Average").'</td>';
|
||||
print "</tr>\n";
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
|
||||
for ($i = 0 ; $i < 3 ; $i++)
|
||||
$var=true;
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="liste.php?statut='.$i.'">'.$donstatic->LibStatut($i,4).'</a></td>';
|
||||
print '<td align="right">'.$nb[$i].'</td>';
|
||||
print '<td align="right">'.($nb[$i]?price($somme[$i],'MT'):' ').'</td>';
|
||||
print '<td align="right">'.($nb[$i]?price(price2num($somme[$i]/$nb[$i],'MT')):' ').'</td>';
|
||||
$totalnb += $nb[$i];
|
||||
$total += $somme[$i];
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td><a href="liste.php?statut='.$status.'">'.$donstatic->LibStatut($status,4).'</a></td>';
|
||||
print '<td align="right">'.$nb[$status].'</td>';
|
||||
print '<td align="right">'.($nb[$status]?price($somme[$status],'MT'):' ').'</td>';
|
||||
print '<td align="right">'.($nb[$status]?price(price2num($somme[$status]/$nb[$status],'MT')):' ').'</td>';
|
||||
$totalnb += $nb[$status];
|
||||
$total += $somme[$status];
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
@ -102,6 +129,75 @@ print '</tr>';
|
||||
print "</table>";
|
||||
|
||||
|
||||
// Right area
|
||||
print '</td><td valign="top">';
|
||||
|
||||
|
||||
|
||||
$max=5;
|
||||
|
||||
/*
|
||||
* Last modified proposals
|
||||
*/
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.societe, c.nom,";
|
||||
$sql.= " tms as datem, amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as c";
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
//$sql.= " AND c.fk_statut > 2";
|
||||
$sql.= " ORDER BY c.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5">'.$langs->trans("LastModifiedDonations",$max).'</td></tr>';
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$var = True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$var=!$var;
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
$donation_static->id=$obj->rowid;
|
||||
$donation_static->ref=$obj->ref?$obj->ref:$obj->rowid;
|
||||
|
||||
print '<td width="94" class="nobordernopadding" nowrap="nowrap">';
|
||||
print $donation_static->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="nobordernopadding">';
|
||||
print $obj->societe;
|
||||
print ($obj->societe && $obj->nom?' / ':'');
|
||||
print $obj->nom;
|
||||
print '</td>';
|
||||
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
print price($obj->amount);
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||
|
||||
print '<td align="right">'.$donation_static->LibStatut($obj->fk_statut,5).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -74,31 +74,33 @@ if ($result)
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
$param="&statut=$statut&sortorder=$sortorder&sortfield=$sortfield";
|
||||
|
||||
if ($statut >= 0)
|
||||
{
|
||||
$donationstatic->statut=$statut;
|
||||
$label=$donationstatic->getLibStatut(0);
|
||||
print_barre_liste($label, $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield");
|
||||
print_barre_liste($label, $page, $_SERVER["PHP_SELF"], $param, '', '', '', $num);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_barre_liste($langs->trans("Donations"), $page, "liste.php", "&statut=$statut&sortorder=$sortorder&sortfield=$sortfield");
|
||||
print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, '', '', '', $num);
|
||||
}
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),"liste.php","d.rowid","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Firstname"),"liste.php","d.prenom","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Name"),"liste.php","d.nom","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),"liste.php","d.societe","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),"liste.php","d.datedon","&page=$page&statut=$statut","",'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"d.societe","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.nom","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.datedon","&page=$page&statut=$statut","",'align="center"',$sortfield,$sortorder);
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
$langs->load("projects");
|
||||
print_liste_field_titre($langs->trans("Project"),"liste.php","projet","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"fk_don_projet","&page=$page&statut=$statut","","",$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Amount"),"liste.php","d.amount","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"d.amount","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.fk_statut","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
$var=True;
|
||||
@ -109,11 +111,12 @@ if ($result)
|
||||
print "<tr $bc[$var]>";
|
||||
$donationstatic->id=$objp->rowid;
|
||||
$donationstatic->ref=$objp->rowid;
|
||||
$donationstatic->nom=$objp->nom;
|
||||
$donationstatic->prenom=$objp->prenom;
|
||||
print "<td>".$donationstatic->getNomUrl(1)."</td>\n";
|
||||
print "<td>".$objp->prenom."</td>\n";
|
||||
print "<td>".$objp->nom."</td>\n";
|
||||
print "<td>".$objp->societe."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datedon)).'</td>';
|
||||
print "<td>".$objp->societe."</td>\n";
|
||||
print "<td>".$donationstatic->getFullName($langs)."</td>\n";
|
||||
print '<td align="center">'.dol_print_date($db->jdate($objp->datedon),'day').'</td>';
|
||||
if ($conf->projet->enabled)
|
||||
{
|
||||
print "<td>";
|
||||
|
||||
@ -23,3 +23,4 @@ DonationStatusPaidShort=Received
|
||||
ValidPromess=Validate promise
|
||||
BuildDonationReceipt=Build receipt
|
||||
DonationsModels=Documents models for donation receipts
|
||||
LastModifiedDonations=Last %s modified donations
|
||||
@ -22,4 +22,5 @@ DonationStatusPromiseValidatedShort=Validée
|
||||
DonationStatusPaidShort=Payé
|
||||
ValidPromess=Valider promesse
|
||||
BuildDonationReceipt=Créer reçu
|
||||
DonationsModels=Modèle de document de bon de réception de dons
|
||||
DonationsModels=Modèle de document de bon de réception de dons
|
||||
LastModifiedDonations=Les %s derniers dons modifiés
|
||||
Loading…
Reference in New Issue
Block a user