From 15e50ed24f474e019a1eec8c7284d84ff393d677 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 21 Mar 2015 06:21:34 +0100 Subject: [PATCH] Update works --- htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- .../admin/{dons.php => donation.php} | 6 +- .../donations/admin/donation_extrafields.php | 114 ++++++++++++++ htdocs/donations/card.php | 26 +++- .../donations/class/donationstats.class.php | 141 ++++++++++++++++++ htdocs/donations/core/lib/donation.lib.php | 34 +++++ .../donations/core/modules/modDon.class.php | 2 +- htdocs/donations/list.php | 4 +- htdocs/donations/stats.php | 84 ----------- .../install/mysql/migration/3.7.0-3.8.0.sql | 10 ++ .../mysql/tables/llx_don_extrafields.key.sql | 20 +++ .../mysql/tables/llx_don_extrafields.sql | 26 ++++ 13 files changed, 377 insertions(+), 94 deletions(-) rename htdocs/donations/admin/{dons.php => donation.php} (98%) create mode 100644 htdocs/donations/admin/donation_extrafields.php create mode 100644 htdocs/donations/class/donationstats.class.php delete mode 100644 htdocs/donations/stats.php create mode 100644 htdocs/install/mysql/tables/llx_don_extrafields.key.sql create mode 100644 htdocs/install/mysql/tables/llx_don_extrafields.sql diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index ca31e816086..b407c4fcdb4 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -175,7 +175,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'accountancy', 'donations', 6__+MAX_llx_menu__, '/donations/index.php?leftmenu=donations&mainmenu=accountancy', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/donations/card.php?leftmenu=donations&mainmenu=accountancy&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2002__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/donations/list.php?leftmenu=donations&mainmenu=accountancy', 'List', 1, 'donations', '$user->rights->don->lire', '', 2, 1, __ENTITY__); ---insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/donations/stats.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'accountancy', '', 2000__+MAX_llx_menu__, '/donations/stats/index.php?leftmenu=donations&mainmenu=accountancy', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__); -- Special expenses insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'accountancy', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)', '', 0, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'accountancy', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index ca6bde79080..ed8eb59841f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -791,7 +791,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/donations/index.php?leftmenu=donations&mainmenu=accountancy",$langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations'); if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/donations/card.php?action=create",$langs->trans("NewDonation"), 1, $user->rights->don->creer); if (empty($leftmenu) || $leftmenu=="donations") $newmenu->add("/donations/list.php",$langs->trans("List"), 1, $user->rights->don->lire); - //if ($leftmenu=="donations") $newmenu->add("/donations/stats.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); + if ($leftmenu=="donations") $newmenu->add("/donations/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); } // Taxes and social contributions diff --git a/htdocs/donations/admin/dons.php b/htdocs/donations/admin/donation.php similarity index 98% rename from htdocs/donations/admin/dons.php rename to htdocs/donations/admin/donation.php index daf7b2f0e6d..ba0a72843fc 100644 --- a/htdocs/donations/admin/dons.php +++ b/htdocs/donations/admin/donation.php @@ -25,6 +25,7 @@ */ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/donations/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/donations/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -178,10 +179,13 @@ $dir = DOL_DOCUMENT_ROOT.'/donations/core/modules/dons/'; $form=new Form($db); llxHeader('',$langs->trans("DonationsSetup"),'DonConfiguration'); - $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup'); +$head = donation_admin_prepare_head(); + +dol_fiche_head($head, 'general', $langs->trans("Donations"), 0, 'donation'); + /* * Params */ diff --git a/htdocs/donations/admin/donation_extrafields.php b/htdocs/donations/admin/donation_extrafields.php new file mode 100644 index 00000000000..3caa65bce98 --- /dev/null +++ b/htdocs/donations/admin/donation_extrafields.php @@ -0,0 +1,114 @@ + + * + * 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 . + */ + +/** + * \file htdocs/donations/admin/donation_extrafields.php + * \ingroup donations + * \brief Page to setup extra fields of donations + */ + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/donations/core/lib/donation.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + +$langs->load("companies"); +$langs->load("admin"); +$langs->load('donations'); + +$extrafields = new ExtraFields($db); +$form = new Form($db); + +// List of supported format +$tmptype2label=ExtraFields::$type2label; +$type2label=array(''); +foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); + +$action=GETPOST('action', 'alpha'); +$attrname=GETPOST('attrname', 'alpha'); +$elementtype='don'; //Must be the $table_element of the class that manage extrafield + +if (!$user->admin) accessforbidden(); + + +/* + * Actions + */ + +require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; + + + +/* + * View + */ + +$textobject=$langs->transnoentitiesnoconv("Donations"); + +llxHeader('',$langs->trans("DonationsSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("DonationsSetup"),$linkback,'setup'); + + +$head = donation_admin_prepare_head(); + +dol_fiche_head($head, 'attributes', $langs->trans("Donations"), 0, 'donation'); + +require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; + +dol_fiche_end(); + + +// Buttons +if ($action != 'create' && $action != 'edit') +{ + print '
'; + print ''; + print "
"; +} + + +/* ************************************************************************** */ +/* */ +/* Create optional field */ +/* */ +/* ************************************************************************** */ + +if ($action == 'create') +{ + print "
"; + print_titre($langs->trans('NewAttribute')); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php'; +} + +/* ************************************************************************** */ +/* */ +/* Edit optional field */ +/* */ +/* ************************************************************************** */ +if ($action == 'edit' && ! empty($attrname)) +{ + print "
"; + print_titre($langs->trans("FieldEdition", $attrname)); + + require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php'; +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/donations/card.php b/htdocs/donations/card.php index 0d1cea0d4f1..d5aeaedb56d 100644 --- a/htdocs/donations/card.php +++ b/htdocs/donations/card.php @@ -32,6 +32,7 @@ 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.'/donations/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; @@ -48,6 +49,11 @@ $cancel=GETPOST('cancel'); $amount=GETPOST('amount'); $object = new Don($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + $donation_date=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); // Security check @@ -103,6 +109,10 @@ if ($action == 'update') $object->fk_project = GETPOST("fk_project"); $object->note_private= GETPOST("note_private"); $object->note_public = GETPOST("note_public"); + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; if ($object->update($user) > 0) { @@ -151,7 +161,11 @@ if ($action == 'add') $object->note_private= GETPOST("note_private"); $object->note_public = GETPOST("note_public"); $object->public = GETPOST("public"); - $object->fk_project = GETPOST("projectid"); + $object->fk_project = GETPOST("fk_project"); + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; if ($object->create($user) > 0) { @@ -341,9 +355,13 @@ if ($action == 'create') } // Other attributes - $parameters=array('colspan' => ' colspan="1"'); - $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook - + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } + print "\n"; print '
   
