27require 
'../../main.inc.php';
 
   28require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
 
   29require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
 
   30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
 
   31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
 
   32require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
 
   33require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
 
   34require_once DOL_DOCUMENT_ROOT.
'/core/modules/import/import_csv.modules.php';
 
   35require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
 
   36require_once DOL_DOCUMENT_ROOT.
'/core/lib/import.lib.php';
 
   38$confirm = 
GETPOST(
'confirm', 
'alpha');
 
   39$filetoimport = 
GETPOST(
'filetoimport');
 
   42$langs->loadLangs(array(
'products', 
'stocks', 
'orders', 
'productbatch'));
 
   45$hookmanager->initHooks(array(
'massstockmove'));
 
   49  $socid = $user->socid;
 
   55$action = 
GETPOST(
'action', 
'aZ09');
 
   56$id_product = 
GETPOST(
'productid', 
'int');
 
   57$id_sw = 
GETPOST(
'id_sw', 
'int');
 
   58$id_tw = 
GETPOST(
'id_tw', 
'int');
 
   64$limit = 
GETPOST(
'limit', 
'int') ? 
GETPOST(
'limit', 
'int') : $conf->liste_limit;
 
   65$sortfield = 
GETPOST(
'sortfield', 
'aZ09comma');
 
   66$sortorder = 
