Look and feel v8

This commit is contained in:
Laurent Destailleur 2018-05-24 12:32:04 +02:00
parent e51aa68284
commit 23e2bb20d9
3 changed files with 108 additions and 195 deletions

View File

@ -344,7 +344,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
// Definition of $dir and $file // Definition of $dir and $file
if ($object->specimen) if ($object->specimen)
{ {
$dir = $conf->stock->dir_output . "/mouvement"; $dir = $conf->stock->dir_output . "/movement";
$file = $dir . "/SPECIMEN.pdf"; $file = $dir . "/SPECIMEN.pdf";
} }
else else
@ -352,7 +352,7 @@ class pdf_stdmouvement extends ModelePDFMouvement
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode;
if($search_type_mouvement) $objectref.="_".$search_type_mouvement; if($search_type_mouvement) $objectref.="_".$search_type_mouvement;
$dir = $conf->stock->dir_output . "/mouvement/" . $objectref; $dir = $conf->stock->dir_output . "/movement/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf"; $file = $dir . "/" . $objectref . ".pdf";
} }

View File

@ -61,6 +61,7 @@ $hookmanager->initHooks(array('warehousecard','globalcard'));
$object = new Entrepot($db); $object = new Entrepot($db);
/* /*
* Actions * Actions
*/ */
@ -176,58 +177,6 @@ $permissioncreate = $user->rights->stock->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
/*
* Build document
*/
/*
if ($action == 'builddoc') // En get ou en post
{
if ($id > 0 || $ref)
{
$object = new Entrepot($db);
$result = $object->fetch($id, $ref);
if ($result <= 0)
{
print 'No record found';
exit;
}
}
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
$result= $object->generateDocument($object->modelpdf, $outputlangs);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Delete file in doc form
elseif ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->stock->dir_output ;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
*/
/* /*
* View * View
*/ */
@ -721,10 +670,12 @@ else
* Documents generes * Documents generes
*/ */
$modulepart='stock'; if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
if ($action != 'create' && $action != 'edit' && $action != 'delete')
{ {
$modulepart='stock';
if ($action != 'create' && $action != 'edit' && $action != 'delete')
{
print '<br/>'; print '<br/>';
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
@ -755,6 +706,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete')
$somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product $somethingshown = $formactions->showactions($object, 'stock', 0, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for product
print '</div></div></div>'; print '</div></div></div>';
}
} }

View File

@ -95,7 +95,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search
$arrayfields=array( $arrayfields=array(
'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'm.rowid'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1), 'm.datem'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1), 'p.ref'=>array('label'=>$langs->trans("ProductRef"), 'checked'=>1, 'css'=>'maxwidth100'),
'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1), 'p.label'=>array('label'=>$langs->trans("ProductLabel"), 'checked'=>1),
'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))), 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))),
'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))),
@ -403,52 +403,12 @@ if ($action == "transfert_stock" && ! $cancel)
/* /*
* Build document * Build document
*/ */
if ($action == 'builddoc') // En get ou en post /* The builddoc action for object of a movement must be on the movement card
{ // Actions to build doc
if ($id > 0 || $ref) $upload_dir = $conf->stock->dir_output;
{ $permissioncreate = $user->rights->stock->creer;
$object = new MouvementStock($db); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
$result = $object->fetch($id, $ref); */
if ($result <= 0)
{
print 'No record found';
exit;
}
}
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$ret=$object->fetch($id); // Reload to get new records
$result= $object->generateDocument($object->modelpdf, $outputlangs);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Delete file in doc form
elseif ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->stock->dir_output."/mouvement" ;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
if (empty($reshook) && $action != 'remove_file') if (empty($reshook) && $action != 'remove_file')
{ {
@ -809,12 +769,12 @@ if ($resql)
} }
if (! empty($arrayfields['m.datem']['checked'])) if (! empty($arrayfields['m.datem']['checked']))
{ {
print '<td class="liste_titre" valign="right">'; print '<td class="liste_titre nowraponall">';
print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">'; print '<input class="flat" type="text" size="2" maxlength="2" placeholder="'.dol_escape_htmltag($langs->trans("Month")).'" name="month" value="'.$month.'">';
if (empty($conf->productbatch->enabled)) print '&nbsp;'; if (empty($conf->productbatch->enabled)) print '&nbsp;';
//else print '<br>'; //else print '<br>';
$syear = $year?$year:-1; $syear = $year?$year:-1;
print '<input class="flat" type="text" size="3" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" name="year" value="'.($syear > 0 ? $syear : '').'">'; print '<input class="flat maxwidth50" type="text" maxlength="4" placeholder="'.dol_escape_htmltag($langs->trans("Year")).'" name="year" value="'.($syear > 0 ? $syear : '').'">';
//print $formother->selectyear($syear,'year',1, 20, 5); //print $formother->selectyear($syear,'year',1, 20, 5);
print '</td>'; print '</td>';
} }
@ -822,7 +782,7 @@ if ($resql)
{ {
// Product Ref // Product Ref
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat maxwidth100" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct?$product->ref:$search_product_ref).'">'; print '<input class="flat maxwidth75" type="text" name="search_product_ref" value="'.dol_escape_htmltag($idproduct?$product->ref:$search_product_ref).'">';
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['p.label']['checked'])) if (! empty($arrayfields['p.label']['checked']))
@ -835,7 +795,7 @@ if ($resql)
// Batch // Batch
if (! empty($arrayfields['m.batch']['checked'])) if (! empty($arrayfields['m.batch']['checked']))
{ {
print '<td class="liste_titre" align="center"><input class="flat maxwidth100" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).'"></td>'; print '<td class="liste_titre" align="center"><input class="flat maxwidth75" type="text" name="search_batch" value="'.dol_escape_htmltag($search_batch).'"></td>';
} }
if (! empty($arrayfields['pl.eatby']['checked'])) if (! empty($arrayfields['pl.eatby']['checked']))
{ {
@ -1096,7 +1056,7 @@ if ($resql)
{ {
// Price // Price
print '<td align="right">'; print '<td align="right">';
print price($objp->price); if ($objp->price != 0) print price($objp->price);
print '</td>'; print '</td>';
} }
// Action column // Action column
@ -1156,10 +1116,12 @@ else
dol_print_error($db); dol_print_error($db);
} }
/* /*
* Documents generes * Documents generes
*/ */
/* Area for doc and last events of warehouse are stored on the main card of warehouse
$modulepart='mouvement'; $modulepart='mouvement';
if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0) if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0)
@ -1174,7 +1136,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0)
if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode; if(!empty($search_inventorycode)) $objectref.="_".$id."_".$search_inventorycode;
if($search_type_mouvement) $objectref.="_".$search_type_mouvement; if($search_type_mouvement) $objectref.="_".$search_type_mouvement;
$relativepath = $comref . '/' . $objectref . '.pdf'; $relativepath = $comref . '/' . $objectref . '.pdf';
$filedir = $conf->stock->dir_output . '/mouvement/' . $objectref; $filedir = $conf->stock->dir_output . '/movement/' . $objectref;
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement"; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id."&search_inventorycode=".$search_inventorycode."&search_type_mouvement=$search_type_mouvement";
$genallowed=$usercanread; $genallowed=$usercanread;
@ -1183,8 +1145,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0)
$genallowed=$user->rights->stock->mouvement->lire; $genallowed=$user->rights->stock->mouvement->lire;
$delallowed=$user->rights->stock->mouvement->creer; $delallowed=$user->rights->stock->mouvement->creer;
$var=true;
print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); print $formfile->showdocuments($modulepart,$objectref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object);
$somethingshown=$formfile->numoffiles; $somethingshown=$formfile->numoffiles;
@ -1203,6 +1163,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete' && $id>0)
print '</div></div></div>'; print '</div></div></div>';
} }
*/
llxFooter(); llxFooter();