clean indent

This commit is contained in:
Frédéric FRANCE 2019-10-27 10:38:52 +01:00
parent ac6da28135
commit 16f58f1eee
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
11 changed files with 186 additions and 185 deletions

View File

@ -79,7 +79,7 @@ if (GETPOST('action', 'alpha') == 'set')
$res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_CUSTOM_RECEIPT", GETPOST('TAKEPOS_CUSTOM_RECEIPT', 'int'), 'int', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($conf->global->TAKEPOS_ORDER_NOTES==1) if ($conf->global->TAKEPOS_ORDER_NOTES==1)
{ {
@ -247,15 +247,15 @@ $formmail = new FormMail($db);
$nboftemplates = $formmail->fetchAllEMailTemplate('facture_send', $user, null, -1); // We set lang=null to get in priority record with no lang $nboftemplates = $formmail->fetchAllEMailTemplate('facture_send', $user, null, -1); // We set lang=null to get in priority record with no lang
//$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, ''); //$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
$arrayofmessagename=array(); $arrayofmessagename=array();
if (is_array($formmail->lines_model)) if (is_array($formmail->lines_model)) {
{ foreach($formmail->lines_model as $modelmail) {
foreach($formmail->lines_model as $modelmail) //var_dump($modelmail);
{ $moreonlabel='';
//var_dump($modelmail); if (! empty($arrayofmessagename[$modelmail->label])) {
$moreonlabel=''; $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>';
if (! empty($arrayofmessagename[$modelmail->label])) $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>'; }
$arrayofmessagename[$modelmail->label]=$langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)).$moreonlabel; $arrayofmessagename[$modelmail->label]=$langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)).$moreonlabel;
} }
} }
//var_dump($arraydefaultmessage); //var_dump($arraydefaultmessage);
//var_dump($arrayofmessagename); //var_dump($arrayofmessagename);

View File

