mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
New: Add agenda tab into member cards.
Uniformize a lot of code.
This commit is contained in:
parent
cfaf1f0813
commit
4ce9e70775
166
htdocs/adherents/agenda.php
Normal file
166
htdocs/adherents/agenda.php
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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 2 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/adherents/agenda.php
|
||||
* \ingroup member
|
||||
* \brief Page of members events
|
||||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/member.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("members");
|
||||
|
||||
$mesg=isset($_GET["mesg"])?'<div class="ok">'.$_GET["mesg"].'</div>':'';
|
||||
|
||||
$id = GETPOST("id");
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->adherent->lire) accessforbidden();
|
||||
|
||||
$object = new Adherent($db);
|
||||
$result=$object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adht = new AdherentType($db);
|
||||
$result=$adht->fetch($object->typeid);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/*
|
||||
* Fiche categorie de client et/ou fournisseur
|
||||
*/
|
||||
if ($id)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
llxHeader("",$langs->trans("Agenda"),'');
|
||||
|
||||
if ($conf->notification->enabled) $langs->load("mails");
|
||||
$head = member_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'agenda', $langs->trans("Member"),0,'user');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'id');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
}
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
|
||||
print $form->showphoto('memberphoto',$member);
|
||||
print '</td>';*/
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Lastname
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$object->lastname.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$object->firstname.' </td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($conf->agenda->enabled)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$socid.'">'.$langs->trans("AddAction").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print load_fiche_titre($langs->trans("ActionsOnMember"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$object);
|
||||
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
|
@ -1428,6 +1428,7 @@ class Adherent extends CommonObject
|
|||
defined('ADHERENT_SPIP_DB') && ADHERENT_SPIP_DB != ''
|
||||
)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/security2.lib.php");
|
||||
$mdpass=dol_hash($this->pass);
|
||||
$htpass=crypt($this->pass,makesalt());
|
||||
$query = "INSERT INTO spip_auteurs (nom, email, login, pass, htpass, alea_futur, statut) VALUES(\"".$this->firstname." ".$this->lastname."\",\"".$this->email."\",\"".$this->login."\",\"$mdpass\",\"$htpass\",FLOOR(32000*RAND()),\"1comite\")";
|
||||
|
|
|
|||
|
|
@ -584,7 +584,8 @@ if ($user->rights->adherent->supprimer && $_POST["action"] == 'confirm_del_spip'
|
|||
{
|
||||
if (! count($object->errors))
|
||||
{
|
||||
if(!$object->del_to_spip()){
|
||||
if(!$object->del_to_spip())
|
||||
{
|
||||
$errmsg.="Echec de la suppression de l'utilisateur dans spip: ".$object->error."<BR>\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -1516,8 +1517,9 @@ if ($rowid && $action != 'edit')
|
|||
{
|
||||
print "<a class=\"butAction\" href=\"fiche.php?rowid=$object->id&action=add_spip\">".$langs->trans("AddIntoSpip")."</a>\n";
|
||||
}
|
||||
if ($isinspip == -1) {
|
||||
print '<br><font class="error">Failed to connect to SPIP: '.$object->error.'</font>';
|
||||
if ($isinspip == -1)
|
||||
{
|
||||
print '<br><br><font class="error">Failed to connect to SPIP: '.$object->error.'</font>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1529,7 +1531,7 @@ if ($rowid && $action != 'edit')
|
|||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,15 @@
|
|||
*/
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/security2.lib.php");
|
||||
|
||||
// Security check
|
||||
if (! $user->rights->adherent->export) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
|
@ -42,13 +51,12 @@ if (! isset($cotis))
|
|||
}
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT d.login, d.pass, d.datefin";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
|
||||
$sql .= " WHERE d.statut = $statut ";
|
||||
if ($cotis==1)
|
||||
{
|
||||
$sql .= " AND datefin > ".$db->idate(mktime());
|
||||
$sql .= " AND datefin > '".$db->idate(mktime())."'";
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
//$sql.=$db->plimit($conf->liste_limit, $offset);
|
||||
|
|
@ -77,7 +85,7 @@ else
|
|||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -27,37 +27,36 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php');
|
|||
require_once(DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
|
||||
|
||||
$action=isset($_GET["action"])?$_GET["action"]:(isset($_POST["action"])?$_POST["action"]:"");
|
||||
$id=isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:"");
|
||||
$action=GETPOST('action');
|
||||
$id=GETPOST("id");
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("members");
|
||||
$langs->load("bills");
|
||||
|
||||
if (!$user->rights->adherent->lire)
|
||||
accessforbidden();
|
||||
if (!$user->rights->adherent->lire) accessforbidden();
|
||||
|
||||
$adh = new Adherent($db);
|
||||
$result=$adh->fetch($id);
|
||||
$object = new Adherent($db);
|
||||
$result=$object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adht = new AdherentType($db);
|
||||
$result=$adht->fetch($adh->typeid);
|
||||
$result=$adht->fetch($object->typeid);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($_POST["action"] == 'update' && $user->rights->adherent->creer && ! $_POST["cancel"])
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$res=$adh->update_note($_POST["note"],$user);
|
||||
$res=$object->update_note($_POST["note"],$user);
|
||||
if ($res < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$adh->error.'</div>';
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
$db->rollback();
|
||||
}
|
||||
else
|
||||
|
|
@ -78,11 +77,11 @@ $form = new Form($db);
|
|||
|
||||
if ($id)
|
||||
{
|
||||
$head = member_prepare_head($adh);
|
||||
$head = member_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user');
|
||||
|
||||
if ($msg) print '<div class="error">'.$msg.'</div>';
|
||||
dol_htmloutput_errors($msg);
|
||||
|
||||
print "<form method=\"post\" action=\"note.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
|
@ -92,18 +91,18 @@ if ($id)
|
|||
// Reference
|
||||
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($adh,'id');
|
||||
print $form->showrefnav($object,'id');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$adh->login.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
||||
}
|
||||
|
||||
// Morphy
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$adh->getmorphylib().'</td>';
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
|
||||
print $form->showphoto('memberphoto',$member);
|
||||
print '</td>';*/
|
||||
|
|
@ -113,21 +112,21 @@ if ($id)
|
|||
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
|
||||
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adh->societe.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
|
||||
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$adh->getCivilityLabel().' </td>';
|
||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Lastname
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$adh->lastname.' </td>';
|
||||
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$object->lastname.' </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$adh->firstname.' </td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$object->firstname.' </td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$adh->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td>';
|
||||
|
|
@ -135,14 +134,14 @@ if ($id)
|
|||
if ($action == 'edit' && $user->rights->adherent->creer)
|
||||
{
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
|
||||
print "<input type=\"hidden\" name=\"id\" value=\"".$adh->id."\">";
|
||||
print "<input type=\"hidden\" name=\"id\" value=\"".$object->id."\">";
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note',$adh->note,'',280,'dolibarr_notes','',true,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
|
||||
$doleditor=new DolEditor('note',$object->note,'',280,'dolibarr_notes','',true,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,80);
|
||||
$doleditor->Create();
|
||||
}
|
||||
else
|
||||
{
|
||||
print nl2br($adh->note);
|
||||
print nl2br($object->note);
|
||||
}
|
||||
print "</td></tr>";
|
||||
|
||||
|
|
@ -167,7 +166,7 @@ if ($id)
|
|||
|
||||
if ($user->rights->adherent->creer && $action != 'edit')
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"note.php?id=$adh->id&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
print "<a class=\"butAction\" href=\"note.php?id=".$object->id."&action=edit\">".$langs->trans('Modify')."</a>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ $id = GETPOST('id');
|
|||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
//$result = restrictedArea($user, 'agenda', $id, 'actioncomm', 'actions', '', 'id');
|
||||
|
||||
if (isset($_GET["error"])) $error=$_GET["error"];
|
||||
$error=GETPOST("error");
|
||||
|
||||
$cactioncomm = new CActionComm($db);
|
||||
$actioncomm = new ActionComm($db);
|
||||
|
|
|
|||
|
|
@ -856,7 +856,9 @@ if ($id > 0)
|
|||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
// List of todo actions
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$object);
|
||||
|
||||
// List of done actions
|
||||
|
|
@ -868,8 +870,8 @@ else
|
|||
dol_print_error($db,'Bad value for socid parameter');
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -328,6 +328,8 @@ if ($socid > 0)
|
|||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$societe);
|
||||
|
||||
|
|
@ -336,7 +338,8 @@ if ($socid > 0)
|
|||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -884,13 +884,16 @@ else
|
|||
print "</div><br>";
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
||||
|
||||
print show_actions_todo($conf,$langs,$db,$objsoc,$object);
|
||||
|
||||
print show_actions_done($conf,$langs,$db,$objsoc,$object);
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1630,10 +1630,10 @@ abstract class CommonObject
|
|||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object linked of a current object
|
||||
*
|
||||
*
|
||||
* @param int $sourceid Object source id
|
||||
* @param string $sourcetype Object source type
|
||||
* @param int $targetid Object target id
|
||||
|
|
@ -1644,10 +1644,10 @@ abstract class CommonObject
|
|||
{
|
||||
$updatesource=false;
|
||||
$updatetarget=false;
|
||||
|
||||
|
||||
if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid) && empty($targettype)) $updatesource=true;
|
||||
else if (empty($sourceid) && empty($sourcetype) && ! empty($targetid) && ! empty($targettype)) $updatetarget=true;
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."element_element SET ";
|
||||
if ($updatesource)
|
||||
{
|
||||
|
|
@ -1663,7 +1663,7 @@ abstract class CommonObject
|
|||
$sql.= " WHERE fk_source = ".$this->id;
|
||||
$sql.= " AND sourcetype = '".$this->element."'";
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::updateObjectLinked sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
|
@ -1676,7 +1676,7 @@ abstract class CommonObject
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete all links between an object $this
|
||||
*
|
||||
|
|
@ -1687,7 +1687,7 @@ abstract class CommonObject
|
|||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
|
||||
$sql.= " WHERE fk_target = ".$this->id;
|
||||
$sql.= " AND targettype = '".$this->element."'";
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::deleteObjectLinked sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
|
@ -1700,7 +1700,7 @@ abstract class CommonObject
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set statut of an object
|
||||
*
|
||||
|
|
@ -1859,7 +1859,7 @@ abstract class CommonObject
|
|||
global $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
if (count($this->array_options) > 0)
|
||||
{
|
||||
// Check parameters
|
||||
|
|
@ -2015,7 +2015,7 @@ abstract class CommonObject
|
|||
|
||||
|
||||
/**
|
||||
* List urls of elemùent
|
||||
* List urls of element
|
||||
*
|
||||
* @param int $objectid Id of record
|
||||
* @param string $objecttype Type of object
|
||||
|
|
|
|||
|
|
@ -600,15 +600,18 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
|
|||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param Object $object Object third party
|
||||
* @param Object $object Object third party or member
|
||||
* @param Contact $objcon Object contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @return void
|
||||
*/
|
||||
function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
{
|
||||
global $bc,$user;
|
||||
|
||||
// Check parameters
|
||||
if (! is_object($object)) dol_print_error('','BadParameter');
|
||||
|
||||
$now=dol_now();
|
||||
$out='';
|
||||
|
||||
|
|
@ -620,17 +623,20 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
|||
$contactstatic = new Contact($db);
|
||||
|
||||
$out.="\n";
|
||||
if (is_object($objcon) && $objcon->id) $out.=load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
|
||||
else $out.=load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
$out.='<table width="100%" class="noborder">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td colspan="2"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&status=todo">'.$langs->trans("ActionsToDoShort").'</a></td>';
|
||||
$out.='<td colspan="2">';
|
||||
if (get_class($object) == 'Societe') $out.='<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&status=todo">';
|
||||
$out.=$langs->trans("ActionsToDoShort");
|
||||
if (get_class($object) == 'Societe') $out.='</a>';
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="5" align="right">';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if (($object->id || $objcon->id) && $permok)
|
||||
{
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$object->id.'&contactid='.$objcon->id.'&backtopage=1&percentage=-1">';
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create';
|
||||
if (get_class($object) == 'Societe') $out.='&socid='.$object->id;
|
||||
$out.='&contactid='.$objcon->id.'&backtopage=1&percentage=-1">';
|
||||
$out.=$langs->trans("AddAnAction").' ';
|
||||
$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
$out.="</a>";
|
||||
|
|
@ -645,13 +651,17 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
|||
$sql.= " a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " a.fk_element, a.elementtype,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " u.login, u.rowid,";
|
||||
$sql.= " sp.name, sp.firstname";
|
||||
$sql.= " u.login, u.rowid";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", m.nom as name, m.prenom as firstname";
|
||||
if (get_class($object) == 'Societe') $sql.= ", sp.name, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql.= " WHERE u.rowid = a.fk_user_author";
|
||||
$sql.= " AND u.entity = ".$conf->entity;
|
||||
if ($object->id) $sql.= " AND a.fk_soc = ".$object->id;
|
||||
$sql.= " AND a.entity IN (".getEntity('actioncomm').")";
|
||||
if (get_class($object) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
||||
if (get_class($object) == 'Adherent' && $object->id) $sql.= " AND a.fk_element = ".$object->id;
|
||||
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;
|
||||
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
|
||||
$sql.= " AND c.id=a.fk_action";
|
||||
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
|
||||
|
|
@ -749,15 +759,19 @@ function show_actions_todo($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
|||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param Object $object Object third party
|
||||
* @param Object $object Object third party or member
|
||||
* @param Contact $objcon Object contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @return void
|
||||
* TODO change function to be able to list event linked to an object.
|
||||
*/
|
||||
function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
||||
{
|
||||
global $bc,$user;
|
||||
|
||||
// Check parameters
|
||||
if (! is_object($object)) dol_print_error('','BadParameter');
|
||||
|
||||
$out='';
|
||||
$histo=array();
|
||||
$numaction = 0 ;
|
||||
|
|
@ -773,13 +787,17 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
|||
$sql.= " a.fk_element, a.elementtype,";
|
||||
$sql.= " a.fk_user_author, a.fk_contact,";
|
||||
$sql.= " c.code as acode, c.libelle,";
|
||||
$sql.= " u.login, u.rowid as user_id,";
|
||||
$sql.= " sp.name, sp.firstname";
|
||||
$sql.= " u.login, u.rowid as user_id";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", m.nom as name, m.prenom as firstname";
|
||||
if (get_class($object) == 'Societe') $sql.= ", sp.name, sp.firstname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
if (get_class($object) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
|
||||
if (get_class($object) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
$sql.= " WHERE u.rowid = a.fk_user_author";
|
||||
$sql.= " AND u.entity = ".$conf->entity;
|
||||
if ($object->id) $sql.= " AND a.fk_soc = ".$object->id;
|
||||
$sql.= " AND a.entity IN (".getEntity('actioncomm').")";
|
||||
if (get_class($object) == 'Adherent') $sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
|
||||
if (get_class($object) == 'Adherent' && $object->id) $sql.= " AND a.fk_element = ".$object->id;
|
||||
if (get_class($object) == 'Societe' && $object->id) $sql.= " AND a.fk_soc = ".$object->id;
|
||||
if (is_object($objcon) && $objcon->id) $sql.= " AND a.fk_contact = ".$objcon->id;
|
||||
$sql.= " AND c.id=a.fk_action";
|
||||
$sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
|
||||
|
|
@ -810,7 +828,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
|||
}
|
||||
}
|
||||
|
||||
if ($conf->mailing->enabled && $objcon->email)
|
||||
if ($conf->mailing->enabled && ! empty($objcon->email))
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
|
|
@ -851,7 +869,7 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
|||
}
|
||||
|
||||
|
||||
if ($conf->agenda->enabled || ($conf->mailing->enabled && $objcon->email))
|
||||
if ($conf->agenda->enabled || ($conf->mailing->enabled && ! empty($objcon->email)))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||
|
|
@ -869,12 +887,18 @@ function show_actions_done($conf,$langs,$db,$object,$objcon='',$noprint=0)
|
|||
$out.="\n";
|
||||
$out.='<table class="noborder" width="100%">';
|
||||
$out.='<tr class="liste_titre">';
|
||||
$out.='<td colspan="2"><a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&status=done">'.$langs->trans("ActionsDoneShort").'</a></td>';
|
||||
$out.='<td colspan="2">';
|
||||
if (get_class($object) == 'Societe') $out.='<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php?socid='.$object->id.'&status=done">';
|
||||
$out.=$langs->trans("ActionsDoneShort");
|
||||
if (get_class($object) == 'Societe') $out.='</a>';
|
||||
$out.='</td>';
|
||||
$out.='<td colspan="5" align="right">';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if (($object->id || $objcon->id) && $permok)
|
||||
{
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create&socid='.$object->id.'&contactid='.$objcon->id.'&backtopage=1&percentage=-1">';
|
||||
$out.='<a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?action=create';
|
||||
if (get_class($object) == 'Societe') $out.='&socid='.$object->id;
|
||||
$out.='&contactid='.$objcon->id.'&backtopage=1&percentage=-1">';
|
||||
$out.=$langs->trans("AddAnAction").' ';
|
||||
$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
$out.="</a>";
|
||||
|
|
|
|||
|
|
@ -57,6 +57,15 @@ function member_prepare_head($object)
|
|||
$h++;
|
||||
}
|
||||
|
||||
// Show agenda tab
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans('Agenda');
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
}
|
||||
|
||||
// Show category tab
|
||||
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -411,6 +411,8 @@ if ($object->fetch($id))
|
|||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$object);
|
||||
|
||||
|
|
|
|||
|
|
@ -191,6 +191,9 @@ ALTER TABLE llx_expedition ADD CONSTRAINT fk_expedition_fk_expedition_methode F
|
|||
-- VMYSQL4.1 UPDATE llx_chargesociales set tms = date_creation WHERE tms = '0000-00-00 00:00:00';
|
||||
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN propalrowid;
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN fk_facture;
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN fk_supplier_order;
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN fk_supplier_invoice;
|
||||
ALTER TABLE llx_actioncomm DROP COLUMN fk_commande;
|
||||
ALTER TABLE llx_product_stock DROP COLUMN location;
|
||||
-- DROP TABLE llx_c_methode_commande_fournisseur;
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ ActionDoneShort=Finished
|
|||
CompanyFoundation=Company/Foundation
|
||||
ContactsForCompany=Contacts/adresses for this third party
|
||||
ActionsOnCompany=Events about this third party
|
||||
ActionsOnMember=Events about this member
|
||||
NActions=%s events
|
||||
NActionsLate=%s late
|
||||
Filter=Filter
|
||||
|
|
|
|||
|
|
@ -330,6 +330,7 @@ ActionDoneShort=Terminé
|
|||
CompanyFoundation=Société ou institution
|
||||
ContactsForCompany=Contacts/adresses de ce tiers
|
||||
ActionsOnCompany=Événements vis à vis de ce tiers
|
||||
ActionsOnMember=Événements vis à vis de cet adhérent
|
||||
NActions=%s événements
|
||||
NActionsLate=%s en retard
|
||||
Filter=Filtre
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ $langs->load("companies");
|
|||
$mesg=isset($_GET["mesg"])?'<div class="ok">'.$_GET["mesg"].'</div>':'';
|
||||
|
||||
// Security check
|
||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||
$socid = GETPOST("socid");
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid);
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ $form = new Form($db);
|
|||
/*
|
||||
* Fiche categorie de client et/ou fournisseur
|
||||
*/
|
||||
if ($_GET["socid"])
|
||||
if ($socid)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
|
|
@ -68,8 +68,8 @@ if ($_GET["socid"])
|
|||
|
||||
|
||||
$soc = new Societe($db);
|
||||
$result = $soc->fetch($_GET["socid"]);
|
||||
llxHeader("",$langs->trans("Agenda"),$langs->trans("Category"));
|
||||
$result = $soc->fetch($socid);
|
||||
llxHeader("",$langs->trans("Agenda"),'');
|
||||
|
||||
if ($conf->notification->enabled) $langs->load("mails");
|
||||
$head = societe_prepare_head($soc);
|
||||
|
|
@ -144,7 +144,9 @@ if ($_GET["socid"])
|
|||
|
||||
print '</div>';
|
||||
|
||||
if ($mesg) print($mesg);
|
||||
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'action
|
||||
|
|
@ -161,31 +163,17 @@ if ($_GET["socid"])
|
|||
|
||||
print '<br>';
|
||||
|
||||
/*
|
||||
if ($conf->global->MAIN_REPEATCONTACTONEACHTAB)
|
||||
{
|
||||
// List of contacts
|
||||
show_contacts($conf,$langs,$db,$societe);
|
||||
}
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"),'','');
|
||||
|
||||
if ($conf->global->MAIN_REPEATTASKONEACHTAB)
|
||||
{
|
||||
*/
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$soc);
|
||||
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$soc);
|
||||
// }
|
||||
// List of todo actions
|
||||
show_actions_todo($conf,$langs,$db,$soc);
|
||||
|
||||
// List of done actions
|
||||
show_actions_done($conf,$langs,$db,$soc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user