'; print "\n"; diff --git a/htdocs/donations/class/donationstats.class.php b/htdocs/donations/class/donationstats.class.php new file mode 100644 index 00000000000..74fd4d3d6f1 --- /dev/null +++ b/htdocs/donations/class/donationstats.class.php @@ -0,0 +1,141 @@ + + * Copyright (c) 2005-2013 Laurent Destailleur + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * + * 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 . + */ + +/** + * \file htdocs/donations/class/donationstats.class.php + * \ingroup donations + * \brief File of class to manage donations statistics + */ + +include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; +include_once DOL_DOCUMENT_ROOT . '/donations/class/don.class.php'; +include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; + + +/** + * Class to manage donations statistics + */ +class DonationStats extends Stats +{ + public $table_element; + + var $socid; + var $userid; + + var $from; + var $field; + var $where; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param int $socid Id third party for filter + * @param string $mode Option (not used) + * @param int $userid Id user for filter (creation user) + */ + function __construct($db, $socid, $mode, $userid=0) + { + global $user, $conf; + + $this->db = $db; + + $this->socid = ($socid > 0 ? $socid : 0); + $this->userid = $userid; + $this->cachefilesuffix = $mode; + + $object=new Don($this->db); + $this->from = MAIN_DB_PREFIX.$object->table_element." as c"; + //$this->from.= ", ".MAIN_DB_PREFIX."societe as s"; + //$this->field='weight'; // Warning, unit of weight is NOT USED AND MUST BE + $this->where.= " c.fk_statut > 0"; // Not draft and not cancelled + + //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; + $this->where.= " AND c.entity = ".$conf->entity; + if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($this->socid) + { + $this->where.=" AND c.fk_soc = ".$this->socid; + } + if ($this->userid > 0) $this->where.=' AND c.fk_user_author = '.$this->userid; + } + + /** + * Return shipment number by month for a year + * + * @param int $year Year to scan + * @return array Array with number by month + */ + function getNbByMonth($year) + { + global $user; + + $sql = "SELECT date_format(c.date_valid,'%m') as dm, COUNT(*) as nb"; + $sql.= " FROM ".$this->from; + if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql.= " AND ".$this->where; + $sql.= " GROUP BY dm"; + $sql.= $this->db->order('dm','DESC'); + + $res=$this->_getNbByMonth($year, $sql); + return $res; + } + + /** + * Return shipments number per year + * + * @return array Array with number by year + * + */ + function getNbByYear() + { + global $user; + + $sql = "SELECT date_format(c.date_valid,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")"; + $sql.= " FROM ".$this->from; + if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE ".$this->where; + $sql.= " GROUP BY dm"; + $sql.= $this->db->order('dm','DESC'); + + return $this->_getNbByYear($sql); + } + + /** + * Return nb, total and average + * + * @return array Array of values + */ + function getAllByYear() + { + global $user; + + $sql = "SELECT date_format(c.date_valid,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg"; + $sql.= " FROM ".$this->from; + if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " WHERE ".$this->where; + $sql.= " GROUP BY year"; + $sql.= $this->db->order('year','DESC'); + + return $this->_getAllByYear($sql); + } +} \ No newline at end of file diff --git a/htdocs/donations/core/lib/donation.lib.php b/htdocs/donations/core/lib/donation.lib.php index c274811bca1..93cbe889e4d 100644 --- a/htdocs/donations/core/lib/donation.lib.php +++ b/htdocs/donations/core/lib/donation.lib.php @@ -21,6 +21,40 @@ * \brief Library of donation functions */ +/** + * Prepare array with list of admin tabs + * + * @param Donation $object Donation + * @return array Array of tabs to show + */ +function donation_admin_prepare_head() +{ + global $langs, $conf; + + $h = 0; + $head = array (); + + $head[$h][0] = DOL_URL_ROOT . '/donations/admin/donation.php'; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'general'; + $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_admin'); + + $head[$h][0] = DOL_URL_ROOT . '/donations/admin/donation_extrafields.php'; + $head[$h][1] = $langs->trans("ExtraFields"); + $head[$h][2] = 'attributes'; + $h++; + + complete_head_from_modules($conf, $langs, $object, $head, $h, 'donation_admin', 'remove'); + + return $head; +} + /** * Prepare array with list of tabs * diff --git a/htdocs/donations/core/modules/modDon.class.php b/htdocs/donations/core/modules/modDon.class.php index d602d867e1c..a4a825d8343 100644 --- a/htdocs/donations/core/modules/modDon.class.php +++ b/htdocs/donations/core/modules/modDon.class.php @@ -64,7 +64,7 @@ class modDon extends DolibarrModules $this->requiredby = array(); // Config pages - $this->config_page_url = array("dons.php@donations"); + $this->config_page_url = array("donation.php@donations"); // Constants $this->const = array (); diff --git a/htdocs/donations/list.php b/htdocs/donations/list.php index 4f49c28fb59..f277dc0b671 100644 --- a/htdocs/donations/list.php +++ b/htdocs/donations/list.php @@ -73,7 +73,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,"; $sql.= " d.amount, d.fk_statut as statut, "; $sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; -$sql.= " ON p.rowid = d.fk_don_projet WHERE 1 = 1"; +$sql.= " ON p.rowid = d.fk_project WHERE 1 = 1"; if ($statut >= 0) { $sql .= " AND d.fk_statut = ".$statut; @@ -125,7 +125,7 @@ if ($resql) if (! empty($conf->projet->enabled)) { $langs->load("projects"); - 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("Project"),$_SERVER["PHP_SELF"],"fk_project","&page=$page&statut=$statut","","",$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); diff --git a/htdocs/donations/stats.php b/htdocs/donations/stats.php deleted file mode 100644 index 2dacd9e093f..00000000000 --- a/htdocs/donations/stats.php +++ /dev/null @@ -1,84 +0,0 @@ - - * Copyright (C) 2004-2009 Laurent Destailleur - * - * 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 . - */ - -/** - * \file htdocs/donations/stats.php - * \ingroup don - * \brief Page des statistiques de dons - */ - -require '../main.inc.php'; - -$langs->load("donations"); - -if (!$user->rights->don->lire) accessforbidden(); - - -/* - * View - */ - -llxHeader('',$langs->trans("Donations"),'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones'); - - -print_fiche_titre($langs->trans("Statistics")); - - -$sql = "SELECT d.amount"; -$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet as p"; -$sql .= " ON p.rowid = d.fk_don_projet"; - -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows($result); - - $var=true; - $i=0; - $total=0; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $total += $objp->amount; - $i++; - } - - print ''; - - print ''; - - $var=!$var; - print ""; - print ''; - $var=!$var; - print "".''; - $var=!$var; - print "".''; - print ""; - - print "
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("DonationsNumber").''.$num.'
'.$langs->trans("AmountTotal").''.price($total).'
'.$langs->trans("Average").''.price($total / ($num?$num:1)).'
"; -} -else -{ - dol_print_error($db); -} - - -llxFooter(); - -$db->close(); diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index caf7a474543..c1b999fa052 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -380,6 +380,16 @@ ALTER TABLE llx_don CHANGE COLUMN fk_paiement fk_payment integer; ALTER TABLE llx_don ADD COLUMN paid smallint default 0 NOT NULL after fk_payment; ALTER TABLE llx_don CHANGE COLUMN fk_don_projet fk_project integer NULL; +create table llx_don_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; + +ALTER TABLE llx_don_extrafields ADD INDEX idx_don_extrafields (fk_object); + create table llx_payment_donation ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_don_extrafields.key.sql b/htdocs/install/mysql/tables/llx_don_extrafields.key.sql new file mode 100644 index 00000000000..592df29f8f9 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_don_extrafields.key.sql @@ -0,0 +1,20 @@ +-- =================================================================== +-- Copyright (C) 2015 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 +-- 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 . +-- +-- =================================================================== + + +ALTER TABLE llx_don_extrafields ADD INDEX idx_don_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_don_extrafields.sql b/htdocs/install/mysql/tables/llx_don_extrafields.sql new file mode 100644 index 00000000000..b81f31f0c65 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_don_extrafields.sql @@ -0,0 +1,26 @@ +-- ======================================================================== +-- Copyright (C) 2015 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 +-- 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 . +-- +-- ======================================================================== + +create table llx_don_extrafields +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + tms timestamp, + fk_object integer NOT NULL, + import_key varchar(14) -- import key +) ENGINE=innodb; +