@ -166,12 +166,12 @@ if (! empty($conf->stock->enabled))
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value) print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
print '<td>'; print '<td>';
if (empty($conf->productbatch->enabled)) { if (empty($conf->productbatch->enabled)) {
print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1); print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1);
} }
else else
{ {
if (!$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { if (!$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) {
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity);
} }
print $langs->trans("Yes").'<br>'; print $langs->trans("Yes").'<br>';
print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>'; print '<span class="opacitymedium">'.$langs->trans('StockDecreaseForPointOfSaleDisabledbyBatch').'</span>';

View File

@ -157,8 +157,7 @@ $( document ).ready(function() {
$('#'+val.label).draggable().bind('click', function(){ $('#'+val.label).draggable().bind('click', function(){
$(this).focus(); $(this).focus();
}) })
<?php } <?php } else {?>
else {?>
$('body').append('<div class="tablediv" onclick="LoadPlace('+val.rowid+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="tablename'+val.rowid+'">'+val.label+'</div>'); $('body').append('<div class="tablediv" onclick="LoadPlace('+val.rowid+');" style="position: absolute; left: '+val.leftpos+'%; top: '+val.toppos+'%;" id="tablename'+val.rowid+'">'+val.label+'</div>');
<?php } ?> <?php } ?>
}); });
@ -168,13 +167,13 @@ $( document ).ready(function() {
</script> </script>
</head> </head>
<body style="overflow: hidden"> <body style="overflow: hidden">
<?php if ($user->admin){?> <?php if ($user->admin) {?>
<div style="position: absolute; left: 0.1%; top: 0.8%; width:8%; height:11%;"> <div style="position: absolute; left: 0.1%; top: 0.8%; width:8%; height:11%;">
<?php if ($mode=="edit"){?> <?php if ($mode=="edit"){?>
<a id="add" onclick="window.location.href='floors.php?mode=edit&action=add&floor=<?php echo $floor;?>';"><?php echo $langs->trans("AddTable"); ?></a> <a id="add" onclick="window.location.href='floors.php?mode=edit&action=add&floor=<?php echo $floor;?>';"><?php echo $langs->trans("AddTable"); ?></a>
<?php } else { ?> <?php } else { ?>
<a onclick="window.location.href='floors.php?mode=edit&floor=<?php echo $floor;?>';"><?php echo $langs->trans("Edit"); ?></a> <a onclick="window.location.href='floors.php?mode=edit&floor=<?php echo $floor;?>';"><?php echo $langs->trans("Edit"); ?></a>
<?php } ?> <?php } ?>
</div> </div>
<?php } <?php }
?> ?>

View File

@ -223,7 +223,7 @@ $numpad=$conf->global->TAKEPOS_NUMPAD;
if ($paycode == 'LIQ') $paycode = 'cash'; if ($paycode == 'LIQ') $paycode = 'cash';
if ($paycode == 'CB') $paycode = 'card'; if ($paycode == 'CB') $paycode = 'card';
if ($paycode == 'CHQ') $paycode = 'cheque'; if ($paycode == 'CHQ') $paycode = 'cheque';
?> ?>
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[0]->code); ?></button> <button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[0]->code); ?></button>
<?php } else { ?> <?php } else { ?>
<button type="button" class="calcbutton2"><?php echo $langs->trans("NoPaimementModesDefined");?></button> <button type="button" class="calcbutton2"><?php echo $langs->trans("NoPaimementModesDefined");?></button>
@ -236,11 +236,11 @@ $numpad=$conf->global->TAKEPOS_NUMPAD;
if ($paycode == 'LIQ') $paycode = 'cash'; if ($paycode == 'LIQ') $paycode = 'cash';
if ($paycode == 'CB') $paycode = 'card'; if ($paycode == 'CB') $paycode = 'card';
if ($paycode == 'CHQ') $paycode = 'cheque'; if ($paycode == 'CHQ') $paycode = 'cheque';
?> ?>
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[1]->code); ?></button> <button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[1]->code); ?></button>
<?php } else { <?php } else {
$button = array_pop($action_buttons); $button = array_pop($action_buttons);
?> ?>
<button type="button" class="calcbutton2" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button> <button type="button" class="calcbutton2" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button>
<?php } ?> <?php } ?>
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "1"; else print "0.10";?>);"><?php if ($numpad==0) print "1"; else print "0.10";?></button> <button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "1"; else print "0.10";?>);"><?php if ($numpad==0) print "1"; else print "0.10";?></button>
@ -251,12 +251,11 @@ $button = array_pop($action_buttons);
if ($paycode == 'LIQ') $paycode = 'cash'; if ($paycode == 'LIQ') $paycode = 'cash';
if ($paycode == 'CB') $paycode = 'card'; if ($paycode == 'CB') $paycode = 'card';
if ($paycode == 'CHQ') $paycode = 'cheque'; if ($paycode == 'CHQ') $paycode = 'cheque';
?> ?>
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[2]->code); ?></button> <button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paycode); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[2]->code); ?></button>
<?php } else { ?> <?php } else {
<?php $button = array_pop($action_buttons);
$button = array_pop($action_buttons); ?>
?>
<button type="button" class="calcbutton2" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button> <button type="button" class="calcbutton2" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button>
<?php } ?> <?php } ?>
<button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "0"; else print "0.01";?>);"><?php if ($numpad==0) print "0"; else print "0.01";?></button> <button type="button" class="calcbutton" onclick="addreceived(<?php if ($numpad==0) print "0"; else print "0.01";?>);"><?php if ($numpad==0) print "0"; else print "0.01";?></button>
@ -265,17 +264,17 @@ $button = array_pop($action_buttons);
<?php <?php
$i=3; $i=3;
while($i < count($paiements)){ while($i < count($paiements)){
?> ?>
<button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paiements[$i]->code); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[$i]->code); ?></button> <button type="button" class="calcbutton2" onclick="Validate('<?php echo $langs->trans($paiements[$i]->code); ?>');"><?php echo $langs->trans("PaymentTypeShort".$paiements[$i]->code); ?></button>
<?php <?php
$i=$i+1; $i=$i+1;
} }
$class=($i==3)?"calcbutton3":"calcbutton2"; $class=($i==3)?"calcbutton3":"calcbutton2";
foreach($action_buttons as $button){ foreach($action_buttons as $button){
$newclass = $class.($button["class"]?" ".$button["class"]:""); $newclass = $class.($button["class"]?" ".$button["class"]:"");
?> ?>
<button type="button" class="<?php echo $newclass;?>" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button> <button type="button" class="<?php echo $newclass;?>" onclick="<?php echo $button["function"];?>"><span <?php echo $button["span"];?>><?php echo $button["text"];?></span></button>
<?php <?php
} }
?> ?>
</div> </div>

View File

