Work on module donations
This commit is contained in:
parent
c197e00090
commit
1cd81f0e81
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* 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
|
||||
@ -26,6 +27,7 @@
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/dons/modules_don.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.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';
|
||||
@ -33,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("donations");
|
||||
@ -43,7 +46,7 @@ $action=GETPOST('action','alpha');
|
||||
$cancel=GETPOST('cancel');
|
||||
$amount=GETPOST('amount');
|
||||
|
||||
$don = new Don($db);
|
||||
$object = new Don($db);
|
||||
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
|
||||
// Security check
|
||||
@ -83,28 +86,26 @@ if ($action == 'update')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$don->fetch($id);
|
||||
$object->fetch($id);
|
||||
|
||||
$don->firstname = $_POST["firstname"];
|
||||
$don->lastname = $_POST["lastname"];
|
||||
$don->societe = $_POST["societe"];
|
||||
$don->address = $_POST["address"];
|
||||
$don->amount = price2num($_POST["amount"]);
|
||||
$don->town = $_POST["town"];
|
||||
$don->zip = $_POST["zipcode"];
|
||||
$don->country = $_POST["country"];
|
||||
$don->email = $_POST["email"];
|
||||
$don->date = $donation_date;
|
||||
$don->note = $_POST["note"];
|
||||
$don->public = $_POST["public"];
|
||||
$don->fk_project = $_POST["projectid"];
|
||||
$don->note_private= GETPOST("note_private");
|
||||
$don->note_public = GETPOST("note_public");
|
||||
$don->modepaiementid = $_POST["modepaiement"];
|
||||
$object->firstname = GETPOST("firstname");
|
||||
$object->lastname = GETPOST("lastname");
|
||||
$object->societe = GETPOST("societe");
|
||||
$object->address = GETPOST("address");
|
||||
$object->amount = price2num(GETPOST("amount"));
|
||||
$object->town = GETPOST("town");
|
||||
$object->zip = GETPOST("zipcode");
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->email = GETPOST("email");
|
||||
$object->date = $donation_date;
|
||||
$object->public = GETPOST("public");
|
||||
$object->fk_project = GETPOST("projectid");
|
||||
$object->note_private= GETPOST("note_private");
|
||||
$object->note_public = GETPOST("note_public");
|
||||
|
||||
if ($don->update($user) > 0)
|
||||
if ($object->update($user) > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$don->id);
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -136,24 +137,23 @@ if ($action == 'add')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$don->firstname = $_POST["firstname"];
|
||||
$don->lastname = $_POST["lastname"];
|
||||
$don->societe = $_POST["societe"];
|
||||
$don->address = $_POST["address"];
|
||||
$don->amount = price2num($_POST["amount"]);
|
||||
$don->town = $_POST["town"];
|
||||
$don->zip = $_POST["zipcode"];
|
||||
$don->town = $_POST["town"];
|
||||
$don->country = $_POST["country"];
|
||||
$don->email = $_POST["email"];
|
||||
$don->date = $donation_date;
|
||||
$don->note_private= GETPOST("note_private");
|
||||
$don->note_public = GETPOST("note_public");
|
||||
$don->public = $_POST["public"];
|
||||
$don->fk_project = $_POST["projectid"];
|
||||
$don->modepaiementid = $_POST["modepaiement"];
|
||||
$object->firstname = GETPOST("firstname");
|
||||
$object->lastname = GETPOST("lastname");
|
||||
$object->societe = GETPOST("societe");
|
||||
$object->address = GETPOST("address");
|
||||
$object->amount = price2num(GETPOST("amount"));
|
||||
$object->town = GETPOST("town");
|
||||
$object->zip = GETPOST("zipcode");
|
||||
$object->town = GETPOST("town");
|
||||
$object->country_id = GETPOST('country_id', 'int');
|
||||
$object->email = GETPOST("email");
|
||||
$object->date = $donation_date;
|
||||
$object->note_private= GETPOST("note_private");
|
||||
$object->note_public = GETPOST("note_public");
|
||||
$object->public = GETPOST("public");
|
||||
$object->fk_project = GETPOST("projectid");
|
||||
|
||||
if ($don->create($user) > 0)
|
||||
if ($object->create($user) > 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
@ -163,57 +163,57 @@ if ($action == 'add')
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$don->delete($id);
|
||||
$object->delete($id);
|
||||
header("Location: list.php");
|
||||
exit;
|
||||
}
|
||||
if ($action == 'commentaire')
|
||||
{
|
||||
$don->fetch($id);
|
||||
$don->update_note($_POST["commentaire"]);
|
||||
$object->fetch($id);
|
||||
$object->update_note(GETPOST("commentaire"));
|
||||
}
|
||||
if ($action == 'valid_promesse')
|
||||
{
|
||||
if ($don->valid_promesse($id, $user->id) >= 0)
|
||||
if ($object->valid_promesse($id, $user->id) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($don->error, 'errors');
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
if ($action == 'set_cancel')
|
||||
{
|
||||
if ($don->set_cancel($id) >= 0)
|
||||
if ($object->set_cancel($id) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($don->error, 'errors');
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
if ($action == 'set_paid')
|
||||
{
|
||||
if ($don->set_paye($id, $modepaiement) >= 0)
|
||||
if ($object->set_paye($id, $modepaiement) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($don->error, 'errors');
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
if ($action == 'set_encaisse')
|
||||
{
|
||||
if ($don->set_encaisse($id) >= 0)
|
||||
if ($object->set_encaisse($id) >= 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
setEventMessage($don->error, 'errors');
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ if ($action == 'create')
|
||||
{
|
||||
print_fiche_titre($langs->trans("AddDonation"));
|
||||
|
||||
print '<form name="add" action="card.php" method="post">';
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -278,40 +278,57 @@ if ($action == 'create')
|
||||
if (! empty($conf->projet->enabled)) $nbrows++;
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Date").'</td><td>';
|
||||
$form->select_date($donation_date?$donation_date:-1,'','','','',"add",1,1);
|
||||
print '</td>';
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".GETPOST("note_private")."</textarea></td>";
|
||||
print "</tr>";
|
||||
|
||||
// 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->currency).'</td></tr>';
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" value="'.GETPOST("amount").'" size="10"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
|
||||
print $form->selectyesno("public",isset($_POST["public"])?$_POST["public"]:1,1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.$_POST["societe"].'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.$_POST["firstname"].'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.$_POST["lastname"].'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" value="'.GETPOST("societe").'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" value="'.GETPOST("lastname").'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" value="'.GETPOST("firstname").'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" cols="40" rows="3">'.$_POST["address"].'</textarea></td></tr>';
|
||||
print '<textarea name="address" wrap="soft" cols="40" rows="3">'.GETPOST("address").'</textarea></td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
|
||||
print ' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print '</tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="country" value="'.$_POST["country"].'" size="40"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.$_POST["email"].'" size="40"></td></tr>';
|
||||
// Country
|
||||
print '<tr><td width="25%"><label for="selectcountry_id">'.$langs->trans('Country').'</label></td><td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_country(GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" value="'.GETPOST("email").'" size="40"></td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
$form->select_types_paiements('', 'modepaiement', 'CRDT', 0, 1);
|
||||
print "</td></tr>\n";
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->societe_id)) {
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">' . $langs->trans('NotePrivate') . '</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
@ -320,13 +337,13 @@ if ($action == 'create')
|
||||
|
||||
// Si module projet actif
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
$formproject->select_projects('',$_POST["projectid"],"projectid");
|
||||
$formproject->select_projects('',GETPOST("projectid"),"projectid");
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print "</table>\n";
|
||||
print '<br><div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
|
||||
@ -342,26 +359,21 @@ if ($action == 'create')
|
||||
|
||||
if (! empty($id) && $action == 'edit')
|
||||
{
|
||||
$don->fetch($id);
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER['PHP_SELF']."?id=".$don->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
$object->fetch($id);
|
||||
|
||||
$head = donation_prepare_head($object);
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
||||
|
||||
print '<form name="update" action="card.php" method="post">';
|
||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$don->id.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||
|
||||
// Ref
|
||||
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||
print $don->getNomUrl();
|
||||
print $object->getNomUrl();
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -370,15 +382,11 @@ if (! empty($id) && $action == 'edit')
|
||||
|
||||
// Date
|
||||
print "<tr>".'<td width="25%" class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
$form->select_date($don->date,'','','','',"update");
|
||||
$form->select_date($object->date,'','','','',"update");
|
||||
print '</td>';
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top">'.$langs->trans("Comments").' :<br>';
|
||||
print "<textarea name=\"note_private\" wrap=\"soft\" cols=\"40\" rows=\"15\">".$don->note_private."</textarea></td>";
|
||||
print "</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->currency).'</td></tr>';
|
||||
print "<tr>".'<td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input type="text" name="amount" size="10" value="'.$object->amount.'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PublicDonation")."</td><td>";
|
||||
print $form->selectyesno("public",1,1);
|
||||
@ -386,31 +394,36 @@ if (! empty($id) && $action == 'edit')
|
||||
print "</tr>\n";
|
||||
|
||||
$langs->load("companies");
|
||||
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$don->societe.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" size="40" value="'.$don->firstname.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" size="40" value="'.$don->lastname.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.$object->societe.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" size="40" value="'.$object->lastname.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" size="40" value="'.$object->firstname.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="address" wrap="soft" cols="40" rows="'.ROWS_3.'">'.$don->address.'</textarea></td></tr>';
|
||||
print '<textarea name="address" wrap="soft" cols="40" rows="'.ROWS_3.'">'.$object->address.'</textarea></td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>';
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$don->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
|
||||
print $formcompany->select_ziptown((isset($_POST["zipcode"])?$_POST["zipcode"]:$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6);
|
||||
print ' ';
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$don->town),'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print $formcompany->select_ziptown((isset($_POST["town"])?$_POST["town"]:$object->town),'town',array('zipcode','selectcountry_id','state_id'));
|
||||
print '</tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Country").'</td><td><input type="text" name="country" size="40" value="'.$don->country.'"></td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$don->email.'"></td></tr>';
|
||||
// Country
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
print $form->select_country((!empty($object->country_id)?$object->country_id:$mysoc->country_code),'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td><input type="text" name="email" size="40" value="'.$object->email.'"></td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
|
||||
|
||||
if ($don->modepaiementid) $selected = $don->modepaiementid;
|
||||
if ($object->modepaiementid) $selected = $object->modepaiementid;
|
||||
else $selected = '';
|
||||
|
||||
$form->select_types_paiements($selected, 'modepaiement', 'CRDT', 0, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
@ -419,13 +432,13 @@ if (! empty($id) && $action == 'edit')
|
||||
|
||||
$langs->load('projects');
|
||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||
$formproject->select_projects(-1, (isset($_POST["projectid"])?$_POST["projectid"]:$don->fk_project), 'projectid');
|
||||
$formproject->select_projects(-1, (isset($_POST["projectid"])?$_POST["projectid"]:$don->fk_project), 'projectid');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -445,17 +458,12 @@ if (! empty($id) && $action == 'edit')
|
||||
/* ************************************************************ */
|
||||
if (! empty($id) && $action != 'edit')
|
||||
{
|
||||
$result=$don->fetch($id);
|
||||
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER['PHP_SELF']."?id=".$don->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$hselected=$h;
|
||||
$h++;
|
||||
|
||||
$result=$object->fetch($id);
|
||||
|
||||
$head = donation_prepare_head($object);
|
||||
dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic');
|
||||
|
||||
print "<form action=\"card.php\" method=\"post\">";
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -466,54 +474,58 @@ if (! empty($id) && $action != 'edit')
|
||||
|
||||
// Ref
|
||||
print "<tr>".'<td>'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||
print $form->showrefnav($don, 'rowid', $linkback, 1, 'rowid', 'ref', '');
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td width="25%">'.$langs->trans("Date").'</td><td>';
|
||||
print dol_print_date($don->date,"day");
|
||||
print dol_print_date($object->date,"day");
|
||||
print "</td>";
|
||||
|
||||
print '<td rowspan="'.$nbrows.'" valign="top" width="50%">'.$langs->trans("Comments").' :<br>';
|
||||
print nl2br($don->note_private).'</td></tr>';
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Amount").'</td><td>'.price($don->amount,0,$langs,0,0,-1,$conf->currency).'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Amount").'</td><td>'.price($object->amount,0,$langs,0,0,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
print "<tr><td>".$langs->trans("PublicDonation")."</td><td>";
|
||||
print yn($don->public);
|
||||
print yn($object->public);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Company").'</td><td>'.$don->societe.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td>'.$don->firstname.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td>'.$don->lastname.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>'.dol_nl2br($don->address).'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Company").'</td><td>'.$object->societe.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Lastname").'</td><td>'.$object->lastname.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Firstname").'</td><td>'.$object->firstname.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Address").'</td><td>'.dol_nl2br($object->address).'</td></tr>';
|
||||
|
||||
// Zip / Town
|
||||
print "<tr>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'.$don->zip.($don->zip && $don->town?' / ':'').$don->town.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td>'.$object->zip.($object->zip && $object->town?' / ':'').$object->town.'</td></tr>';
|
||||
|
||||
// Country
|
||||
print "<tr>".'<td>'.$langs->trans("Country").'</td><td>'.$don->country.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
if (! empty($object->country_code))
|
||||
{
|
||||
$img=picto_from_langcode($object->country_code);
|
||||
print ($img?$img.' ':'');
|
||||
}
|
||||
print $object->country;
|
||||
print '</td></tr>';
|
||||
|
||||
// EMail
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($don->email).'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("EMail").'</td><td>'.dol_print_email($object->email).'</td></tr>';
|
||||
|
||||
// Payment mode
|
||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||
$form->form_modes_reglement(null, $don->modepaiementid,'none');
|
||||
$form->form_modes_reglement(null, $object->modepaiementid,'none');
|
||||
print "</td></tr>\n";
|
||||
|
||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$don->getLibStatut(4).'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print "<tr>".'<td>'.$langs->trans("Project").'</td><td>'.$don->projet.'</td></tr>';
|
||||
print "<tr>".'<td>'.$langs->trans("Project").'</td><td>'.$object->projet.'</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => ' colspan="1"');
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$don,$action); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
print "</table>\n";
|
||||
print "</form>\n";
|
||||
@ -529,32 +541,32 @@ if (! empty($id) && $action != 'edit')
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&rowid='.$don->id.'">'.$langs->trans('Modify').'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=edit&rowid='.$object->id.'">'.$langs->trans('Modify').'</a></div>';
|
||||
|
||||
if ($don->statut == 0)
|
||||
if ($object->statut == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$don->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=valid_promesse">'.$langs->trans("ValidPromess").'</a></div>';
|
||||
}
|
||||
|
||||
if (($don->statut == 0 || $don->statut == 1) && $resteapayer == 0 && $don->paye == 0)
|
||||
if (($object->statut == 0 || $object->statut == 1) && $resteapayer == 0 && $object->paye == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$don->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=set_cancel">'.$langs->trans("ClassifyCanceled")."</a></div>";
|
||||
}
|
||||
|
||||
// TODO Gerer action emettre paiement
|
||||
if ($don->statut == 1 && $resteapayer > 0)
|
||||
if ($object->statut == 1 && $resteapayer > 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?rowid='.$don->id.'&action=create">'.$langs->trans("DoPayment")."</a></div>";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?rowid='.$object->id.'&action=create">'.$langs->trans("DoPayment")."</a></div>";
|
||||
}
|
||||
|
||||
if ($don->statut == 1 && $resteapayer == 0 && $don->paye == 0)
|
||||
if ($object->statut == 1 && $resteapayer == 0 && $object->paye == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$don->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=set_paid">'.$langs->trans("ClassifyPaid")."</a></div>";
|
||||
}
|
||||
|
||||
if ($user->rights->don->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$don->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete">'.$langs->trans("Delete")."</a></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -569,9 +581,9 @@ if (! empty($id) && $action != 'edit')
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
$filename=dol_sanitizeFileName($don->id);
|
||||
$filename=dol_sanitizeFileName($object->id);
|
||||
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$don->id;
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$object->id;
|
||||
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);
|
||||
// $delallowed=$user->rights->facture->supprimer;
|
||||
$genallowed=1;
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* 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,8 +21,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/dons/class/don.class.php
|
||||
* \ingroup don
|
||||
* \brief Fichier de la classe des dons
|
||||
* \ingroup Donation
|
||||
* \brief File of class to manage donations
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
@ -46,6 +47,8 @@ class Don extends CommonObject
|
||||
var $address;
|
||||
var $zip;
|
||||
var $town;
|
||||
var $country_id;
|
||||
var $country_code;
|
||||
var $country;
|
||||
var $email;
|
||||
var $public;
|
||||
@ -326,7 +329,8 @@ class Don extends CommonObject
|
||||
$sql.= ", address";
|
||||
$sql.= ", zip";
|
||||
$sql.= ", town";
|
||||
$sql.= ", country";
|
||||
// $sql.= ", country"; -- Deprecated
|
||||
$sql.= ", fk_pays";
|
||||
$sql.= ", public";
|
||||
$sql.= ", fk_don_projet";
|
||||
$sql.= ", note_private";
|
||||
@ -348,7 +352,7 @@ class Don extends CommonObject
|
||||
$sql.= ", '".$this->db->escape($this->address)."'";
|
||||
$sql.= ", '".$this->db->escape($this->zip)."'";
|
||||
$sql.= ", '".$this->db->escape($this->town)."'";
|
||||
$sql.= ", '".$this->db->escape($this->country)."'"; // TODO use country_id
|
||||
$sql.= ", ".$this->country_id;
|
||||
$sql.= ", ".$this->public;
|
||||
$sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
|
||||
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
@ -409,7 +413,7 @@ class Don extends CommonObject
|
||||
$sql .= ",address='".$this->db->escape($this->address)."'";
|
||||
$sql .= ",zip='".$this->db->escape($this->zip)."'";
|
||||
$sql .= ",town='".$this->db->escape($this->town)."'";
|
||||
$sql .= ",country='".$this->db->escape($this->country)."'"; // TODO use country_id
|
||||
$sql .= ",fk_pays = ".$this->country_id;
|
||||
$sql .= ",public=".$this->public;
|
||||
$sql .= ",fk_don_projet=".($this->fk_project>0?$this->fk_project:'null');
|
||||
$sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
|
||||
@ -493,12 +497,14 @@ class Don extends CommonObject
|
||||
|
||||
$sql = "SELECT d.rowid, d.datec, d.tms as datem, d.datedon,";
|
||||
$sql.= " d.firstname, d.lastname, d.societe, d.amount, d.fk_statut, d.address, d.zip, d.town, ";
|
||||
$sql.= " d.country, d.public, d.amount, d.fk_paiement, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
||||
$sql.= " d.phone_mobile, d.fk_don_projet,";
|
||||
$sql.= " p.title as project_label";
|
||||
$sql.= " d.fk_pays, d.public, d.amount, d.fk_paiement, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
|
||||
$sql.= " d.phone_mobile, d.fk_don_projet,";
|
||||
$sql.= " p.title as project_label,";
|
||||
$sql.= " c.code as country_code, c.label as country";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = d.fk_don_projet";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as cp ON cp.id = d.fk_paiement";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.fk_pays = c.rowid";
|
||||
$sql.= " WHERE d.rowid = ".$rowid." AND d.entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@ -522,7 +528,9 @@ class Don extends CommonObject
|
||||
$this->town = $obj->town;
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
$this->country = $obj->country;
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_code;
|
||||
$this->country = $obj->country;
|
||||
$this->email = $obj->email;
|
||||
$this->phone = $obj->phone;
|
||||
$this->phone_mobile = $obj->phone_mobile;
|
||||
@ -547,10 +555,10 @@ class Don extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Valide une promesse de don
|
||||
* Validate a promise of donation
|
||||
*
|
||||
* @param int $rowid id du don a modifier
|
||||
* @param int $userid utilisateur qui valide la promesse
|
||||
* @param int $rowid id of donation
|
||||
* @param int $userid User who validate the promise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function valid_promesse($rowid, $userid)
|
||||
@ -644,9 +652,9 @@ class Don extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Set donation sto status canceled
|
||||
* Set donation to status canceled
|
||||
*
|
||||
* @param int $rowid id du don a modifier
|
||||
* @param int $rowid id of donation
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_cancel($rowid)
|
||||
@ -673,7 +681,7 @@ class Don extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Somme des dons
|
||||
* Sum of donations
|
||||
*
|
||||
* @param string $param 1=promesses de dons validees , 2=xxx, 3=encaisses
|
||||
* @return int Summ of donations
|
||||
@ -724,5 +732,50 @@ class Don extends CommonObject
|
||||
if ($withpicto != 2) $result.=$lien.$this->id.$lienfin;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
* @param int $id Id of record
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT d.rowid, d.datec, d.fk_user_author, d.fk_user_valid,';
|
||||
$sql.= ' d.tms';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'don as d';
|
||||
$sql.= ' WHERE d.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this).'::info', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author)
|
||||
{
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
if ($obj->fk_user_valid)
|
||||
{
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_modification = $vuser;
|
||||
}
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->tms);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
125
htdocs/compta/dons/document.php
Normal file
125
htdocs/compta/dons/document.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* 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 3 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/compta/dons/document.php
|
||||
* \ingroup Donation
|
||||
* \brief Page of linked files into donations
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("donations");
|
||||
$langs->load("companies");
|
||||
$langs->load("interventions");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'don', $id, '');
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
$object = new Don($db);
|
||||
$object->fetch($id, $ref);
|
||||
|
||||
$upload_dir = $conf->dons->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart='don';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader("","",$langs->trans("Don"));
|
||||
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$head=donation_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("Don"), 0, 'bill');
|
||||
|
||||
|
||||
// Built files list
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/dons/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
$modulepart = 'don';
|
||||
$permission = $user->rights->don->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
62
htdocs/compta/dons/info.php
Normal file
62
htdocs/compta/dons/info.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* 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 3 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/compta/dons/info.php
|
||||
* \ingroup Donation
|
||||
* \brief Page to show a donation information
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/dons/class/don.class.php';
|
||||
|
||||
$langs->load("donations");
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'don', $id, '');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($id)
|
||||
{
|
||||
$object = new Don($db);
|
||||
$object->fetch($id);
|
||||
$object->info($id);
|
||||
|
||||
$head = donation_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Donation"), 0, 'bill');
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
61
htdocs/core/lib/donation.lib.php
Normal file
61
htdocs/core/lib/donation.lib.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* 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 3 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/lib/donation.lib.php
|
||||
* \ingroup Donation
|
||||
* \brief Library of donation functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Donation $object Donation
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function donation_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array ();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/dons/card.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h ++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/dons/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Documents");
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/dons/info.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
@ -370,3 +370,6 @@ INSERT INTO llx_c_incoterms (code, libelle, active) VALUES ('DDP', 'Delivered Du
|
||||
-- Extrafields fk_object must be unique (1-1 relation)
|
||||
ALTER TABLE llx_societe_extrafields DROP INDEX idx_societe_extrafields;
|
||||
ALTER TABLE llx_societe_extrafields ADD UNIQUE INDEX uk_societe_extrafields (fk_object);
|
||||
|
||||
-- Module Donation
|
||||
ALTER TABLE llx_don ADD COLUMN fk_pays integer NOT NULL after country;
|
||||
|
||||
@ -36,7 +36,8 @@ create table llx_don
|
||||
address text,
|
||||
zip varchar(30),
|
||||
town varchar(50),
|
||||
country varchar(50),
|
||||
country varchar(50), -- Deprecated - Replace with fk_pays
|
||||
fk_pays integer NOT NULL,
|
||||
email varchar(255),
|
||||
phone varchar(24),
|
||||
phone_mobile varchar(24),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user