';
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref.=$langs->trans('Project') . ' ';
+ if ($user->rights->don->creer)
+ {
+ if ($action != 'classify')
+ $morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='
';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
+ } else {
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.='
';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ }
+ $morehtmlref.='
';
+
+
+ dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
+
+
+ print '';
print '
';
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index 35eb06bae54..820c2f9d1b4 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -30,8 +30,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
- * \class Don
- * \brief Class to manage donations
+ * Class to manage donations
*/
class Don extends CommonObject
{
@@ -39,7 +38,8 @@ class Don extends CommonObject
public $table_element='don'; // Name of table without prefix where object is stored
public $fk_element = 'fk_donation';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
-
+ var $picto = 'generic';
+
var $date;
var $amount;
var $societe;
@@ -48,7 +48,7 @@ class Don extends CommonObject
var $town;
var $email;
var $public;
- var $fk_projet;
+ var $fk_project;
var $fk_typepayment;
var $num_payment;
var $date_valid;
@@ -122,7 +122,6 @@ class Don extends CommonObject
}
if ($mode == 3)
{
- $prefix='Short';
if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5');
if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0');
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1');
@@ -135,14 +134,20 @@ class Don extends CommonObject
if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut];
if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut];
}
- if ($mode == 5)
+ if ($mode == 5)
{
- $prefix='Short';
if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5');
if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
}
+ if ($mode == 6)
+ {
+ if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5');
+ if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0');
+ if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1');
+ if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6');
+ }
}
@@ -601,7 +606,7 @@ class Don extends CommonObject
$sql = "SELECT d.rowid, d.datec, d.date_valid, 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.fk_country, d.country as country_olddata, d.public, d.amount, d.fk_payment, d.paid, d.note_private, d.note_public, cp.libelle, d.email, d.phone, ";
- $sql.= " d.phone_mobile, d.fk_projet, d.model_pdf,";
+ $sql.= " d.phone_mobile, d.fk_projet as fk_project, d.model_pdf,";
$sql.= " p.ref as project_ref,";
$sql.= " c.code as country_code, c.label as country";
$sql.= " FROM ".MAIN_DB_PREFIX."don as d";
@@ -648,7 +653,8 @@ class Don extends CommonObject
$this->phone = $obj->phone;
$this->phone_mobile = $obj->phone_mobile;
$this->project = $obj->project_ref;
- $this->fk_projet = $obj->fk_projet;
+ $this->fk_projet = $obj->fk_project; // deprecated
+ $this->fk_project = $obj->fk_project;
$this->public = $obj->public;
$this->modepaymentid = $obj->fk_payment;
$this->modepayment = $obj->libelle;
diff --git a/htdocs/don/document.php b/htdocs/don/document.php
index 4c5ae99e298..35df6bb338a 100644
--- a/htdocs/don/document.php
+++ b/htdocs/don/document.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2015 Laurent Destailleur
+ * Copyright (C) 2004-2016 Laurent Destailleur
* Copyright (C) 2005 Marc Barilley / Ocebo
* Copyright (C) 2005-2009 Regis Houssin
* Copyright (C) 2005 Simon TOSSER
@@ -34,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
+if (! empty($conf->projet->enabled))
+{
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+}
$langs->load("other");
$langs->load("donations");
@@ -64,7 +69,7 @@ if (! $sortfield) $sortfield="name";
$object = new Don($db);
$object->fetch($id, $ref);
-$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
+$upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,0,0,0,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
$modulepart='don';
@@ -80,6 +85,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
*/
$form = new Form($db);
+if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
llxHeader("",$langs->trans("Donation"));
@@ -102,23 +108,71 @@ if ($object->id)
}
+ $linkback = ''.$langs->trans("BackToList").'';
+
+ $morehtmlref='';
+ // Project
+ if (! empty($conf->projet->enabled))
+ {
+ $langs->load("projects");
+ $morehtmlref.=$langs->trans('Project') . ' ';
+ if ($user->rights->don->creer)
+ {
+ if ($action != 'classify')
+ $morehtmlref.='
' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='
';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
+ } else {
+ if (! empty($object->fk_project)) {
+ $proj = new Project($db);
+ $proj->fetch($object->fk_project);
+ $morehtmlref.='
';
+ $morehtmlref.=$proj->ref;
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.='';
+ }
+ }
+ }
+ $morehtmlref.='
';
+
+
+ dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
+
+ print '';
+ print '
';
+
print '
';
- $linkback = ''.$langs->trans("BackToList").'';
// Ref
+ /*
print '| '.$langs->trans("Ref").' | ';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print ' |
';
-
+ */
+
// Societe
//print "| ".$langs->trans("Company")." | ".$object->client->getNomUrl(1)." |
";
- print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' |
';
+ print '| '.$langs->trans("NbOfAttachedFiles").' | '.count($filearray).' |
';
print '| '.$langs->trans("TotalSizeOfAttachedFiles").' | '.$totalsize.' '.$langs->trans("bytes").' |
';
print '
';
print '
';
+
+ print '';
+
+ dol_fiche_end();
$modulepart = 'don';
$permission = $user->rights->don->lire;