Clean code

This commit is contained in:
Laurent Destailleur 2023-04-29 13:04:45 +02:00
parent f0dd47f8a3
commit 4028b5d568
69 changed files with 154 additions and 139 deletions

View File

@ -3303,7 +3303,7 @@ class Adherent extends CommonObject
*/
public function getKanbanView($option = '', $arraydata = null)
{
global $selected;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';

View File

@ -996,6 +996,8 @@ class AdherentType extends CommonObject
{
global $langs, $user;
//$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
@ -1004,7 +1006,6 @@ class AdherentType extends CommonObject
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
//$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
//$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if ($user->rights->adherent->configurer) {

View File

@ -1068,7 +1068,7 @@ while ($i < $imaxinloop) {
$memberstatic->type = $membertypestatic->label;
$memberstatic->photo = $obj->photo;
// Output Kanban
print $memberstatic->getKanbanView('');
print $memberstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -647,7 +647,7 @@ while ($i < $imaxinloop) {
$subscription->fk_bank = $accountstatic->getNomUrl(1);
}
// Output Kanban
print $subscription->getKanbanView('');
print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -342,7 +342,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
}
//output kanban
$membertype->label = $objp->label;
print $membertype->getKanbanView('');
print $membertype->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -555,7 +555,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -688,7 +688,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -641,7 +641,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -641,7 +641,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -350,7 +350,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -4000,7 +4000,6 @@ class Propal extends CommonObject
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';

View File

@ -1722,7 +1722,7 @@ if ($resql) {
$userstatic->fetch($obj->fk_user_author);
$objectstatic->author = $userstatic->getNomUrl(1);
$objectstatic->fk_project = $projectstatic->getNomUrl(1);
print $objectstatic->getKanbanView('');
print $objectstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -2002,7 +2002,7 @@ if ($resql) {
print '<div class="box-flex-container kanban">';
}
print $generic_commande->getKanbanView('');
print $generic_commande->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';

View File

@ -600,7 +600,7 @@ foreach ($accounts as $key => $type) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $objecttmp->getKanbanView('');
print $objecttmp->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -639,7 +639,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $variousstatic->getKanbanView('');
print $variousstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop) - 1) {
print '</div>';
print '</td></tr>';

View File

@ -578,7 +578,6 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$object->year_close = $obj->year_close;
$object->cheque = $obj->cheque;
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == (min($num, $limit) - 1)) {
print '</div>';

View File

@ -1929,10 +1929,7 @@ if ($resql) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
$facturestatic->socid = $companystatic->getNomUrl(1, 'company', 15);
$userstatic->fetch($obj->fk_user_author);
$facturestatic->fk_user_author = $userstatic->getNomUrl(1);
print $facturestatic->getKanbanView('');
print $facturestatic->getKanbanView('', array('thirdparty'=>$companystatic->getNomUrl(1, 'company', 15), 'userauthor'=>$userstatic->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -104,7 +104,7 @@ if ($result) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $localtax_static->getKanbanView('');
print $localtax_static->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -262,7 +262,7 @@ if ($resql) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $checkdepositstatic->getKanbanView('');
print $checkdepositstatic->getKanbanView('', array('selected' => in_array($checkdepositstatic->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -286,7 +286,7 @@ if ($result) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $bon->getKanbanView('');
print $bon->getKanbanView('', array('selected' => in_array($bon->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -239,7 +239,7 @@ if ($result) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $directdebitorder->getKanbanView('');
print $directdebitorder->getKanbanView('', array('selected' => in_array($obj->id, $arrayofselected)));
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -640,8 +640,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
$chargesociale_static->fk_project = $projectstatic->getNomUrl();
print $chargesociale_static->getKanbanView('', array('selected' => in_array($chargesociale_static->id, $arrayofselected)));
print $chargesociale_static->getKanbanView('', array('projectlink'=> $projectstatic->getNomUrl(1), 'selected' => in_array($chargesociale_static->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -599,7 +599,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -1308,7 +1308,7 @@ while ($i < $imaxinloop) {
if ($obj->socid > 0) {
$contactstatic->fetch_thirdparty($obj->socid);
}
print $contactstatic->getKanbanView('');
print $contactstatic->getKanbanView('', array('selected' => in_array($contactstatic->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -2854,7 +2854,6 @@ class Contrat extends CommonObject
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';

View File

@ -995,6 +995,7 @@ while ($i < $imaxinloop) {
}
// Output Kanban
$arraydata['thirdparty'] = $socstatic;
$arraydata['selected'] = in_array($obj->rowid, $arrayofselected);
$contracttmp->date_contrat = $obj->date_contrat;
print $contracttmp->getKanbanView('', $arraydata);
if ($i == ($imaxinloop - 1)) {

View File

@ -856,6 +856,9 @@ class TimeSpent extends CommonObject
public function getKanbanView($option = '', $arraydata = null)
{
global $conf, $langs;
//$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
@ -863,6 +866,8 @@ class TimeSpent extends CommonObject
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
//$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if (property_exists($this, 'label')) {
$return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
}

View File

@ -314,7 +314,7 @@ if ($resql) {
$donationstatic->societe = $objp->societe;
}
print $donationstatic->getKanbanView('');
print $donationstatic->getKanbanView('', array('selected' => in_array($donationstatic->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -901,7 +901,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -948,7 +948,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -905,10 +905,9 @@ while ($i < min($num, $limit)) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container kanban">';
}
$object->socid = $companystatic->getNomUrl(1);
$object->date_delivery = $obj->delivery_date;
$object->town = $obj->town;
print $object->getKanbanView('');
print $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => in_array($obj->id, $arrayofselected)));
if ($i == min($num, $limit) - 1) {
print '</div>';
print '</td></tr>';

View File

@ -754,14 +754,14 @@ if ($resql) {
print '<tr><td colspan="12">';
print '<div class="box-flex-container kanban">';
}
// TODO Use a cache on user
$usertmp->fetch($obj->id_user);
$expensereportstatic->fk_user_author = $usertmp->getNomUrl(1);
// Output Kanban
if ($massactionbutton || $massaction) {
$selected = 0;
print $expensereportstatic->getKanbanView('');
print $expensereportstatic->getKanbanView('', array('userauthor' => $usertmp->getNomUrl(1), 'selected' => in_array($expensereportstatic->id, $arrayofselected)));
}
if ($i == ($imaxinloop - 1)) {
print '</div>';

View File

@ -504,7 +504,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $paymentexpensereportstatic->getKanbanView('');
print $paymentexpensereportstatic->getKanbanView('', array('selected' => in_array($objp->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -1496,7 +1496,6 @@ class Fichinter extends CommonObject
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';

View File

@ -3652,7 +3652,6 @@ class CommandeFournisseur extends CommonOrder
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';

View File

@ -1694,7 +1694,7 @@ if ($resql) {
$thirdpartytmp->fournisseur = $obj->fournisseur;
$objectstatic->socid = $thirdpartytmp->getNomUrl('supplier', 0, 0, -1);
// Output Kanban
print $objectstatic->getKanbanView('');
print $objectstatic->getKanbanView('', array('selected' => in_array($objectstatic->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -895,7 +895,7 @@ if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids))
$labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']);
}
$arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow);
$arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow, 'selected'=>$selected);
}
print $holidaystatic->getKanbanView('', $arraydata);
if ($i == ($imaxinloop - 1)) {

View File

@ -585,20 +585,20 @@ while ($i < $imaxinloop) {
// Output Kanban
$object->date_eval = $obj->date_eval;
// TODO Use a cache on job
$job = new job($db);
$job->fetch($obj->fk_job);
$object->fk_job = $job->getNomUrl();
// TODO Use a cache on user
$userstatic = new User($db);
$userstatic->fetch($obj->fk_user);
$object->fk_user = $userstatic->getNomUrl(1);
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($object->id, $arrayofselected)) {
$selected = 1;
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('user'=>$userstatic->getNomUrl(1), 'job'=>$job->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected)));
}
if ($i == ($imaxinloop - 1)) {
print '</div>';

View File

@ -609,7 +609,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -629,14 +629,13 @@ while ($i < $imaxinloop) {
$userstatic->email = $obj->email;
$userstatic->statut = $obj->statut;
$object->fk_user = $userstatic->getNomUrl(1);
// output kanban
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($object->id, $arrayofselected)) {
$selected = 1;
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('user' => $userstatic->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected)));
}
if ($i == ($imaxinloop - 1)) {
print '</div>';

View File

@ -628,7 +628,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($obj->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -1127,8 +1127,6 @@ class KnowledgeRecord extends CommonObject
*/
public function getKanbanView($option = '', $arraydata = null)
{
global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';

View File

@ -667,7 +667,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -728,9 +728,10 @@ class Loan extends CommonObject
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param array $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
public function getKanbanView($option = '', $arraydata = null)
{
global $langs;

View File

@ -294,7 +294,7 @@ if ($resql) {
$loan_static->capital = $obj->capital;
$loan_static->totalpaid = $obj->paid;
print $loan_static->getKanbanView('');
print $loan_static->getKanbanView('', array('selected' => in_array($loan_static->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -708,7 +708,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -613,13 +613,12 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
$object->id = $obj->type_id;
$bom->id = $obj->fk_bom;
// TODO Use a cache on BOM
$objectBom = $bom->fetch($obj->fk_bom);
//var_dump($bom);exit;
$object->fk_bom = $bom->getNomUrl();
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('bom'=>$objectBom->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -869,7 +869,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -654,7 +654,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -1457,8 +1457,9 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
$product_static->price = $obj->price;
// Output Kanban
print $product_static->getKanbanView('');
print $product_static->getKanbanView('', array('selected' => in_array($product_static->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -638,7 +638,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $warehouse->getKanbanView('');
print $warehouse->getKanbanView('', array('selected' => in_array($warehouse->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';

View File

@ -1405,7 +1405,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($warehousestatic->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -2386,18 +2386,19 @@ class Project extends CommonObject
* Return clicable link of object (with eventually picto)
*
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
* @param array $arraydata Array of data
* @return string HTML Code for Kanban thumb.
*/
public function getKanbanView($option = '')
public function getKanbanView($option = '', $arraydata = null)
{
global $langs, $user;
global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
$return .= img_picto('', $this->picto);
$return .= img_picto('', $this->public ? 'projectpub' : $this->picto);
//$return .= '<i class="fa fa-dol-action"></i>'; // Can be image
$return .= '</span>';
$return .= '<div class="info-box-content">';
@ -2407,6 +2408,8 @@ class Project extends CommonObject
}
$return .= '</span>';
$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
// Date
/*
if (property_exists($this, 'date_start') && $this->date_start) {
$return .= '<br><span class="info-box-label">'.dol_print_date($this->date_start, 'day').'</>';
}
@ -2416,7 +2419,10 @@ class Project extends CommonObject
} else {
$return .= '<br>';
}
$return .= '<span class="info-box-label">'.dol_print_date($this->date_end, 'day').'</>';
$return .= '<span class="info-box-label">'.dol_print_date($this->date_end, 'day').'</span>';
}*/
if (!empty($arraydata['assignedusers'])) {
$return .= '<br><span class="small">'.$arraydata['assignedusers'].'</span>';
}
/*if (property_exists($this, 'user_author_id')) {
$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Author").'</span>';
@ -2424,12 +2430,12 @@ class Project extends CommonObject
}*/
if ($this->usage_opportunity && $this->opp_status_code) {
//$return .= '<br><span class="info-bo-label opacitymedium">'.$langs->trans("OpportunityStatusShort").'</span>';
$return .= '<br><span class="info-box-label">'. $langs->trans("OppStatus".$this->opp_status_code);
$return .= ' <span class="opacitymedium">('.round($this->opp_percent).'%)</span>';
$return .= '<br><span class="amount">'.price($this->opp_amount).'</span>';
$return .= '<br><span class="info-box-label small">'.$langs->trans("OppStatus".$this->opp_status_code).'</span>';
$return .= ' <span class="opacitymedium small">('.round($this->opp_percent).'%)</span>';
$return .= '<br><span class="amount small">'.price($this->opp_amount).'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
$return .= '<br><div class="info-box-status small">'.$this->getLibStatut(3).'</div>';
}
$return .= '</div>';
$return .= '</div>';

View File

@ -2359,8 +2359,6 @@ class Task extends CommonObjectLine
*/
public function getKanbanView($option = '', $arraydata = null)
{
global $langs, $conf;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';

View File

@ -1421,19 +1421,54 @@ while ($i < $imaxinloop) {
//$userAccess = $object->restrictedProjectArea($user); // disabled, permission on project must be done by the select
//if ($userAccess >= 0) {
// Thirdparty
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->email = $obj->email;
$companystatic->phone = $obj->phone;
$companystatic->address = $obj->address;
$companystatic->zip = $obj->zip;
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
// Thirdparty
$companystatic->id = $obj->socid;
$companystatic->name = $obj->name;
$companystatic->name_alias = $obj->alias;
$companystatic->client = $obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->email = $obj->email;
$companystatic->phone = $obj->phone;
$companystatic->address = $obj->address;
$companystatic->zip = $obj->zip;
$companystatic->town = $obj->town;
$companystatic->country_code = $obj->country_code;
$stringassignedusers = '';
if (!empty($arrayfields['c.assigned']['checked'])) {
$ifisrt = 1;
foreach (array('internal', 'external') as $source) {
$tab = $object->liste_contact(-1, $source, 0, '', 1);
$numcontact = count($tab);
if (!empty($numcontact)) {
foreach ($tab as $contactproject) {
//var_dump($contacttask);
if ($source == 'internal') {
$c = new User($db);
} else {
$c = new Contact($db);
}
$c->fetch($contactproject['id']);
if (!empty($c->photo)) {
if (get_class($c) == 'User') {
$stringassignedusers .= $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
} else {
$stringassignedusers .= $c->getNomUrl(-2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
}
} else {
if (get_class($c) == 'User') {
$stringassignedusers .= $c->getNomUrl(2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
} else {
$stringassignedusers .= $c->getNomUrl(2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
}
}
$ifisrt = 0;
}
}
}
}
if ($mode == 'kanban') {
if ($i == 0) {
@ -1441,7 +1476,10 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
print $object->getKanbanView('');
$selected = in_array($object->id, $arrayofselected);
$arrayofdata = array('assignedusers' => $stringassignedusers, 'selected' => $selected);
print $object->getKanbanView('', $arrayofdata);
if ($i == ($imaxinloop - 1)) {
print '</div>';
@ -1592,39 +1630,10 @@ while ($i < $imaxinloop) {
$totalarray['nbfield']++;
}
}
// Contacts of project
// Assigned contacts of project
if (!empty($arrayfields['c.assigned']['checked'])) {
print '<td class="center nowraponall tdoverflowmax200">';
$ifisrt = 1;
foreach (array('internal', 'external') as $source) {
$tab = $object->liste_contact(-1, $source, 0, '', 1);
$numcontact = count($tab);
if (!empty($numcontact)) {
foreach ($tab as $contactproject) {
//var_dump($contacttask);
if ($source == 'internal') {
$c = new User($db);
} else {
$c = new Contact($db);
}
$c->fetch($contactproject['id']);
if (!empty($c->photo)) {
if (get_class($c) == 'User') {
print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
} else {
print $c->getNomUrl(-2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
}
} else {
if (get_class($c) == 'User') {
print $c->getNomUrl(2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst'));
} else {
print $c->getNomUrl(2, '', 0, '', -1, 0, ($ifisrt ? '' : 'notfirst'));
}
}
$ifisrt = 0;
}
}
}
print $stringassignedusers;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -1168,6 +1168,8 @@ while ($i < $imaxinloop) {
$arraydata = array();
$arraydata['projectlink'] = $projectstatic->getNomUrl(1);
$arraydata['selected'] = in_array($object->id, $arrayofselected);
print $object->getKanbanView('', $arraydata);
if ($i == ($imaxinloop - 1)) {
print '</div>';

View File

@ -1116,7 +1116,7 @@ class RecruitmentJobPosition extends CommonObject
*/
public function getKanbanView($option = '', $arraydata = null)
{
global $langs, $obj;
global $langs;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
@ -1138,7 +1138,9 @@ class RecruitmentJobPosition extends CommonObject
$return .= ' | <span class="opacitymedium">'.$langs->trans("Remuneration").'</span> : <span class="info-box-label">'.$this->remuneration_suggested.'</span>';
}
if (method_exists($this, 'getLibStatut')) {
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).' | <span class="opacitymedium" title="'.$langs->trans("RecruitmentCandidatures").'">'.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).'</span> : <span>'.$obj->nbapplications.'</span></div>';
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).' | <span class="opacitymedium" title="'.$langs->trans("RecruitmentCandidatures").'">'.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).'</span> : <span>';
$return .= $arraydata['nbapplications'];
$return .= '</span></div>';
}
$return .= '</div>';
$return .= '</div>';

View File

@ -747,15 +747,16 @@ while ($i < $imaxinloop) {
print '<tr><td colspan="'.$savnbfield.'">';
print '<div class="box-flex-container kanban">';
}
$recuitment = new RecruitmentJobPosition($db);
$recuitment->fetch($obj->fk_recruitmentjobposition);
$object->fk_recruitmentjobposition = $recuitment->getNomUrl();
// TODO Use a cache for $recruitment
$recruitment = new RecruitmentJobPosition($db);
$recruitment->fetch($obj->fk_recruitmentjobposition);
$object->phone = $obj->phone;
if ($massactionbutton || $massaction) {
$selected = 0;
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('jobpositionlink'=>$recruitment->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -597,7 +597,7 @@ while ($i < $imaxinloop) {
$selected = 0;
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('nbapplications'=>$obj->nbapplications, 'selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -663,7 +663,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $salstatic->getKanbanView('', array('user' => $userstatic));
print $salstatic->getKanbanView('', array('user' => $userstatic, 'selected' => $selected));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -574,7 +574,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $paymentsalstatic->getKanbanView('');
print $paymentsalstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -1564,7 +1564,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $companystatic->getKanbanView('');
print $companystatic->getKanbanView('', array('selected' => in_array($obj->rowid, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -989,11 +989,10 @@ if ($resql) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
// TODO Use a cahe on user
$userstatic->fetch($obj->fk_user_author);
$objectstatic->socid = $companystatic->getNomUrl(1);
$objectstatic->user_author_id = $userstatic->getNomUrl(1);
$objectstatic->delivery_date = $obj->dp;
print $objectstatic->getKanbanView('');
print $objectstatic->getKanbanView('', array('thirdparty'=>$companystatic, 'userauthor'=>$userstatic, 'selected' => in_array($obj->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -1016,13 +1016,16 @@ while ($i < $imaxinloop) {
}
// get infos needed from object
$data = array();
// TODO Create a cache on users
$arraydata = array();
if ($obj->fk_user_assign > 0) {
$user_temp->fetch($obj->fk_user_assign);
$data['user_assignment'] = $user_temp->getNomUrl(-3);
$arraydata['user_assignment'] = $user_temp->getNomUrl(-3);
}
$arraydata['selected'] = in_array($object->id, $arrayofselected);
// Output Kanban
print $object->getKanbanView('', $data);
print $object->getKanbanView('', $arraydata);
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -415,7 +415,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -1014,7 +1014,7 @@ while ($i < $imaxinloop) {
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -677,7 +677,7 @@ while ($i < $imaxinloop) {
$selected = 1;
}
}
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -638,7 +638,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -632,7 +632,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';