Browse Source

Refactoring affichage de l'utilisateur à l'origine d'un CreditHistorique

refactoring
keun 6 years ago
parent
commit
56c2f7dcf5
4 changed files with 13 additions and 2 deletions
  1. +1
    -1
      backend/controllers/CommandeController.php
  2. +1
    -1
      backend/views/user/credit.php
  3. +9
    -0
      common/models/CreditHistorique.php
  4. +2
    -0
      common/models/User.php

+ 1
- 1
backend/controllers/CommandeController.php View File

@@ -1191,7 +1191,7 @@ class CommandeController extends BackendController {
foreach ($historique as $h) {
$html .= '<tr>'
. '<td>' . date('d/m/Y H:i:s', strtotime($h->date)) . '</td>'
. '<td>' . Html::encode($h->userAction->nom . ' ' . $h->userAction->prenom) . '</td>'
. '<td>' . Html::encode($h->strUserAction()) . '</td>'
. '<td>' . $h->getStrLibelle() . '</td>'
. '<td>' . ($h->isTypeDebit() ? '- '.$h->getMontant(true) : '') . '</td>'
. '<td>' . ($h->isTypeCredit() ? '+ '.$h->getMontant(true) : '') . '</td>'

+ 1
- 1
backend/views/user/credit.php View File

@@ -67,7 +67,7 @@ $this->params['breadcrumbs'][] = 'Créditer';
<?php foreach($historique as $ch): ?>
<tr>
<td><?= $ch->getDate(true) ; ?></td>
<td><?php if(isset($ch->userAction)): echo Html::encode($ch->userAction->nom. ' '.$ch->userAction->prenom) ; else: echo 'Administrateur' ;endif; ?></td>
<td><?= Html::encode($ch->strUserAction()); ?></td>
<td><?= $ch->getStrLibelle(); ?></td>
<td>
<?php if($ch->isTypeDebit()): ?>

+ 9
- 0
common/models/CreditHistorique.php View File

@@ -207,5 +207,14 @@ class CreditHistorique extends ActiveRecord {
default: return 'Crédit pain' ;
}
}
public function strUserAction() {
if($this->userAction) {
return $this->userAction->nom . ' ' . $this->userAction->prenom ;
}
else {
return 'Système' ;
}
}

}

+ 2
- 0
common/models/User.php View File

@@ -26,6 +26,8 @@ class User extends ActiveRecord implements IdentityInterface {
const STATUS_BOULANGER = 11;
const STATUS_ADMIN = 13;

const ID_USER_SYSTEM = 0 ;
var $password_old;
var $password_new;
var $password_new_confirm;

Loading…
Cancel
Save