diff --git a/htdocs/don/card.php b/htdocs/don/card.php
index fd68b028254..0ace5c88e76 100644
--- a/htdocs/don/card.php
+++ b/htdocs/don/card.php
@@ -49,7 +49,7 @@ $action=GETPOST('action','alpha');
$cancel=GETPOST('cancel');
$amount=GETPOST('amount');
$donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
-$projectid=GETPOST('projectid')?GETPOST('projectid','int'):GETPOST("fk_projet",'int');
+$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
$object = new Don($db);
$extrafields = new ExtraFields($db);
@@ -109,7 +109,7 @@ if ($action == 'update')
$object->email = GETPOST("email");
$object->date = $donation_date;
$object->public = GETPOST("public");
- $object->fk_projet = GETPOST("fk_projet");
+ $object->fk_project = GETPOST("fk_project");
$object->note_private= GETPOST("note_private");
$object->note_public = GETPOST("note_public");
@@ -164,7 +164,7 @@ if ($action == 'add')
$object->note_private= GETPOST("note_private");
$object->note_public = GETPOST("note_public");
$object->public = GETPOST("public");
- $object->fk_projet = GETPOST("fk_projet");
+ $object->fk_project = GETPOST("fk_project");
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@@ -230,6 +230,11 @@ if ($action == 'set_paid')
setEventMessages($object->error, $object->errors, 'errors');
}
}
+else if ($action == 'classin' && $user->rights->don->creer)
+{
+ $object->fetch($id);
+ $object->setProject($projectid);
+}
// Remove file in doc form
if ($action == 'remove_file')
{
@@ -361,7 +366,7 @@ if ($action == 'create')
if (! empty($conf->projet->enabled))
{
print "
| ".$langs->trans("Project")." | ";
- $formproject->select_projects(-1, $projectid,'fk_projet', 0, 0, 1, 1);
+ $formproject->select_projects(-1, $projectid,'fk_project', 0, 0, 1, 1);
print " |
\n";
}
@@ -486,7 +491,7 @@ if (! empty($id) && $action == 'edit')
$langs->load('projects');
print '| '.$langs->trans('Project').' | ';
- $formproject->select_projects(-1, $object->fk_projet,'fk_projet', 0, 0, 1, 1);
+ $formproject->select_projects(-1, $object->fk_project,'fk_project', 0, 0, 1, 1);
print ' |
';
}
diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php
index 820c2f9d1b4..d7e4d84baab 100644
--- a/htdocs/don/class/don.class.php
+++ b/htdocs/don/class/don.class.php
@@ -363,7 +363,7 @@ class Don extends CommonObject
$sql.= ", '".$this->db->escape($this->town)."'";
$sql.= ", ".$this->country_id;
$sql.= ", ".$this->public;
- $sql.= ", ".($this->fk_projet > 0?$this->fk_projet:"null");
+ $sql.= ", ".($this->fk_project > 0?$this->fk_project:"null");
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql.= ", ".$user->id;
@@ -459,7 +459,7 @@ class Don extends CommonObject
$sql .= ",town='".$this->db->escape($this->town)."'";
$sql .= ",fk_country = ".$this->country_id;
$sql .= ",public=".$this->public;
- $sql .= ",fk_projet=".($this->fk_projet>0?$this->fk_projet:'null');
+ $sql .= ",fk_projet=".($this->fk_project>0?$this->fk_project:'null');
$sql .= ",note_private=".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql .= ",note_public=".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql .= ",datedon='".$this->db->idate($this->date)."'";
diff --git a/htdocs/don/document.php b/htdocs/don/document.php
index ff25ca2828d..9a253bf57be 100644
--- a/htdocs/don/document.php
+++ b/htdocs/don/document.php
@@ -48,6 +48,7 @@ $id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha');
+$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
if ($user->societe_id) $socid=$user->societe_id;
@@ -79,6 +80,11 @@ $modulepart='don';
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
+if ($action == 'classin' && $user->rights->don->creer)
+{
+ $object->fetch($id);
+ $object->setProject($projectid);
+}
/*
* View
@@ -87,7 +93,9 @@ 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"));
+$title = $langs->trans('Donation') . " - " . $langs->trans('Documents');
+$helpurl = "";
+llxHeader('', $title, $helpurl);
if ($object->id)
diff --git a/htdocs/don/info.php b/htdocs/don/info.php
index 6e7bce98b4c..96310e010f5 100644
--- a/htdocs/don/info.php
+++ b/htdocs/don/info.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2015-2016 Alexandre Spangaro
*
* 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
@@ -25,37 +25,101 @@ 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.'/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("donations");
-// Security check
$id = GETPOST('id','int');
+$ref=GETPOST('ref','alpha');
+$action=GETPOST('action','alpha');
+$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
+
+// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'don', $id, '');
+$object = new Don($db);
+$object->fetch($id);
+/*
+ * Actions
+ */
+if ($action == 'classin' && $user->rights->don->creer)
+{
+ $object->fetch($id);
+ $object->setProject($projectid);
+}
/*
* View
*/
+$title = $langs->trans('Donation') . " - " . $langs->trans('Info');
+$helpurl = "";
+llxHeader('', $title, $helpurl);
-llxHeader("",$langs->trans("Donation"));
+$form = new Form($db);
+if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
-if ($id)
+$object->info($id);
+
+$head = donation_prepare_head($object);
+
+dol_fiche_head($head, 'info', $langs->trans("Donation"), 0, 'generic');
+
+$linkback = ''.$langs->trans("BackToList").'';
+
+$morehtmlref='';
+// Project
+if (! empty($conf->projet->enabled))
{
- $object = new Don($db);
- $object->fetch($id);
- $object->info($id);
-
- $head = donation_prepare_head($object);
-
- dol_fiche_head($head, 'info', $langs->trans("Donation"), 0, 'generic');
-
- print '
| ';
- dol_print_object_info($object);
- print ' |
';
-
- print '
';
+ $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 '
';
+
+print '
| ';
+dol_print_object_info($object);
+print ' |
';
+
+print '
';
+
+dol_fiche_end();
llxFooter();
$db->close();
diff --git a/htdocs/don/note.php b/htdocs/don/note.php
index 22d02fddb01..1ed3e1a2f1d 100644
--- a/htdocs/don/note.php
+++ b/htdocs/don/note.php
@@ -2,7 +2,8 @@
/* Copyright (C) 2004 Rodolphe Quiedeville
* Copyright (C) 2004-2008 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2013 Florian Henry
+ * Copyright (C) 2013 Florian Henry
+ * Copyright (C) 2016 Alexandre Spangaro
*
* 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
@@ -19,15 +20,20 @@
*/
/**
- * \file htdocs/compta/facture/note.php
- * \ingroup facture
- * \brief Fiche de notes sur une facture
+ * \file htdocs/don/note.php
+ * \ingroup donations
+ * \brief Page to show a donation notes
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.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("companies");
$langs->load("bills");
@@ -36,6 +42,7 @@ $langs->load("donations");
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
$ref=GETPOST('ref','alpha');
$action=GETPOST('action','alpha');
+$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0);
// Security check
$socid=0;
@@ -51,10 +58,13 @@ $permissionnote=$user->rights->don->creer; // Used by the include of actions_set
/*
* Actions
*/
+include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
-include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
-
-
+if ($action == 'classin' && $user->rights->don->creer)
+{
+ $object->fetch($id);
+ $object->setProject($projectid);
+}
/*
* View
@@ -65,35 +75,65 @@ $helpurl = "";
llxHeader('', $title, $helpurl);
$form = new Form($db);
+if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
if ($id > 0 || ! empty($ref))
{
$object = new Don($db);
$object->fetch($id,$ref);
- $head = donation_prepare_head($object);
+ $head = donation_prepare_head($object);
- dol_fiche_head($head, 'note', $langs->trans("Donation"), 0, 'generic');
-
- $linkback = ''.$langs->trans("BackToList").'';
-
- print '';
+ dol_fiche_head($head, 'note', $langs->trans("Donation"), 0, 'generic');
- // Ref
- print '| '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
- print ' |
';
+ $linkback = ''.$langs->trans("BackToList").'';
- print "
";
+ $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.='
';
- print '
';
+ dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
+ print '';
+ print '
';
+
+ $cssclass="titlefield";
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end();
}
-
llxFooter();
$db->close();