@ -130,16 +130,17 @@ if ($conf->global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOME
<?php <?php
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
?> ?>
<tr> <tr>
<td><?php if (!empty($line->product_label)) echo $line->product_label; <td>
else echo $line->description;?> <?php if (!empty($line->product_label)) echo $line->product_label;
else echo $line->description;?>
</td> </td>
<td class="right"><?php echo $line->qty;?></td> <td class="right"><?php echo $line->qty;?></td>
<td class="right"><?php echo $line->total_ttc/$line->qty;?></td> <td class="right"><?php echo $line->total_ttc/$line->qty;?></td>
<td class="right"><?php echo price($line->total_ttc);?></td> <td class="right"><?php echo price($line->total_ttc);?></td>
</tr> </tr>
<?php <?php
} }
?> ?>
</tbody> </tbody>
@ -150,30 +151,28 @@ if ($conf->global->TAKEPOS_CUSTOM_RECEIPT && $conf->global->TAKEPOS_SHOW_CUSTOME
<th class="right"><?php echo $langs->trans("TotalHT");?></th> <th class="right"><?php echo $langs->trans("TotalHT");?></th>
<td class="right"><?php echo price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td> <td class="right"><?php echo price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr> </tr>
<?php if($conf->global->TAKEPOS_TICKET_VAT_GROUPPED):?> <?php if($conf->global->TAKEPOS_TICKET_VAT_GROUPPED) {
<?php
$vat_groups = array(); $vat_groups = array();
foreach ($object->lines as $line) foreach ($object->lines as $line)
{ {
if(!array_key_exists($line->tva_tx, $vat_groups)){ if(!array_key_exists($line->tva_tx, $vat_groups)) {
$vat_groups[$line->tva_tx] = 0; $vat_groups[$line->tva_tx] = 0;
} }
$vat_groups[$line->tva_tx] += $line->total_tva; $vat_groups[$line->tva_tx] += $line->total_tva;
} }
foreach($vat_groups as $key => $val){ foreach($vat_groups as $key => $val) {
?> ?>
<tr> <tr>
<th align="right"><?php echo $langs->trans("VAT").' '.vatrate($key, 1);?></th> <th align="right"><?php echo $langs->trans("VAT").' '.vatrate($key, 1);?></th>
<td align="right"><?php echo price($val, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td> <td align="right"><?php echo price($val, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr> </tr>
<?php <?php
} }
?> } else { ?>
<?php else: ?>
<tr> <tr>
<th class="right"><?php echo $langs->trans("TotalVAT").'</th><td class="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td> <th class="right"><?php echo $langs->trans("TotalVAT").'</th><td class="right">'.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr> </tr>
<?php endif ?> <?php } ?>
<tr> <tr>
<th class="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td> <th class="right"><?php echo ''.$langs->trans("TotalTTC").'</th><td class="right">'.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?></td>
</tr> </tr>

View File

@ -747,7 +747,7 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
print '<input type="text" id="search" name="search" onkeyup="Search2();" style="width:80%;font-size: 150%;" placeholder="'.$langs->trans("Search").'" autofocus> '; print '<input type="text" id="search" name="search" onkeyup="Search2();" style="width:80%;font-size: 150%;" placeholder="'.$langs->trans("Search").'" autofocus> ';
print '<a class="marginleftonly hideonsmartphone" onclick="ClearSearch();">'.img_picto('', 'searchclear').'</a>'; print '<a class="marginleftonly hideonsmartphone" onclick="ClearSearch();">'.img_picto('', 'searchclear').'</a>';
print '</div>'; print '</div>';
?> ?>
</div> </div>
</div> </div>
@ -759,7 +759,7 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
$count=0; $count=0;
while ($count < $MAXCATEG) while ($count < $MAXCATEG)
{ {
?> ?>
<div class="wrapper" <?php if ($count==($MAXCATEG-2)) echo 'onclick="MoreCategories(\'less\');"'; elseif ($count==($MAXCATEG-1)) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id="catdiv<?php echo $count;?>"> <div class="wrapper" <?php if ($count==($MAXCATEG-2)) echo 'onclick="MoreCategories(\'less\');"'; elseif ($count==($MAXCATEG-1)) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id="catdiv<?php echo $count;?>">
<?php <?php
if ($count==($MAXCATEG-2)) { if ($count==($MAXCATEG-2)) {
@ -782,8 +782,8 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
<?php } ?> <?php } ?>
<div class="catwatermark" id='catwatermark<?php echo $count;?>'>+</div> <div class="catwatermark" id='catwatermark<?php echo $count;?>'>+</div>
</div> </div>
<?php <?php
$count++; $count++;
} }
?> ?>
</div> </div>
@ -794,7 +794,7 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
$count=0; $count=0;
while ($count < $MAXPRODUCT) while ($count < $MAXPRODUCT)
{ {
?> ?>
<div class="wrapper2" id='prodiv<?php echo $count;?>' <?php if ($count==($MAXPRODUCT-2)) {?> onclick="MoreProducts('less');" <?php } if ($count==($MAXPRODUCT-1)) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"';?>> <div class="wrapper2" id='prodiv<?php echo $count;?>' <?php if ($count==($MAXPRODUCT-2)) {?> onclick="MoreProducts('less');" <?php } if ($count==($MAXPRODUCT-1)) {?> onclick="MoreProducts('more');" <?php } else echo 'onclick="ClickProduct('.$count.');"';?>>
<?php <?php
if ($count==($MAXPRODUCT-2)) { if ($count==($MAXPRODUCT-2)) {
@ -817,7 +817,7 @@ $menus[$r++]=array('title'=>'<span class="fa fa-sign-out-alt paddingrightonly"><
<?php } ?> <?php } ?>
<div class="catwatermark" id='prowatermark<?php echo $count;?>'>+</div> <div class="catwatermark" id='prowatermark<?php echo $count;?>'>+</div>
</div> </div>
<?php <?php
$count++; $count++;
} }
?> ?>

View File

@ -72,7 +72,7 @@ class Users extends DolibarrApi
$obj_ret = array(); $obj_ret = array();
if(! DolibarrApiAccess::$user->rights->user->user->lire) { if(! DolibarrApiAccess::$user->rights->user->user->lire) {
throw new RestException(401, "You are not allowed to read list of users"); throw new RestException(401, "You are not allowed to read list of users");
} }
// case of external user, $societe param is ignored and replaced by user's socid // case of external user, $societe param is ignored and replaced by user's socid
@ -226,10 +226,10 @@ class Users extends DolibarrApi
if ($field == 'statut') { if ($field == 'statut') {
$result = $this->useraccount->setstatus($value); $result = $this->useraccount->setstatus($value);
if ($result < 0) { if ($result < 0) {
throw new RestException(500, 'Error when updating status of user: '.$this->useraccount->error); throw new RestException(500, 'Error when updating status of user: '.$this->useraccount->error);
} }
} else { } else {
$this->useraccount->$field = $value; $this->useraccount->$field = $value;
} }
} }

View File

@ -110,7 +110,7 @@ if ($id > 0)
// Edit mode // Edit mode
if ($action == 'edit') if ($action == 'edit')
{ {
print '<table class="border centpercent">'; print '<table class="border centpercent">';
if ($user->admin) if ($user->admin)
{ {

View File

@ -4,6 +4,7 @@
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -81,138 +82,138 @@ if (! is_array($user_arbo) && $user_arbo < 0)
} }
else else
{ {
// Define fulltree array // Define fulltree array
$fulltree=$user_arbo; $fulltree=$user_arbo;
//var_dump($fulltree); //var_dump($fulltree);
// Define data (format for treeview) // Define data (format for treeview)
$data=array(); $data=array();
$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
foreach($fulltree as $key => $val) foreach($fulltree as $key => $val)
{ {
$userstatic->id=$val['id']; $userstatic->id=$val['id'];
$userstatic->ref=$val['label']; $userstatic->ref=$val['label'];
$userstatic->login=$val['login']; $userstatic->login=$val['login'];
$userstatic->firstname=$val['firstname']; $userstatic->firstname=$val['firstname'];
$userstatic->lastname=$val['lastname']; $userstatic->lastname=$val['lastname'];
$userstatic->statut=$val['statut']; $userstatic->statut=$val['statut'];
$userstatic->email=$val['email']; $userstatic->email=$val['email'];
$userstatic->gender=$val['gender']; $userstatic->gender=$val['gender'];
$userstatic->societe_id=$val['fk_soc']; $userstatic->societe_id=$val['fk_soc'];
$userstatic->admin=$val['admin']; $userstatic->admin=$val['admin'];
$userstatic->entity=$val['entity']; $userstatic->entity=$val['entity'];
$userstatic->photo=$val['photo']; $userstatic->photo=$val['photo'];
$entity=$val['entity']; $entity=$val['entity'];
$entitystring=''; $entitystring='';
// TODO Set of entitystring should be done with a hook // TODO Set of entitystring should be done with a hook
if (! empty($conf->multicompany->enabled) && is_object($mc)) if (! empty($conf->multicompany->enabled) && is_object($mc))
{ {
if (empty($entity)) if (empty($entity))
{ {
$entitystring=$langs->trans("AllEntities"); $entitystring=$langs->trans("AllEntities");
} }
else else
{ {
$mc->getInfo($entity); $mc->getInfo($entity);
$entitystring=$mc->label; $entitystring=$mc->label;
} }
} }
$li=$userstatic->getNomUrl(-1, '', 0, 1); $li=$userstatic->getNomUrl(-1, '', 0, 1);
if (! empty($conf->multicompany->enabled) && $userstatic->admin && ! $userstatic->entity) if (! empty($conf->multicompany->enabled) && $userstatic->admin && ! $userstatic->entity)
{ {
$li.=img_picto($langs->trans("SuperAdministrator"), 'redstar'); $li.=img_picto($langs->trans("SuperAdministrator"), 'redstar');
} }
elseif ($userstatic->admin) elseif ($userstatic->admin)
{ {
$li.=img_picto($langs->trans("Administrator"), 'star'); $li.=img_picto($langs->trans("Administrator"), 'star');
} }
$li.=' ('.$val['login'].($entitystring?' - '.$entitystring:'').')'; $li.=' ('.$val['login'].($entitystring?' - '.$entitystring:'').')';
$data[] = array( $data[] = array(
'rowid'=>$val['rowid'], 'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_user'], 'fk_menu'=>$val['fk_user'],
'statut'=>$val['statut'], 'statut'=>$val['statut'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$li.'</td><td align="right" class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$userstatic->getLibStatut(3).'</td></tr></table>' 'entry'=>'<table class="nobordernopadding centpercent"><tr><td class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$li.'</td><td align="right" class="'.($val['statut']?'usertdenabled':'usertddisabled').'">'.$userstatic->getLibStatut(3).'</td></tr></table>'
); );
} }
//var_dump($data); //var_dump($data);
$title = $langs->trans("ListOfUsers"). ' - '.$langs->trans("HierarchicView"); $title = $langs->trans("ListOfUsers"). ' - '.$langs->trans("HierarchicView");
$param="search_statut=".urlencode($search_statut); $param="search_statut=".urlencode($search_statut);
$newcardbutton=''; $newcardbutton='';
if ($canadduser) if ($canadduser)
{ {
$newcardbutton.= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1': '').'&leftmenu='); $newcardbutton.= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1': '').'&leftmenu=');
} }
$morehtmlright.= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:'')); $morehtmlright.= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ?'?search_statut='.$search_statut:''));
print load_fiche_titre($title, $morehtmlright.' '.$newcardbutton); print load_fiche_titre($title, $morehtmlright.' '.$newcardbutton);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">'; print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<table class="liste nohover centpercent">'; print '<table class="liste nohover centpercent">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
// Status // Status
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print $form->selectarray('search_statut', array('-1'=>'','1'=>$langs->trans('Enabled')), $search_statut); print $form->selectarray('search_statut', array('-1'=>'','1'=>$langs->trans('Enabled')), $search_statut);
print '</td>'; print '</td>';
print '<td class="liste_titre maxwidthsearch">'; print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("HierarchicView"); print_liste_field_titre("HierarchicView");
print_liste_field_titre('<div id="iddivjstreecontrol"><a href="#">'.img_picto('', 'object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a href="#">'.img_picto('', 'object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>', $_SERVER['PHP_SELF'], "", '', "", 'align="center"'); print_liste_field_titre('<div id="iddivjstreecontrol"><a href="#">'.img_picto('', 'object_category').' '.$langs->trans("UndoExpandAll").'</a> | <a href="#">'.img_picto('', 'object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div>', $_SERVER['PHP_SELF'], "", '', "", 'align="center"');
print_liste_field_titre("Status", $_SERVER['PHP_SELF'], "", '', "", 'align="right"'); print_liste_field_titre("Status", $_SERVER['PHP_SELF'], "", '', "", 'align="right"');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch ');
print '</tr>'; print '</tr>';
$nbofentries=(count($data) - 1); $nbofentries=(count($data) - 1);
if ($nbofentries > 0) if ($nbofentries > 0)
{ {
print '<tr '.$bc[false].'><td colspan="3">'; print '<tr '.$bc[false].'><td colspan="3">';
tree_recur($data, $data[0], 0); tree_recur($data, $data[0], 0);
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
print '</tr>'; print '</tr>';
} }
else else
{ {
print '<tr '.$bc[true].'>'; print '<tr '.$bc[true].'>';
print '<td colspan="3">'; print '<td colspan="3">';
print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>'; print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
print '<td valign="middle">'; print '<td valign="middle">';
print $langs->trans("NoCategoryYet"); print $langs->trans("NoCategoryYet");
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</table>'; print '</table>';
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
print '</tr>'; print '</tr>';
} }
print "</table>"; print "</table>";
print "</form>\n"; print "</form>\n";
} }
// //

View File

@ -27,21 +27,24 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
}
if (! $user->rights->user->user->lire && ! $user->admin) if (! $user->rights->user->user->lire && ! $user->admin) {
accessforbidden(); accessforbidden();
}
// Load translation files required by page // Load translation files required by page
$langs->loadLangs(array('users', 'companies', 'hrm')); $langs->loadLangs(array('users', 'companies', 'hrm'));
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userlist'; // To manage different context of search $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'userlist'; // To manage different context of search
// Security check (for external users) // Security check (for external users)
$socid=0; $socid=0;
if ($user->societe_id > 0) if ($user->societe_id > 0) {
$socid = $user->societe_id; $socid = $user->societe_id;
}
// Load mode employee // Load mode employee
$mode = GETPOST("mode", 'alpha'); $mode = GETPOST("mode", 'alpha');
@ -535,29 +538,29 @@ while ($i < min($num, $limit))
} }
if (! empty($arrayfields['u.firstname']['checked'])) if (! empty($arrayfields['u.firstname']['checked']))
{ {
print '<td>'.$obj->firstname.'</td>'; print '<td>'.$obj->firstname.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['u.gender']['checked'])) if (! empty($arrayfields['u.gender']['checked']))
{ {
print '<td>'; print '<td>';
if ($obj->gender) print $langs->trans("Gender".$obj->gender); if ($obj->gender) print $langs->trans("Gender".$obj->gender);
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['u.employee']['checked'])) if (! empty($arrayfields['u.employee']['checked']))
{ {
print '<td>'.yn($obj->employee).'</td>'; print '<td>'.yn($obj->employee).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['u.accountancy_code']['checked'])) if (! empty($arrayfields['u.accountancy_code']['checked']))
{ {
print '<td>'.$obj->accountancy_code.'</td>'; print '<td>'.$obj->accountancy_code.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['u.email']['checked'])) if (! empty($arrayfields['u.email']['checked']))
{ {
print '<td>'.$obj->email.'</td>'; print '<td>'.$obj->email.'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
if (! empty($arrayfields['u.api_key']['checked'])) if (! empty($arrayfields['u.api_key']['checked']))
@ -580,7 +583,7 @@ while ($i < min($num, $limit))
print $langs->trans("DomainUser"); print $langs->trans("DomainUser");
} }
else else
{ {
print $langs->trans("InternalUser"); print $langs->trans("InternalUser");
} }
print '</td>'; print '</td>';
@ -673,9 +676,9 @@ while ($i < min($num, $limit))
// Status // Status
if (! empty($arrayfields['u.statut']['checked'])) if (! empty($arrayfields['u.statut']['checked']))
{ {
$userstatic->statut=$obj->statut; $userstatic->statut=$obj->statut;
print '<td class="center">'.$userstatic->getLibStatut(3).'</td>'; print '<td class="center">'.$userstatic->getLibStatut(3).'</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Action column // Action column
print '<td></td>'; print '<td></td>';

View File

@ -208,7 +208,7 @@ if ($result > 0)
print "</tr>\n"; print "</tr>\n";
// $listofemails=$object->thirdparty_and_contact_email_array(); // $listofemails=$object->thirdparty_and_contact_email_array();
if ($object->email) if ($object->email)
{ {
$actions=array(); $actions=array();
@ -294,7 +294,7 @@ if ($result > 0)
if ($num) if ($num)
{ {
$i = 0; $i = 0;
$userstatic=new user($db); $userstatic=new user($db);