GETPOST(
'sortorder', 
'aZ09comma');
 
   67$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
   68if (empty($page) || $page < 0 || 
GETPOST(
'button_search', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) {
 
   72$offset = $limit * $page;
 
   84  unset($_SESSION[
'massstockmove']);
 
   87if (!empty($_SESSION[
'massstockmove'])) {
 
   88  $listofdata = json_decode($_SESSION[
'massstockmove'], 
true);
 
   98if ($action == 
'addline' && $user->hasRight(
'stock', 
'mouvement', 
'creer')) {
 
  108    setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseTarget")), 
null, 
'errors');
 
  110  if ($id_sw > 0 && $id_tw == $id_sw) {
 
  112    $langs->load(
"errors");
 
  113    setEventMessages($langs->trans(
"ErrorWarehouseMustDiffers"), 
null, 
'errors');
 
  115  if (!($id_product > 0)) {
 
  117    setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")), 
null, 
'errors');
 
  121    setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Qty")), 
null, 
'errors');
 
  126    $producttmp = 
new Product($db);
 
  127    $producttmp->fetch($id_product);
 
  128    if ($producttmp->hasbatch()) {
 
  131        $langs->load(
"errors");
 
  132        setEventMessages($langs->trans(
"ErrorTryToMakeMoveOnProductRequiringBatchData", $producttmp->ref), 
null, 
'errors');
 
  141    if ($producttmp->hasbatch()) {
 
  148    if (count(array_keys($listofdata)) > 0) {
 
  149      $id = max(array_keys($listofdata)) + 1;
 
  153    $listofdata[$id] = array(
'id'=>$id, 
'id_product'=>$id_product, 
'qty'=>$qty, 
'id_sw'=>$id_sw, 
'id_tw'=>$id_tw, 
'batch'=>$batch);
 
  154    $_SESSION[
'massstockmove'] = json_encode($listofdata);
 
  164if ($action == 
'delline' && $idline != 
'' && $user->hasRight(
'stock', 
'mouvement', 
'creer')) {
 
  165  if (!empty($listofdata[$idline])) {
 
  166    unset($listofdata[$idline]);
 
  168  if (count($listofdata) > 0) {
 
  169    $_SESSION[
'massstockmove'] = json_encode($listofdata);
 
  171    unset($_SESSION[
'massstockmove']);
 
  175if ($action == 
'createmovements' && $user->hasRight(
'stock', 
'mouvement', 
'creer')) {
 
  180    setEventMessages($langs->trans(
"ErrorFieldRequired"), $langs->transnoentitiesnoconv(
"MovementLabel"), 
null, 
'errors');
 
  188    foreach ($listofdata as $key => $val) { 
 
  190      $id_product = $val[
'id_product'];
 
  191      $id_sw = $val[
'id_sw'];
 
  192      $id_tw = $val[
'id_tw'];
 
  194      $batch = $val[
'batch'];
 
  198      if (!$error && $id_sw != $id_tw && is_numeric($qty) && $id_product) {
 
  199        $result = $product->fetch($id_product);
 
  201        $product->load_stock(
'novirtual'); 
 
  205        if (!empty($product->pmp)) {
 
  206          $pricesrc = $product->pmp;
 
  208        $pricedest = $pricesrc;
 
  212        if (empty($conf->productbatch->enabled) || !$product->hasbatch()) { 
 
  215            $result1 = $product->correct_stock(
 
  231          $result2 = $product->correct_stock(
 
  245          $arraybatchinfo = $product->loadBatchInfo($batch);
 
  246          if (count($arraybatchinfo) > 0) {
 
  247            $firstrecord = array_shift($arraybatchinfo);
 
  248            $dlc = $firstrecord[
'eatby'];
 
  249            $dluo = $firstrecord[
'sellby'];
 
  262            $result1 = $product->correct_stock_batch(
 
  281          $result2 = $product->correct_stock_batch(
 
  307    unset($_SESSION[
'massstockmove']);
 
  311    header(
"Location: ".DOL_URL_ROOT.
'/product/stock/index.php'); 
 
  319if ($action == 
'importCSV' && $user->hasRight(
'stock', 
'mouvement', 
'creer')) {
 
  323  $fullpath = $conf->stock->dir_temp.
"/".$user->id.
'-csvfiletotimport.csv';
 
  325  if (is_numeric($resultupload) && $resultupload > 0) {
 
  326    dol_syslog(
"File ".$fullpath.
" was added for import");
 
  329    $langs->load(
"errors");
 
  330    if ($resultupload === 
'ErrorDirNotWritable') {
 
  331      setEventMessages($langs->trans(
"ErrorFailedToSaveFile").
' - '.$langs->trans($resultupload, $fullpath), 
null, 
'errors');
 
  338    $importcsv = 
new ImportCsv($db, 
'massstocklist');
 
  341    $nblinesrecord = $importcsv->import_get_nb_of_lines($fullpath)-1;
 
  342    $importcsv->import_open_file($fullpath);
 
  343    $labelsrecord = $importcsv->import_read_record();
 
  345    if ($nblinesrecord < 1) {
 
  346      setEventMessages($langs->trans(
"BadNumberOfLinesMustHaveAtLeastOneLinePlusTitle"), 
null, 
'errors');
 
  350      $productstatic = 
new Product($db);
 
  351      $warehousestatics = 
new Entrepot($db);
 
  352      $warehousestatict = 
new Entrepot($db);
 
  355      while (($i < $nblinesrecord) && !$error) {
 
  356        $newrecord = $importcsv->import_read_record();
 
  358        $data[$i] = $newrecord;
 
  359        if (count($data[$i]) == 1) {
 
  366        $tmp_id_sw = $data[$i][0][
'val'];
 
  367        $tmp_id_tw = $data[$i][1][
'val'];
 
  368        $tmp_id_product = $data[$i][2][
'val'];
 
  369        $tmp_qty = $data[$i][3][
'val'];
 
  370        $tmp_batch = $data[$i][4][
'val'];
 
  372        $errorforproduct = 0;
 
  374        if (!is_numeric($tmp_id_product) && $tmp_id_product != 
'' && preg_match(
'/^id:/i', $tmp_id_product)) {
 
  377        $tmp_id_product = preg_replace(
'/^(id|ref):/i', 
'', $tmp_id_product);
 
  379        if ($isidorref === 
'ref') {
 
  380          $tmp_id_product = preg_replace(
'/^ref:/', 
'', $tmp_id_product);
 
  381          $result = 
fetchref($productstatic, $tmp_id_product);
 
  382          if ($result === -2) {
 
  384            $errorforproduct = 1;
 
  385            $langs->load(
"errors");
 
  386            setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_product), 
null, 
'errors');
 
  387          } elseif ($result <= 0) {
 
  389            $errorforproduct = 1;
 
  390            $langs->load(
"errors");
 
  391            setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_product), 
null, 
'errors');
 
  393          $tmp_id_product = $result;
 
  395        $data[$i][2][
'val'] = $tmp_id_product;
 
  396        if (!$errorforproduct && !($tmp_id_product > 0)) {
 
  398          setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Product")), 
null, 
'errors');
 
  401        if ($tmp_id_sw !== 
'') {
 
  403          $errorforwarehouses = 0;
 
  405          if (!is_numeric($tmp_id_sw) && $tmp_id_sw != 
'' && preg_match(
'/^id:/i', $tmp_id_sw)) {
 
  408          $tmp_id_sw = preg_replace(
'/^(id|ref):/i', 
'', $tmp_id_sw);
 
  409          if ($isidorref === 
'ref') {
 
  410            $tmp_id_sw = preg_replace(
'/^ref:/', 
'', $tmp_id_sw);
 
  411            $result = 
fetchref($warehousestatics, $tmp_id_sw);
 
  412            if ($result === -2) {
 
  414              $errorforwarehouses = 1;
 
  415              $langs->load(
"errors");
 
  416              setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_sw), 
null, 
'errors');
 
  417            } elseif ($result <= 0) {
 
  419              $errorforwarehouses = 1;
 
  420              $langs->load(
"errors");
 
  421              setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_sw), 
null, 
'errors');
 
  423            $tmp_id_sw = $result;
 
  425          $data[$i][0][
'val'] = $tmp_id_sw;
 
  426          if (!$errorforwarehouses && !($tmp_id_sw > 0)) {
 
  428            setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseSource")), 
null, 
'errors');
 
  432        $errorforwarehouset = 0;
 
  434        if (!is_numeric($tmp_id_tw) && $tmp_id_tw != 
'' && preg_match(
'/^id:/i', $tmp_id_tw)) {
 
  437        $tmp_id_tw = preg_replace(
'/^(id|ref):/i', 
'', $tmp_id_tw);
 
  438        if ($isidorref === 
'ref') {
 
  439          $tmp_id_tw = preg_replace(
'/^ref:/', 
'', $tmp_id_tw);
 
  440          $result = 
fetchref($warehousestatict, $tmp_id_tw);
 
  441          if ($result === -2) {
 
  443            $errorforwarehouset = 1;
 
  444            $langs->load(
"errors");
 
  445            setEventMessages($langs->trans(
"ErrorMultipleRecordFoundFromRef", $tmp_id_tw), 
null, 
'errors');
 
  446          } elseif ($result <= 0) {
 
  448            $errorforwarehouset = 1;
 
  449            $langs->load(
"errors");
 
  450            setEventMessages($langs->trans(
"ErrorRefNotFound", $tmp_id_tw), 
null, 
'errors');
 
  452          $tmp_id_tw = $result;
 
  454        $data[$i][1][
'val'] = $tmp_id_tw;
 
  455        if (!$errorforwarehouset && !($tmp_id_tw > 0)) {
 
  457          setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"WarehouseTarget")), 
null, 
'errors');
 
  461        if ($tmp_id_sw > 0 && $tmp_id_tw == $tmp_id_sw) {
 
  463          $langs->load(
"errors");
 
  464          setEventMessages($langs->trans(
"ErrorWarehouseMustDiffers"), 
null, 
'errors');
 
  468          setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Qty")), 
null, 
'errors');
 
  473          $producttmp = 
new Product($db);
 
  474          $producttmp->fetch($tmp_id_product);
 
  475          if ($producttmp->hasbatch()) {
 
  476            if (empty($tmp_batch)) {
 
  478              $langs->load(
"errors");
 
  479              setEventMessages($langs->trans(
"ErrorTryToMakeMoveOnProductRequiringBatchData", $producttmp->ref), 
null, 
'errors');
 
  488        foreach ($data as $key => $value) {
 
  489          if (count(array_keys($listofdata)) > 0) {
 
  490            $id = max(array_keys($listofdata)) + 1;
 
  494          $tmp_id_sw = $data[$key][0][
'val'];
 
  495          $tmp_id_tw = $data[$key][1][
'val'];
 
  496          $tmp_id_product = $data[$key][2][
'val'];
 
  497          $tmp_qty = $data[$key][3][
'val'];
 
  498          $tmp_batch = $data[$key][4][
'val'];
 
  499          $listofdata[$key] = array(
'id'=>$key, 
'id_sw'=>$tmp_id_sw, 
'id_tw'=>$tmp_id_tw, 
'id_product'=>$tmp_id_product, 
'qty'=>$tmp_qty, 
'batch'=>$tmp_batch);
 
  505    $listofdata = array();
 
  508  $_SESSION[
'massstockmove'] = json_encode($listofdata);
 
  511if ($action == 
'confirm_deletefile' && $confirm == 
'yes') {
 
  512  $langs->load(
"other");
 
  514  $param = 
'&datatoimport='.urlencode($datatoimport).
'&format='.urlencode($format);
 
  515  if ($excludefirstline) {
 
  516    $param .= 
'&excludefirstline='.urlencode($excludefirstline);
 
  519    $param .= 
'&endatlinenb='.urlencode($endatlinenb);
 
  522  $file = $conf->stock->dir_temp.
'/'.
GETPOST(
'urlfile'); 
 
  529  Header(
'Location: '.$_SERVER[
"PHP_SELF"]);
 
  541$form = 
new Form($db);
 
  543$productstatic = 
new Product($db);
 
  544$warehousestatics = 
new Entrepot($db);
 
  545$warehousestatict = 
new Entrepot($db);
 
  547$help_url = 
'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks|DE:Modul_Bestände';
 
  549$title = $langs->trans(
'MassMovement');
 
  553print 
load_fiche_titre($langs->trans(
"MassStockTransferShort"), 
'', 
'stock');
 
  555$titletoadd = $langs->trans(
"Select");
 
  556$buttonrecord = $langs->trans(
"RecordMovements");
 
  557$titletoaddnoent = $langs->transnoentitiesnoconv(
"Select");
 
  558$buttonrecordnoent = $langs->transnoentitiesnoconv(
"RecordMovements");
 
  559print 
'<span class="opacitymedium">'.$langs->trans(
"SelectProductInAndOutWareHouse", $titletoaddnoent, $buttonrecordnoent).
'</span>';
 
  565print 
'<form name="userfile" action="'.$_SERVER[
"PHP_SELF"].
'" enctype="multipart/form-data" METHOD="POST">';
 
  566print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  567print 
'<input type="hidden" name="action" value="importCSV">';
 
  568if (!empty($conf->dol_optimize_smallscreen)) {
 
  571print 
'<span class="opacitymedium">';
 
  572print $langs->trans(
"or");
 
  574$importcsv = 
new ImportCsv($db, 
'massstocklist');
 
  575print $form->textwithpicto($langs->trans(
'SelectAStockMovementFileToImport'), $langs->transnoentitiesnoconv(
"InfoTemplateImport", $importcsv->separator));
 
  579$maxmin = $maxfilesizearray[
'maxmin'];
 
  581  print 
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';  
 
  583print 
'<input type="file" name="userfile" size="20" maxlength="80">     ';
 
  585print 
'<input type="submit" class="button small smallpaddingimp" value="'.$langs->trans(
"ImportFromCSV").
'"'.$out.
' name="sendit">';
 
  588  $max = $conf->global->MAIN_UPLOAD_DOC; 
 
  589  $maxphp = @ini_get(
'upload_max_filesize'); 
 
  590  if (preg_match(
'/k$/i', $maxphp)) {
 
  591    $maxphp = preg_replace(
'/k$/i', 
'', $maxphp);
 
  592    $maxphp = $maxphp * 1;
 
  594  if (preg_match(
'/m$/i', $maxphp)) {
 
  595    $maxphp = preg_replace(
'/m$/i', 
'', $maxphp);
 
  596    $maxphp = $maxphp * 1024;
 
  598  if (preg_match(
'/g$/i', $maxphp)) {
 
  599    $maxphp = preg_replace(
'/g$/i', 
'', $maxphp);
 
  600    $maxphp = $maxphp * 1024 * 1024;
 
  602  if (preg_match(
'/t$/i', $maxphp)) {
 
  603    $maxphp = preg_replace(
'/t$/i', 
'', $maxphp);
 
  604    $maxphp = $maxphp * 1024 * 1024 * 1024;
 
  606  $maxphp2 = @ini_get(
'post_max_size'); 
 
  607  if (preg_match(
'/k$/i', $maxphp2)) {
 
  608    $maxphp2 = preg_replace(
'/k$/i', 
'', $maxphp2);
 
  609    $maxphp2 = $maxphp2 * 1;
 
  611  if (preg_match(
'/m$/i', $maxphp2)) {
 
  612    $maxphp2 = preg_replace(
'/m$/i', 
'', $maxphp2);
 
  613    $maxphp2 = $maxphp2 * 1024;
 
  615  if (preg_match(
'/g$/i', $maxphp2)) {
 
  616    $maxphp2 = preg_replace(
'/g$/i', 
'', $maxphp2);
 
  617    $maxphp2 = $maxphp2 * 1024 * 1024;
 
  619  if (preg_match(
'/t$/i', $maxphp2)) {
 
  620    $maxphp2 = preg_replace(
'/t$/i', 
'', $maxphp2);
 
  621    $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
 
  625  $maxphptoshow = $maxphptoshowparam = 
'';
 
  627    $maxmin = min($max, $maxphp);
 
  628    $maxphptoshow = $maxphp;
 
  629    $maxphptoshowparam = 
'upload_max_filesize';
 
  632    $maxmin = min($max, $maxphp2);
 
  633    if ($maxphp2 < $maxphp) {
 
  634      $maxphptoshow = $maxphp2;
 
  635      $maxphptoshowparam = 
'post_max_size';
 
  639  $langs->load(
'other');
 
  641  $out .= 
info_admin($langs->trans(
"ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
 
  643  $out .= 
' ('.$langs->trans(
"UploadDisabled").
')';
 
  652print 
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire">';
 
  653print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  654print 
'<input type="hidden" name="action" value="addline">';
 
  657print 
'<div class="div-table-responsive-no-min">';
 
  658print 
'<table class="liste centpercent">';
 
  662print 
'<tr class="liste_titre">';
 
  663print 
getTitleFieldOfList($langs->trans(
'WarehouseSource'), 0, $_SERVER[
"PHP_SELF"], 
'', $param, 
'', 
'', $sortfield, $sortorder, 
'tagtd maxwidthonsmartphone ');
 
  664print 
getTitleFieldOfList($langs->trans(
'WarehouseTarget'), 0, $_SERVER[
"PHP_SELF"], 
'', $param, 
'', 
'', $sortfield, $sortorder, 
'tagtd maxwidthonsmartphone ');
 
  665print 
getTitleFieldOfList($langs->trans(
'Product'), 0, $_SERVER[
"PHP_SELF"], 
'', $param, 
'', 
'', $sortfield, $sortorder, 
'tagtd maxwidthonsmartphone ');
 
  666if (isModEnabled(
'productbatch')) {
 
  667  print 
getTitleFieldOfList($langs->trans(
'Batch'), 0, $_SERVER[
"PHP_SELF"], 
'', $param, 
'', 
'', $sortfield, $sortorder, 
'tagtd maxwidthonsmartphone ');
 
  669print 
getTitleFieldOfList($langs->trans(
'Qty'), 0, $_SERVER[
"PHP_SELF"], 
'', $param, 
'', 
'', $sortfield, $sortorder, 
'right tagtd maxwidthonsmartphone ');
 
  673print 
'<tr class="oddeven">';
 
  675print 
'<td class="nowraponall">';
 
  676print 
img_picto($langs->trans(
"WarehouseSource"), 
'stock', 
'class="paddingright"').$formproduct->selectWarehouses($id_sw, 
'id_sw', 
'warehouseopen,warehouseinternal', 1, 0, 0, 
'', 0, 0, array(), 
'minwidth200imp maxwidth200');
 
  679print 
'<td class="nowraponall">';
 
  680print 
img_picto($langs->trans(
"WarehouseTarget"), 
'stock', 
'class="paddingright"').$formproduct->selectWarehouses($id_tw, 
'id_tw', 
'warehouseopen,warehouseinternal', 1, 0, 0, 
'', 0, 0, array(), 
'minwidth200imp maxwidth200');
 
  683print 
'<td class="nowraponall">';
 
  691  $limit = $conf->global->PRODUIT_LIMIT_SIZE;
 
  694print 
img_picto($langs->trans(
"Product"), 
'product', 
'class="paddingright"');
 
  695print $form->select_produits($id_product, 
'productid', $filtertype, $limit, 0, -1, 2, 
'', 1, array(), 0, 
'1', 0, 
'minwidth200imp maxwidth300', 1, 
'', 
null, 1);
 
  698if (isModEnabled(
'productbatch')) {
 
  699  print 
'<td class="nowraponall">';
 
  700  print 
img_picto($langs->trans(
"LotSerial"), 
'lot', 
'class="paddingright"');
 
  701  print 
'<input type="text" name="batch" class="flat maxwidth75" value="'.dol_escape_htmltag($batch).
'">';
 
  705print 
'<td class="right"><input type="text" class="flat maxwidth50 right" name="qty" value="'.price2num((
float) $qty, 
'MS').
'"></td>';
 
  707print 
'<td class="right"><input type="submit" class="button" name="addline" value="'.dol_escape_htmltag($titletoadd).
'"></td>';
 
  711foreach ($listofdata as $key => $val) {
 
  712  $productstatic->id = 0;
 
  713  $productstatic->fetch($val[
'id_product']);
 
  715  $warehousestatics->id = 0;
 
  716  if ($val[
'id_sw'] > 0) {
 
  717    $warehousestatics->fetch($val[
'id_sw']);
 
  719  $warehousestatict->id = 0;
 
  720  if ($val[
'id_tw'] > 0) {
 
  721    $warehousestatict->fetch($val[
'id_tw']);
 
  724  if ($productstatic->id <= 0) {
 
  726    setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"Product").
' (id='.$val[
'id_product'].
')'), 
null, 
'errors');
 
  728  if ($warehousestatics->id < 0) {  
 
  730    setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"WarehouseSource").
' (id='.$val[
'id_sw'].
')'), 
null, 
'errors');
 
  732  if ($warehousestatict->id <= 0) {
 
  734    setEventMessages($langs->trans(
"ObjectNotFound", $langs->transnoentitiesnoconv(
"WarehouseTarget").
' (id='.$val[
'id_tw'].
')'), 
null, 
'errors');
 
  738    print 
'<tr class="oddeven">';
 
  740    if ($warehousestatics->id > 0) {
 
  741      print $warehousestatics->getNomUrl(1);
 
  743      print 
'<span class="opacitymedium">';
 
  744      print $langs->trans(
"None");
 
  749    print $warehousestatict->getNomUrl(1);
 
  754    if (isModEnabled(
'productbatch')) {
 
  759    print 
'<td class="right">'.price2num((
float) $val[
'qty'], 
'MS').
'</td>';
 
  760    print 
'<td class="right"><a href="'.$_SERVER[
"PHP_SELF"].
'?action=delline&token='.newToken().
'&idline='.$val[
'id'].
'">'.
img_delete($langs->trans(
"Remove")).
'</a></td>';
 
  773if (count($listofdata)) {
 
  774  print 
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="formulaire2" class="formconsumeproduce">';
 
  775  print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  776  print 
'<input type="hidden" name="action" value="createmovements">';
 
  780  $labelmovement = 
GETPOST(
"label") ? 
GETPOST(
'label') : $langs->trans(
"MassStockTransferShort").
' '.
dol_print_date($now, 
'%Y-%m-%d %H:%M');
 
  782  print 
'<div class="center">';
 
  783  print 
'<span class="fieldrequired">'.$langs->trans(
"InventoryCode").
':</span> ';
 
  784  print 
'<input type="text" name="codemove" class="maxwidth300" value="'.dol_escape_htmltag($codemove).
'">   ';
 
  785  print 
'<span class="clearbothonsmartphone"></span>';
 
  786  print $langs->trans(
"MovementLabel").
': ';
 
  787  print 
'<input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag($labelmovement).
'"><br>';
 
  790  print 
'<div class="center"><input type="submit" class="button" name="valid" value="'.dol_escape_htmltag($buttonrecord).
'"></div>';
 
  798if ($action == 
'delete') {
 
  799  print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?urlfile='.urlencode(
GETPOST(
'urlfile')).
'&step=3'.$param, $langs->trans(
'DeleteFile'), $langs->trans(
'ConfirmDeleteFile'), 
'confirm_deletefile', 
'', 0, 1);
 
  816  $length = strlen($needle);
 
  817  return substr($haystack, 0, $length) === $needle;
 
 
  830    $tmp_ref = str_replace(
'ref:', 
'', $tmp_ref);
 
  832  $static_object->id = 0;
 
  833  $static_object->fetch(
'', $tmp_ref);
 
  834  return $static_object->id;
 
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
Class to manage warehouses.
 
Class to import CSV files.
 
Class to manage products or services.
 
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
 
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
 
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
 
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
 
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
 
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
dol_now($mode='auto')
Return date for now.
 
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
 
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
 
startsWith($haystack, $needle)
Verify if $haystack startswith $needle.
 
fetchref($static_object, $tmp_ref)
Fetch object with ref.
 
getMaxFileSizeArray()
Return the max allowed for file upload.
 
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.