mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
NEW Mass action delete available on project and tasks
This commit is contained in:
parent
37939e7cbd
commit
759315aef5
|
|
@ -489,7 +489,8 @@ if (! $error && $massaction == 'delete' && $permtodelete)
|
|||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result = $objecttmp->delete($user);
|
||||
if ($objecttmp->element == 'societe') $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||
else $result = $objecttmp->delete($user);
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2010-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -150,8 +150,23 @@ function task_prepare_head($object)
|
|||
$head[$h][2] = 'task_contact';
|
||||
$h++;
|
||||
|
||||
// Is there timespent ?
|
||||
$nbTimeSpent=0;
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||
$sql .= " AND t.fk_task =".$object->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $nbTimeSpent=1;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':'');
|
||||
$head[$h][1] = $langs->trans("TimeSpent");
|
||||
if ($nbTimeSpent > 0) $head[$h][1].= ' <span class="badge">...</span>';
|
||||
$head[$h][2] = 'task_time';
|
||||
$h++;
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ ProjectsWithThisUserAsContact=Projects with this user as contact
|
|||
TasksWithThisUserAsContact=Tasks assigned to this user
|
||||
ResourceNotAssignedToProject=Not assigned to project
|
||||
ResourceNotAssignedToTheTask=Not assigned to the task
|
||||
TasksAssignedTo=Tasks assigned to
|
||||
AssignTaskToMe=Assign task to me
|
||||
AssignTask=Assign
|
||||
ProjectOverview=Overview
|
||||
|
|
|
|||
|
|
@ -593,7 +593,8 @@ class Project extends CommonObject
|
|||
|
||||
// Set fk_projet into elements to null
|
||||
$listoftables=array(
|
||||
'facture'=>'fk_projet','propal'=>'fk_projet','commande'=>'fk_projet','facture_fourn'=>'fk_projet','commande_fournisseur'=>'fk_projet',
|
||||
'facture'=>'fk_projet','propal'=>'fk_projet','commande'=>'fk_projet',
|
||||
'facture_fourn'=>'fk_projet','commande_fournisseur'=>'fk_projet','supplier_proposal'=>'fk_projet',
|
||||
'expensereport_det'=>'fk_projet','contrat'=>'fk_projet','fichinter'=>'fk_projet','don'=>'fk_projet'
|
||||
);
|
||||
foreach($listoftables as $key => $value)
|
||||
|
|
|
|||
|
|
@ -32,9 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
|
||||
$langs->load('projects');
|
||||
$langs->load('companies');
|
||||
$langs->load('commercial');
|
||||
$langs->loadLangs(array('projects', 'companies', 'commercial'));
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$title = $langs->trans("Projects");
|
||||
|
||||
|
|
@ -49,6 +53,7 @@ if ($socid > 0)
|
|||
}
|
||||
if (!$user->rights->projet->lire) accessforbidden();
|
||||
|
||||
$diroutputmassaction=$conf->projet->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield","alpha");
|
||||
|
|
@ -155,7 +160,7 @@ if (empty($reshook))
|
|||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_all='';
|
||||
$search_categ='';
|
||||
|
|
@ -177,8 +182,18 @@ if (empty($reshook))
|
|||
$day="";
|
||||
$month="";
|
||||
$year="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Project';
|
||||
$objectlabel='Project';
|
||||
$permtoread = $user->rights->projet->lire;
|
||||
$permtodelete = $user->rights->projet->supprimer;
|
||||
$uploaddir = $conf->projet->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -341,6 +356,8 @@ if (! $resql)
|
|||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -349,7 +366,8 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
|
|||
exit;
|
||||
}
|
||||
|
||||
llxHeader("",$title,"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
||||
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
|
|
@ -382,6 +400,16 @@ foreach ($search_array_options as $key => $val)
|
|||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
// 'presend'=>$langs->trans("SendByMail"),
|
||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
|
@ -392,7 +420,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
|
||||
|
||||
// Show description of content
|
||||
if ($search_project_user == $user->id) print $langs->trans("MyProjectsDesc").'<br><br>';
|
||||
|
|
@ -450,6 +478,7 @@ if (! empty($moreforfilter))
|
|||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
|
@ -577,7 +606,7 @@ if (! empty($arrayfields['p.fk_statut']['checked']))
|
|||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpitco=$form->showFilterButtons();
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -831,8 +860,8 @@ while ($i < min($num,$limit))
|
|||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
if (in_array($obj->projectid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->projectid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->projectid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ $taskref = GETPOST('taskref', 'alpha');
|
|||
$backtopage=GETPOST('backtopage','alpha');
|
||||
$cancel=GETPOST('cancel');
|
||||
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
$mine = ($mode == 'mine' ? 1 : 0);
|
||||
$search_user_id = GETPOST('search_user_id', 'int');
|
||||
|
||||
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
|
||||
|
||||
$object = new Project($db);
|
||||
|
|
@ -62,7 +62,7 @@ $extralabels_task=$extrafields_task->fetch_name_optionals_label($taskstatic->tab
|
|||
// Security check
|
||||
$socid=0;
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
$result = restrictedArea($user, 'projet', $id,'projet&project');
|
||||
$result = restrictedArea($user, 'projet', $id, 'projet&project');
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('projecttaskcard','globalcard'));
|
||||
|
|
@ -80,6 +80,14 @@ $userAccess=0;
|
|||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_user_id="";
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
if ($action == 'createtask' && $user->rights->projet->creer)
|
||||
{
|
||||
$error=0;
|
||||
|
|
@ -209,8 +217,8 @@ if ($id > 0 || ! empty($ref))
|
|||
$head=project_prepare_head($object);
|
||||
dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
|
||||
|
||||
$param=($mode=='mine'?'&mode=mine':'');
|
||||
|
||||
$param='';
|
||||
if ($search_user_id > 0) $param.='&search_user_id='.dol_escape_htmltag($search_user_id);
|
||||
|
||||
// Project card
|
||||
|
||||
|
|
@ -330,7 +338,6 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||
print '<input type="hidden" name="action" value="createtask">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
if (! empty($object->id)) print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
if (! empty($mode)) print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
dol_fiche_head('');
|
||||
|
||||
|
|
@ -450,7 +457,16 @@ else if ($id > 0 || ! empty($ref))
|
|||
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$title=$langs->trans("ListOfTasks");
|
||||
$linktotasks='<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?projectid='.$object->id.'&withproject=1">'.$langs->trans("GoToListOfTimeConsumed").'</a>';
|
||||
//print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $linktotasks, $num, $totalnboflines, 'title_generic.png', 0, '', '', 0, 1);
|
||||
|
|
@ -461,7 +477,10 @@ else if ($id > 0 || ! empty($ref))
|
|||
$filteronthirdpartyid = $socid;
|
||||
$tasksarray=$taskstatic->getTasksArray(0, 0, $object->id, $filteronthirdpartyid, 0);
|
||||
// We load also tasks limited to a particular user
|
||||
$tasksrole=($mode=='mine' ? $taskstatic->getUserRolesForProjectsOrTasks(0,$user,$object->id,0) : '');
|
||||
$tmpuser=new User($db);
|
||||
if ($search_user_id > 0) $tmpuser->fetch($search_user_id);
|
||||
|
||||
$tasksrole=($tmpuser->id > 0 ? $taskstatic->getUserRolesForProjectsOrTasks(0, $tmpuser, $object->id, 0) : '');
|
||||
//var_dump($tasksarray);
|
||||
//var_dump($tasksrole);
|
||||
|
||||
|
|
@ -471,6 +490,22 @@ else if ($id > 0 || ! empty($ref))
|
|||
}
|
||||
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
if (count($tasksarray) > 0)
|
||||
{
|
||||
// Link to switch in "my task" / "all task"
|
||||
print '<tr class="liste_titre_filter nodrag nodrop"><td colspan="8">';
|
||||
print $langs->trans("TasksAssignedTo");
|
||||
print $form->select_dolusers($tmpuser->id > 0 ? $tmpuser->id : '', 'search_user_id', 1);
|
||||
print '</td>';
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterButtons();
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
// print '<td>'.$langs->trans("Project").'</td>';
|
||||
print '<td width="100">'.$langs->trans("RefTask").'</td>';
|
||||
|
|
@ -483,37 +518,28 @@ else if ($id > 0 || ! empty($ref))
|
|||
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
||||
print '<td> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if (count($tasksarray) > 0)
|
||||
{
|
||||
// Link to switch in "my task" / "all task"
|
||||
print '<tr class="liste_titre nodrag nodrop"><td colspan="9">';
|
||||
if ($mode == 'mine')
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'.$langs->trans("DoNotShowMyTasksOnly").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&mode=mine">'.$langs->trans("ShowMyTasksOnly").'</a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Show all lines in taskarray (recursive function to go down on tree)
|
||||
$j=0; $level=0;
|
||||
$nboftaskshown=projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="9" class="opacitymedium">'.$langs->trans("NoTasks").'</td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="9" class="opacitymedium">'.$langs->trans("NoTasks").'</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Test if database is clean. If not we clean it.
|
||||
//print 'mode='.$_REQUEST["mode"].' $nboftaskshown='.$nboftaskshown.' count($tasksarray)='.count($tasksarray).' count($tasksrole)='.count($tasksrole).'<br>';
|
||||
if (! empty($user->rights->projet->all->lire)) // We make test to clean only if user has permission to see all (test may report false positive otherwise)
|
||||
{
|
||||
if ($mode=='mine')
|
||||
if ($search_user_id == $user->id)
|
||||
{
|
||||
if ($nboftaskshown < count($tasksrole))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,9 +30,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
$langs->load('projects');
|
||||
$langs->load('users');
|
||||
$langs->load('companies');
|
||||
$langs->loadLangs(array('projects', 'users', 'companies'));
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
|
||||
|
|
@ -79,6 +83,8 @@ $socid=0;
|
|||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
if (!$user->rights->projet->lire) accessforbidden();
|
||||
|
||||
$diroutputmassaction=$conf->projet->dir_output . '/tasks/temp/massgeneration/'.$user->id;
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
|
|
@ -162,8 +168,17 @@ if (empty($reshook))
|
|||
$day='';
|
||||
$month='';
|
||||
$year='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Task';
|
||||
$objectlabel='Tasks';
|
||||
$permtoread = $user->rights->projet->lire;
|
||||
$permtodelete = $user->rights->projet->supprimer;
|
||||
$uploaddir = $conf->projet->dir_output.'/tasks';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1;
|
||||
|
|
@ -337,6 +352,8 @@ if (! $resql)
|
|||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -345,7 +362,8 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
|
|||
exit;
|
||||
}
|
||||
|
||||
llxHeader("",$title,"Projet");
|
||||
$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||
llxHeader("", $title, $help_url);
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
|
|
@ -377,6 +395,16 @@ foreach ($search_array_options as $key => $val)
|
|||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
// 'presend'=>$langs->trans("SendByMail"),
|
||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
|
@ -385,8 +413,9 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
|
|||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit);
|
||||
|
||||
// Show description of content
|
||||
if ($search_task_user == $user->id) print $langs->trans("MyTasksDesc").'<br><br>';
|
||||
|
|
@ -442,6 +471,7 @@ if (! empty($moreforfilter))
|
|||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'" id="tablelines3">'."\n";
|
||||
|
|
@ -549,7 +579,7 @@ if (! empty($arrayfields['t.tms']['checked']))
|
|||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpitco=$form->showFilterButtons();
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
|
@ -804,8 +834,8 @@ while ($i < min($num,$limit))
|
|||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
if (in_array($obj->id, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->id.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -569,9 +569,16 @@ if ($id > 0 || ! empty($ref))
|
|||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->projet->supprimer && ! $object->hasChildren() && ! $object->hasTimeSpent())
|
||||
if ($user->rights->projet->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&withproject='.$withproject.'">'.$langs->trans('Delete').'</a>';
|
||||
if (! $object->hasChildren() && ! $object->hasTimeSpent())
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&withproject='.$withproject.'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("ProjecHasChild").'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,12 +35,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("commercial");
|
||||
$langs->load("customers");
|
||||
$langs->load("suppliers");
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
$langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta"));
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$massaction=GETPOST('massaction','alpha');
|
||||
$show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
|
|
@ -80,7 +81,8 @@ $search_stcomm=GETPOST('search_stcomm','int');
|
|||
$type=GETPOST('type');
|
||||
$optioncss=GETPOST('optioncss','alpha');
|
||||
$mode=GETPOST("mode");
|
||||
$action=GETPOST('action');
|
||||
|
||||
$diroutputmassaction=$conf->societe->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
|
||||
$sortfield=GETPOST("sortfield",'alpha');
|
||||
|
|
@ -230,9 +232,18 @@ if (empty($reshook))
|
|||
$search_stcomm='';
|
||||
$search_level_from='';
|
||||
$search_level_to='';
|
||||
$toselect='';
|
||||
$search_array_options=array();
|
||||
}
|
||||
|
||||
// Mass actions
|
||||
$objectclass='Societe';
|
||||
$objectlabel='ThirdParty';
|
||||
$permtoread = $user->rights->societe->lire;
|
||||
$permtodelete = $user->rights->societe->supprimer;
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($action == 'setstcomm')
|
||||
{
|
||||
$object = new Client($db);
|
||||
|
|
@ -457,6 +468,8 @@ if (! $resql)
|
|||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && $action != 'list')
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
|
@ -513,6 +526,16 @@ if (GETPOST('delsoc'))
|
|||
setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs');
|
||||
}
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
// 'presend'=>$langs->trans("SendByMail"),
|
||||
// 'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
||||
if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
|
||||
if ($massaction == 'presend') $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
|
@ -520,7 +543,7 @@ print '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
|
|||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit);
|
||||
|
||||
$langs->load("other");
|
||||
$textprofid=array();
|
||||
|
|
@ -586,6 +609,7 @@ if (! empty($moreforfilter))
|
|||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
if (empty($arrayfields['customerorsupplier']['checked'])) print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
|
|
@ -837,7 +861,7 @@ if (! empty($arrayfields['s.status']['checked']))
|
|||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpitco=$form->showFilterButtons();
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
|
|
@ -1100,9 +1124,18 @@ while ($i < min($num, $limit))
|
|||
{
|
||||
print '<td align="center" class="nowrap">'.$companystatic->getLibStatut(3).'</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>'."\n";
|
||||
$i++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user