dolibarr  7.0.0-beta
agenda.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
4  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
6  * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
7  * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
35 
36 $langs->load("companies");
37 $langs->load("members");
38 
39 $id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int');
40 
41 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
42 $sortfield = GETPOST("sortfield",'alpha');
43 $sortorder = GETPOST("sortorder",'alpha');
44 $page = GETPOST("page",'int');
45 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
46 $offset = $limit * $page;
47 $pageprev = $page - 1;
48 $pagenext = $page + 1;
49 if (! $sortfield) $sortfield='a.datep,a.id';
50 if (! $sortorder) $sortorder='DESC';
51 
52 if (GETPOST('actioncode','array'))
53 {
54  $actioncode=GETPOST('actioncode','array',3);
55  if (! count($actioncode)) $actioncode='0';
56 }
57 else
58 {
59  $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
60 }
61 $search_agenda_label=GETPOST('search_agenda_label');
62 
63 // Security check
64 $result=restrictedArea($user,'adherent',$id);
65 
66 $object = new Adherent($db);
67 $result=$object->fetch($id);
68 if ($result > 0)
69 {
70  $object->fetch_thirdparty();
71 
72  $adht = new AdherentType($db);
73  $result=$adht->fetch($object->typeid);
74 }
75 
76 
77 /*
78  * Actions
79  */
80 
81 $parameters=array('id'=>$id, 'objcanvas'=>$objcanvas);
82 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
83 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
84 
85 if (empty($reshook))
86 {
87  // Cancel
88  if (GETPOST('cancel','alpha') && ! empty($backtopage))
89  {
90  header("Location: ".$backtopage);
91  exit;
92  }
93 
94  // Purge search criteria
95  if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All test are required to be compatible with all browsers
96  {
97  $actioncode='';
98  $search_agenda_label='';
99  }
100 }
101 
102 
103 
104 /*
105  * View
106  */
107 
108 $contactstatic = new Contact($db);
109 
110 $form = new Form($db);
111 
112 /*
113  * Fiche categorie de client et/ou fournisseur
114  */
115 if ($object->id > 0)
116 {
117  require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
118  require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
119 
120  $langs->load("companies");
121 
122  $title=$langs->trans("Member") . " - " . $langs->trans("Agenda");
123  $helpurl="EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros";
124  llxHeader("",$title,$helpurl);
125 
126  if (! empty($conf->notification->enabled)) $langs->load("mails");
127  $head = member_prepare_head($object);
128 
129  dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user');
130 
131  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
132 
133  dol_banner_tab($object, 'rowid', $linkback);
134 
135  print '<div class="fichecenter">';
136 
137  print '<div class="underbanner clearboth"></div>';
138 
139  $object->info($id);
140  print dol_print_object_info($object, 1);
141 
142  print '</div>';
143 
144  dol_fiche_end();
145 
146 
147  //print '<div class="tabsAction">';
148  //print '</div>';
149 
150 
151  $morehtmlcenter = '';
152  if (! empty($conf->agenda->enabled))
153  {
154  $morehtmlcenter.='<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id.'">'.$langs->trans("AddAction").'</a>';
155  }
156 
157  if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
158  {
159  print '<br>';
160 
161  $param='&id='.$id;
162  if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
163  if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
164 
165  print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1);
166 
167  // List of all actions
168  $filters=array();
169  $filters['search_agenda_label']=$search_agenda_label;
170 
171  // TODO Replace this with same code than into list.php
172  show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
173  }
174 }
175 
176 
177 
178 llxFooter();
179 
180 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
Class to manage contact/addresses.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage generation of HTML components Only common components must be here.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0)
Print a title with navigation controls for pagination.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
dol_fiche_end($notab=0)
Show tab footer of a card.
Class to manage members of a foundation.
llxHeader()
Empty header.
Definition: wrapper.php:46
Class to manage members type.
print
Draft customers invoices.
Definition: index.php:91
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
Check permissions of a user to show a page and an object.
show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep, a.id', $sortorder='DESC')
Show html area with actions (done or not, ignore the name of function)