diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 3c0d8a38dae..aa72026f563 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -826,7 +826,7 @@ function isInEEC($object) */ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatelink = 0, $morehtmlright = '') { - global $user, $action, $hookmanager; + global $user, $action, $hookmanager, $form, $massactionbutton, $massaction, $arrayofselected, $arrayofmassactions; $i = -1; @@ -865,6 +865,10 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel print ''.$langs->trans("OpportunityStatusShort").''; print ''.$langs->trans("OpportunityProbabilityShort").''; print ''.$langs->trans("Status").''; + print ''; + $selectedfields = (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + print $selectedfields; + print ''; print ''; if ($num > 0) { @@ -916,6 +920,18 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel // Status print ''.$projecttmp->getLibStatut(5).''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($massactionbutton || $massaction) { + $selected = 0; + if (in_array($obj->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; + } print ''; } $i++; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index 4bb657bee2b..522fa407a36 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -33,11 +33,20 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; + +$form = new Form($db); // Load translation files required by the page $langs->loadLangs(array('companies', 'projects')); $action = GETPOST('action', 'aZ09'); +$massaction = GETPOST('massaction', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); + +$toselect = GETPOST('toselect', 'array'); + // Security check $socid = GETPOST('socid', 'int'); @@ -50,18 +59,50 @@ $result = restrictedArea($user, 'societe', $socid, '&societe'); $hookmanager->initHooks(array('projectthirdparty')); $object = new Societe($db); +$permissiontodelete = $user->hasRight('societe', 'supprimer'); + /* * Actions */ -$parameters = array('id'=>$socid); + +if (GETPOST('cancel', 'alpha')) { + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; + $massactionbutton = ''; +} + + $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } +$parameters = array('id'=>$socid); + +// List of mass actions available +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} +if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) { + $arrayofmassactions = array(); +} + +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) { + $arrayofmassactions = array(); +} + +// Mass actions +$objectclass = 'Project'; +$objectlabel = 'Project'; +$uploaddir = $conf->societe->dir_output; +include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); /* @@ -69,7 +110,6 @@ if ($reshook < 0) { */ unset($_SESSION['pageforbacktolist']['project']); - if ($socid) { require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -100,6 +140,7 @@ if ($socid) { print '
'; print ''; + // Type Prospect/Customer/Supplier print '
'.$langs->trans('NatureOfThirdParty').''; print $object->getTypeUrl(1); @@ -137,15 +178,23 @@ if ($socid) { print dol_get_fiche_end(); + print '
'; $params = ''; $backtopage = $_SERVER['PHP_SELF'].'?socid='.$object->id; $newcardbutton = dolGetButtonTitle($langs->trans("NewProject"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&backtopageforcancel='.urlencode($backtopage), '', 1, $params); - print '
'; + if (empty($conf->dol_optimize_smallscreen)) { + print '
'; + print ''; + print '
'.$massactionbutton.'
'; + } // Projects list + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + $arrayofselected = is_array($toselect) ? $toselect : array(); $result = show_projects($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1, $newcardbutton); + print '
'; } // End of page