mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
debug fetch method
This commit is contained in:
@@ -78,14 +78,20 @@ class CoreObject extends CommonObject {
|
||||
|
||||
}
|
||||
|
||||
private function checkFieldType($field, $type) {
|
||||
|
||||
if( isset($this->__fields[$field]) && method_exists($this, 'is_'.$type)) {
|
||||
return $this->{'is_'.$type}($this->__fields[$field]);
|
||||
}
|
||||
else return false;
|
||||
|
||||
}
|
||||
|
||||
private function is_date(Array &$info){
|
||||
|
||||
if(is_array($info)) {
|
||||
if(isset($info['type']) && $info['type']=='date') return true;
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
|
||||
}
|
||||
|
||||
private function is_array($info) {
|
||||
@@ -239,7 +245,25 @@ class CoreObject extends CommonObject {
|
||||
}
|
||||
|
||||
}
|
||||
public function addChild($tabName, $id='', $key='id', $try_to_load = false) {
|
||||
if(!empty($id)) {
|
||||
foreach($this->{$tabName} as $k=>&$object) {
|
||||
if($object->{$key} === $id) return $k;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$k = count($this->{$tabName});
|
||||
|
||||
$className = ucfirst($tabName);
|
||||
$this->{$tabName}[$k] = new $className($this->db);
|
||||
if($id>0 && $key==='id' && $try_to_load) {
|
||||
$this->{$tabName}[$k]->fetch($id);
|
||||
}
|
||||
|
||||
|
||||
return $k;
|
||||
}
|
||||
public function fetchChild() {
|
||||
|
||||
if($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) {
|
||||
@@ -272,13 +296,13 @@ class CoreObject extends CommonObject {
|
||||
}
|
||||
|
||||
|
||||
public function update() {
|
||||
|
||||
public function update(User &$user) {
|
||||
if(empty($this->id )) return $this->create($user);
|
||||
|
||||
|
||||
}
|
||||
public function create() {
|
||||
|
||||
public function create(User &$user) {
|
||||
if($this->id>0) return $this->update($user);
|
||||
|
||||
|
||||
}
|
||||
@@ -287,10 +311,46 @@ class CoreObject extends CommonObject {
|
||||
if(empty($this->{$field})) return '';
|
||||
elseif($this->{$field}<=strtotime('1000-01-01 00:00:00')) return '';
|
||||
else {
|
||||
|
||||
return dol_print_date($this->{$field}, $format);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function set_date($field,$date){
|
||||
|
||||
if(empty($date)) {
|
||||
$this->{$field} = 0;
|
||||
}
|
||||
else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$this->{$field} = dol_stringtotime($date);
|
||||
}
|
||||
|
||||
return $this->{$field};
|
||||
}
|
||||
|
||||
public function set_values(&$Tab) {
|
||||
foreach ($Tab as $key=>$value) {
|
||||
|
||||
if($this->checkFieldType($key,'date')) {
|
||||
$this->set_date($key, $value);
|
||||
}
|
||||
else if( $this->checkFieldType($key,'array')){
|
||||
$this->{$key} = $value;
|
||||
}
|
||||
else if( $this->checkFieldType($key,'float') ) {
|
||||
$this->{$key} = (double)price2num($value);
|
||||
}
|
||||
else if( $this->checkFieldType($key,'int') ) {
|
||||
$this->{$key} = (int)price2num($value);
|
||||
}
|
||||
else {
|
||||
$this->{$key} = @stripslashes($value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -147,15 +147,16 @@ class Inventory extends CoreObject
|
||||
|
||||
}
|
||||
|
||||
function update()
|
||||
function update(User &$user)
|
||||
{
|
||||
|
||||
//si on valide l'inventaire on sauvegarde le stock à cette instant
|
||||
if ($this->status)
|
||||
{
|
||||
$this->regulate();
|
||||
}
|
||||
|
||||
parent::update();
|
||||
parent::update($user);
|
||||
}
|
||||
|
||||
function set_values($Tab)
|
||||
@@ -209,7 +210,7 @@ class Inventory extends CoreObject
|
||||
$det->load_product();
|
||||
|
||||
$date = $this->get_date('date_inventory', 'Y-m-d');
|
||||
if(empty($date))$date = $this->get_date('date_cre', 'Y-m-d');
|
||||
if(empty($date))$date = $this->get_date('datec', 'Y-m-d');
|
||||
$det->setStockDate( $date , $fk_entrepot);
|
||||
|
||||
}
|
||||
@@ -416,9 +417,9 @@ class Inventorydet extends CoreObject
|
||||
return true;
|
||||
}
|
||||
|
||||
function setStockDate(&$PDOdb, $date, $fk_warehouse) {
|
||||
function setStockDate($date, $fk_warehouse) {
|
||||
|
||||
list($pmp,$stock) = $this->getPmpStockFromDate($PDOdb, $date, $fk_warehouse);
|
||||
list($pmp,$stock) = $this->getPmpStockFromDate($date, $fk_warehouse);
|
||||
|
||||
$this->qty_stock = $stock;
|
||||
$this->pmp = $pmp;
|
||||
@@ -432,18 +433,17 @@ class Inventorydet extends CoreObject
|
||||
AND datem<='".$date." 23:59:59'
|
||||
ORDER BY datem DESC LIMIT 1";
|
||||
|
||||
$res = $db->query($sql);
|
||||
$res = $this->db->query($sql);
|
||||
|
||||
if($obj = $db->fetch_object($res)) {
|
||||
if($res && $obj = $this->db->fetch_object($res)) {
|
||||
$last_pa = $obj->price;
|
||||
}
|
||||
|
||||
$this->pa = $last_pa;
|
||||
/* var_dump($fk_warehouse,$this->product->stock_warehouse,$this->pmp, $this->pa, $this->qty_stock);
|
||||
exit;*/
|
||||
|
||||
}
|
||||
|
||||
function getPmpStockFromDate(&$PDOdb, $date, $fk_warehouse){
|
||||
function getPmpStockFromDate( $date, $fk_warehouse){
|
||||
|
||||
$res = $this->product->load_stock();
|
||||
|
||||
@@ -459,7 +459,7 @@ class Inventorydet extends CoreObject
|
||||
|
||||
}
|
||||
|
||||
//On récupère tous les mouvements de stocks du produit entre aujourd'hui et la date de l'inventaire
|
||||
//All Stock mouvement between now and inventory date
|
||||
$sql = "SELECT value, price
|
||||
FROM ".MAIN_DB_PREFIX."stock_mouvement
|
||||
WHERE fk_product = ".$this->product->id."
|
||||
@@ -467,19 +467,14 @@ class Inventorydet extends CoreObject
|
||||
AND datem > '".date('Y-m-d 23:59:59',strtotime($date))."'
|
||||
ORDER BY datem DESC";
|
||||
|
||||
//echo $sql.'<br>';
|
||||
$db->query($sql);
|
||||
$TMouvementStock = $PDOdb->Get_All();
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
|
||||
$laststock = $stock;
|
||||
$lastpmp = $pmp;
|
||||
//Pour chacun des mouvements on recalcule le PMP et le stock physique
|
||||
foreach($TMouvementStock as $mouvement){
|
||||
|
||||
//150
|
||||
//if($this->product->id==394) echo 'laststock = '.$stock.'<br>';
|
||||
|
||||
//9.33
|
||||
//if($this->product->id==394) echo 'lastpmp = '.$pmp.'<br>';
|
||||
if($res) {
|
||||
while($mouvement = $this->db->fetch_object($res)) {
|
||||
$price = ($mouvement->price>0 && $mouvement->value>0) ? $mouvement->price : $lastpmp;
|
||||
|
||||
$stock_value = $laststock * $lastpmp;
|
||||
@@ -489,8 +484,7 @@ class Inventorydet extends CoreObject
|
||||
$last_stock_value = $stock_value - ($mouvement->value * $price);
|
||||
|
||||
$lastpmp = ($laststock != 0) ? $last_stock_value / $laststock : $lastpmp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -66,18 +66,17 @@ function _action()
|
||||
|
||||
$inventory = new Inventory($db);
|
||||
|
||||
_fiche_warehouse($user, $db, $conf, $langs, $inventory);
|
||||
_card_warehouse( $inventory);
|
||||
|
||||
break;
|
||||
|
||||
case 'confirmCreate':
|
||||
if (!$user->rights->inventory->create) accessforbidden();
|
||||
|
||||
|
||||
$inventory = new Inventory($db);
|
||||
$inventory->set_values($_REQUEST);
|
||||
$inventory->set_values($_POST);
|
||||
|
||||
$fk_inventory = $inventory->save();
|
||||
$fk_inventory = $inventory->create($user);
|
||||
$fk_category = (int)GETPOST('fk_category');
|
||||
$fk_supplier = (int)GETPOST('fk_supplier');
|
||||
$fk_warehouse = (int)GETPOST('fk_warehouse');
|
||||
@@ -86,7 +85,7 @@ function _action()
|
||||
$e = new Entrepot($db);
|
||||
$e->fetch($fk_warehouse);
|
||||
$TChildWarehouses = array($fk_warehouse);
|
||||
if(method_exists($e, 'get_children_warehouses')) $e->get_children_warehouses($fk_warehouse, $TChildWarehouses);
|
||||
$e->get_children_warehouses($fk_warehouse, $TChildWarehouses);
|
||||
|
||||
$sql = 'SELECT ps.fk_product, ps.fk_entrepot
|
||||
FROM '.MAIN_DB_PREFIX.'product_stock ps
|
||||
@@ -103,27 +102,27 @@ function _action()
|
||||
ORDER BY p.ref ASC,p.label ASC';
|
||||
|
||||
|
||||
$Tab = $PDOdb->ExecuteAsArray($sql);
|
||||
$res = $db->query($sql);
|
||||
if($res) {
|
||||
while($obj = $db->fetch_object($res)){
|
||||
|
||||
foreach($Tab as &$row) {
|
||||
|
||||
$inventory->add_product($PDOdb, $row->fk_product, $row->fk_entrepot);
|
||||
$inventory->add_product($obj->fk_product, $obj->fk_entrepot);
|
||||
}
|
||||
}
|
||||
|
||||
$inventory->save($PDOdb);
|
||||
$inventory->update($user);
|
||||
|
||||
header('Location: '.dol_buildpath('inventory/inventory.php?id='.$inventory->getId().'&action=edit', 1));
|
||||
header('Location: '.dol_buildpath('inventory/inventory.php?id='.$inventory->id.'&action=edit', 1));
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
if (!$user->rights->inventory->write) accessforbidden();
|
||||
|
||||
|
||||
$id = __get('id', 0, 'int');
|
||||
|
||||
$inventory = new Inventory($db);
|
||||
$inventory->load($PDOdb, $id);
|
||||
$inventory->fetch(GETPOST('id'));
|
||||
|
||||
_fiche($PDOdb, $user, $db, $conf, $langs, $inventory, __get('action', 'edit', 'string'));
|
||||
_card($inventory, GETPOST('action'));
|
||||
|
||||
break;
|
||||
|
||||
@@ -389,29 +388,29 @@ function _list()
|
||||
llxFooter('');
|
||||
}
|
||||
|
||||
function _fiche_warehouse(&$PDOdb, &$user, &$db, &$conf, $langs, $inventory)
|
||||
function _card_warehouse(&$inventory)
|
||||
{
|
||||
global $langs,$conf,$db, $user, $form;
|
||||
|
||||
dol_include_once('/categories/class/categorie.class.php');
|
||||
|
||||
llxHeader('',$langs->trans('inventorySelectWarehouse'),'','');
|
||||
print dol_get_fiche_head(inventoryPrepareHead($inventory));
|
||||
|
||||
$form=new TFormCore('inventory.php', 'confirmCreate');
|
||||
print $form->hidden('action', 'confirmCreate');
|
||||
$form->Set_typeaff('edit');
|
||||
echo '<form name="confirmCreate" action="'.$_SERVER['PHP_SELF'].'" method="post" />';
|
||||
echo '<input type="hidden" name="action" value="confirmCreate" />';
|
||||
|
||||
$formproduct = new FormProduct($db);
|
||||
$formDoli = new Form($db);
|
||||
|
||||
?>
|
||||
<table class="border" width="100%" >
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('Title') ?></td>
|
||||
<td><?php echo $form->texte('', 'title', '',50,255) ?></td>
|
||||
<td><input type="text" name="title" value="" size="50" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('Date') ?></td>
|
||||
<td><?php echo $form->calendrier('', 'date_inventory',time()) ?></td>
|
||||
<td><?php echo $form->select_date(time(),'date_inventory'); ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
@@ -421,11 +420,11 @@ function _fiche_warehouse(&$PDOdb, &$user, &$db, &$conf, $langs, $inventory)
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('SelectCategory') ?></td>
|
||||
<td><?php echo $formDoli->select_all_categories(0,'', 'fk_category') ?></td>
|
||||
<td><?php echo $form->select_all_categories(0,'', 'fk_category') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('SelectFournisseur') ?></td>
|
||||
<td><?php echo $formDoli->select_thirdparty('','fk_supplier','s.fournisseur = 1') ?></td>
|
||||
<td><?php echo $form->select_thirdparty('','fk_supplier','s.fournisseur = 1') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $langs->trans('OnlyProdsInStock') ?></td>
|
||||
@@ -439,7 +438,8 @@ function _fiche_warehouse(&$PDOdb, &$user, &$db, &$conf, $langs, $inventory)
|
||||
print '<input type="submit" class="butAction" value="'.$langs->trans('inventoryConfirmCreate').'" />';
|
||||
print '</div>';
|
||||
|
||||
print $form->end_form();
|
||||
echo '</form>';
|
||||
|
||||
llxFooter('');
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ function _card(&$inventory, $mode='edit')
|
||||
print dol_get_fiche_head(inventoryPrepareHead($inventory, $langs->trans('inventoryOfWarehouse', $warehouse->libelle), '&action='.$mode));
|
||||
|
||||
$lines = array();
|
||||
_card_line($inventory, $lines, $form);
|
||||
_card_line($inventory, $lines, $mode);
|
||||
|
||||
print '<b>'.$langs->trans('inventoryOnDate')." ".$inventory->get_date('date_inventory').'</b><br><br>';
|
||||
|
||||
@@ -488,7 +488,7 @@ function _card(&$inventory, $mode='edit')
|
||||
}
|
||||
|
||||
|
||||
function _card_line(&$inventory, &$lines, &$form)
|
||||
function _card_line(&$inventory, &$lines, $mode)
|
||||
{
|
||||
global $db;
|
||||
$inventory->amount_actual = 0;
|
||||
@@ -512,21 +512,23 @@ function _card_line(&$inventory, &$lines, &$form)
|
||||
if(!empty($TCacheEntrepot[$Inventorydet->fk_warehouse])) $e = $TCacheEntrepot[$Inventorydet->fk_warehouse];
|
||||
elseif($e->fetch($Inventorydet->fk_warehouse) > 0) $TCacheEntrepot[$e->id] = $e;
|
||||
|
||||
$qty = (float)GETPOST('qty_to_add')[$k];
|
||||
|
||||
$lines[]=array(
|
||||
'produit' => $product->getNomUrl(1).' - '.$product->label
|
||||
,'entrepot'=>$e->getNomUrl(1)
|
||||
,'barcode' => $product->barcode
|
||||
/*,'qty' => $form->texte('', 'qty_to_add['.$k.']', (isset($_REQUEST['qty_to_add'][$k]) ? $_REQUEST['qty_to_add'][$k] : 0), 8, 0, "style='text-align:center;'")
|
||||
.($form->type_aff!='view' ? '<a id="a_save_qty_'.$k.'" href="javascript:save_qty('.$k.')">'.img_picto('Ajouter', 'plus16@inventory').'</a>' : '')
|
||||
,'qty' =>($mode == 'edit' ? '<input type="text" name="qty_to_add['.$k.']" value="'.$qty.'" size="8" style="text-align:center;" />' : $qty )
|
||||
.($mode =='edit' ? '<a id="a_save_qty_'.$k.'" href="javascript:save_qty('.$k.')">'.img_picto($langs->trans('Add'), 'plus16@inventory').'</a>' : '')
|
||||
,'qty_view' => $Inventorydet->qty_view ? $Inventorydet->qty_view : 0
|
||||
,'qty_stock' => $stock
|
||||
,'qty_regulated' => $Inventorydet->qty_regulated ? $Inventorydet->qty_regulated : 0
|
||||
,'action' => $user->rights->inventory->write ? '<a onclick="if (!confirm(\'Confirmez-vous la suppression de la ligne ?\')) return false;" href="'.dol_buildpath('inventory/inventory.php?id='.$inventory->getId().'&action=delete_line&rowid='.$Inventorydet->getId(), 1).'">'.img_picto($langs->trans('inventoryDeleteLine'), 'delete').'</a>' : ''
|
||||
,'action' => ($user->rights->inventory->write ? '<a onclick="if (!confirm(\'Confirmez-vous la suppression de la ligne ?\')) return false;" href="'.dol_buildpath('inventory/inventory.php?id='.$inventory->getId().'&action=delete_line&rowid='.$Inventorydet->getId(), 1).'">'.img_picto($langs->trans('inventoryDeleteLine'), 'delete').'</a>' : '')
|
||||
,'pmp_stock'=>round($pmp_actual,2)
|
||||
,'pmp_actual'=> round($pmp * $Inventorydet->qty_view,2)
|
||||
,'pmp_new'=>(!empty($user->rights->inventory->changePMP) ? $form->texte('', 'new_pmp['.$k.']',$Inventorydet->new_pmp, 8, 0, "style='text-align:right;'")
|
||||
.($form->type_aff!='view' ? '<a id="a_save_new_pmp_'.$k.'" href="javascript:save_pmp('.$k.')">'.img_picto($langs->trans('Save'), 'bt-save.png@inventory').'</a>' : '') : '' )
|
||||
*/,'pa_stock'=>round($last_pa * $stock,2)
|
||||
,'pmp_new'=>(!empty($user->rights->inventory->changePMP) ? '<input type="text" name="new_pmp['.$k.']" value="'.$Inventorydet->new_pmp.'" size="8" style="text-align:right;" />'
|
||||
.($mode =='edit' ? '<a id="a_save_new_pmp_'.$k.'" href="javascript:save_pmp('.$k.')">'.img_picto($langs->trans('Save'), 'bt-save.png@inventory').'</a>' : '') : '')
|
||||
,'pa_stock'=>round($last_pa * $stock,2)
|
||||
,'pa_actual'=>round($last_pa * $Inventorydet->qty_view,2)
|
||||
,'current_pa_stock'=>round($current_pa * $stock,2)
|
||||
,'current_pa_actual'=>round($current_pa * $Inventorydet->qty_view,2)
|
||||
@@ -610,80 +612,9 @@ function exportCSV(&$inventory) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function generateODT(&$PDOdb, &$db, &$conf, &$langs, &$inventory)
|
||||
{
|
||||
$TBS=new TTemplateTBS();
|
||||
|
||||
$InventoryPrint = array(); // Tableau envoyé à la fonction render contenant les informations concernant l'inventaire
|
||||
|
||||
foreach($inventory->Inventorydet as $k => $v)
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($v->fk_product);
|
||||
//$prod->fetch_optionals($prod->id);
|
||||
|
||||
$InventoryPrint[] = array(
|
||||
'product' => $prod->ref.' - '.$prod->label
|
||||
, 'qty_view' => $v->qty_view
|
||||
);
|
||||
}
|
||||
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse->fetch($inventory->fk_warehouse);
|
||||
|
||||
$dirName = 'INVENTORY'.$inventory->getId().'('.date("d_m_Y").')';
|
||||
$dir = DOL_DATA_ROOT.'/inventory/'.$dirName.'/';
|
||||
|
||||
@mkdir($dir, 0777, true);
|
||||
|
||||
$template = "templateINVENTORY.odt";
|
||||
//$template = "templateOF.doc";
|
||||
|
||||
$file_gen = $TBS->render(dol_buildpath('inventory/exempleTemplate/'.$template)
|
||||
,array(
|
||||
'InventoryPrint'=>$InventoryPrint
|
||||
)
|
||||
,array(
|
||||
'date_cre'=>$inventory->get_date('date_cre', 'd/m/Y')
|
||||
,'date_maj'=>$inventory->get_date('date_maj', 'd/m/Y H:i')
|
||||
,'date_inv'=>$inventory->get_date('date_inventory', 'd/m/Y')
|
||||
,'numero'=>empty($inventory->title) ? 'Inventaire n°'.$inventory->getId() : $inventory->title
|
||||
,'warehouse'=>$warehouse->libelle
|
||||
,'status'=>($inventory->status ? $langs->transnoentitiesnoconv('inventoryValidate') : $langs->transnoentitiesnoconv('inventoryDraft'))
|
||||
,'logo'=>DOL_DATA_ROOT."/mycompany/logos/".MAIN_INFO_SOCIETE_LOGO
|
||||
)
|
||||
,array()
|
||||
,array(
|
||||
'outFile'=>$dir.$inventory->getId().".odt"
|
||||
,"convertToPDF"=>(!empty($conf->global->INVENTORY_GEN_PDF) ? true : false)
|
||||
,'charset'=>OPENTBS_ALREADY_UTF8
|
||||
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=inventory&entity=".$conf->entity."&file=".$dirName."/".$inventory->getId(). (!empty($conf->global->INVENTORY_GEN_PDF) ? '.pdf' : '.odt') );
|
||||
|
||||
/*
|
||||
$size = filesize("./" . basename($file_gen));
|
||||
header("Content-Type: application/force-download; name=\"" . basename($file_gen) . "\"");
|
||||
header("Content-Transfer-Encoding: binary");
|
||||
header("Content-Length: $size");
|
||||
header("Content-Disposition: attachment; filename=\"" . basename($file_gen) . "\"");
|
||||
header("Expires: 0");
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
readfile($file_gen);
|
||||
*/
|
||||
|
||||
//header("Location: ".DOL_URL_ROOT."/document.php?modulepart=asset&entity=1&file=".$dirName."/".$assetOf->numero.".doc");
|
||||
|
||||
}
|
||||
function _footerList($view,$total_pmp,$total_pmp_actual,$total_pa,$total_pa_actual, $total_current_pa,$total_current_pa_actual) {
|
||||
global $conf,$user,$langs;
|
||||
|
||||
|
||||
if ($view['can_validate'] == 1) { ?>
|
||||
<tr style="background-color:#dedede;">
|
||||
<th colspan="3"> </th>
|
||||
|
||||
@@ -154,9 +154,9 @@
|
||||
<td align="center" width="20%"><?php echo $row['action']; ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php $i++; ?>
|
||||
<?php $i++;
|
||||
|
||||
<?php }
|
||||
}
|
||||
|
||||
_footerList($view,$total_pmp,$total_pmp_actual,$total_pa,$total_pa_actual, $total_current_pa,$total_current_pa_actual);
|
||||
?>
|
||||
@@ -168,18 +168,17 @@
|
||||
<?php if ($view['is_already_validate'] != 1) { ?>
|
||||
<div class="tabsAction" style="height:30px;">
|
||||
<?php if ($view['mode'] == 'view') { ?>
|
||||
<a href="<?php echo $view_url; ?>?id=<?php echo $inventory->id; ?>&action=printDoc" class="butAction"><?php echo $langs->trans('Print') ?></a>
|
||||
<a href="<?php echo $view_url; ?>?id=<?php echo $inventory->id; ?>&action=exportCSV" class="butAction"><?php echo $langs->trans('ExportCSV') ?></a>
|
||||
<a href="<?php echo $view_url; ?>?id=<?php echo $inventory->id; ?>&action=edit" class="butAction"><?php echo $langs->trans('Modify') ?></a>
|
||||
<?php
|
||||
if(!empty($user->rights->inventory->changePMP)) {
|
||||
echo '<a href="javascript:;" onclick="javascript:if (!confirm(\'Confirmez-vous l\\\'application du nouveau PMP ?\')) return false; else document.location.href=\''.$view_url
|
||||
echo '<a href="javascript:;" onclick="if (!confirm(\'Confirmez-vous l\\\'application du nouveau PMP ?\')) return false; else document.location.href=\''.$view_url
|
||||
.'?id='.$inventory->id
|
||||
.'&action=changePMP&token='.$view['token'].'\'; " class="butAction">'.$langs->trans('ApplyPMP').'</a>';
|
||||
}
|
||||
|
||||
if ($can_validate == 1) { ?>
|
||||
<a href="javascript:;" onclick="javascript:if (!confirm('Confirmez-vous la régulation ?')) return false; else document.location.href='<?php echo $view_url; ?>?id=<?php echo $inventory->id; ?>&action=regulate&token=<?php echo $view['token']; ?>'; " class="butAction">Réguler le stock</a>
|
||||
<a href="javascript:;" onclick="if (!confirm('Confirmez-vous la régulation ?')) return false; else document.location.href='<?php echo $view_url; ?>?id=<?php echo $inventory->id; ?>&action=regulate&token=<?php echo $view['token']; ?>'; " class="butAction">Réguler le stock</a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($view['mode'] == 'edit') { ?>
|
||||
@@ -196,7 +195,6 @@
|
||||
<div class="tabsAction">
|
||||
<?php if ($can_validate == 1) { ?>
|
||||
|
||||
<a href="<?php echo $view_url; ?>?id=<?php echo $inventory->id; ?>&action=printDoc" class="butAction"><?php echo $langs->trans('Print') ?></a>
|
||||
<a href="<?php echo $view_url; ?>?id=<?php echo $inventory->id; ?>&action=exportCSV" class="butAction"><?php echo $langs->trans('ExportCSV') ?></a>
|
||||
<a href="#" title="Cet inventaire est validé" class="butActionRefused"><?php echo $langs->trans('Delete') ?></a>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user