diff --git a/ChangeLog b/ChangeLog index 5e64a55d663..f12ae4745c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6 compared to 3.5.* ***** For users: +- New: Can input barcode during product creation step. - New: Can create contract from an order. - New: Add list of orders products in tab "consumption" on thirdparties. - New: Add graph stats for suppliers orders in tab "stats" on products. diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a71091ce7f5..63de9fea334 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -361,7 +361,6 @@ class Product extends CommonObject if ($this->update($id, $user, true, 'add') <= 0) { $error++; - $this->error='ErrorFailedToUpdateRecord'; } } else @@ -472,6 +471,9 @@ class Product extends CommonObject $sql.= ", localtax1_tx = " . $this->localtax1_tx; $sql.= ", localtax2_tx = " . $this->localtax2_tx; + $sql.= ", barcode = ". (empty($this->barcode)?"null":"'".$this->db->escape($this->barcode)."'"); + $sql.= ", fk_barcode_type = ". (empty($this->barcode_type)?"null":$this->db->escape($this->barcode_type)); + $sql.= ", tosell = " . $this->status; $sql.= ", tobuy = " . $this->status_buy; $sql.= ", finished = " . ((empty($this->finished) || $this->finished < 0) ? "null" : $this->finished); diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index ec2dc29fd79..ef6a94a30b1 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -181,10 +181,14 @@ if (empty($reshook)) $object->type = $type; $object->status = GETPOST('statut'); $object->status_buy = GETPOST('statut_buy'); + + $object->barcode_type = GETPOST('fk_barcode_type'); + $object->barcode = GETPOST('barcode'); + $object->description = dol_htmlcleanlastbr(GETPOST('desc')); $object->note = dol_htmlcleanlastbr(GETPOST('note')); - $object->customcode = GETPOST('customcode'); - $object->country_id = GETPOST('country_id'); + $object->customcode = GETPOST('customcode'); + $object->country_id = GETPOST('country_id'); $object->duration_value = GETPOST('duration_value'); $object->duration_unit = GETPOST('duration_unit'); $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0; @@ -698,7 +702,7 @@ else $tmpcode=''; if (! empty($modCodeProduct->code_auto)) $tmpcode=$modCodeProduct->getNextValue($object,$type); - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; if ($_error) { print $langs->trans("RefAlreadyExists"); @@ -706,28 +710,59 @@ else print ''; // Label - print ''.$langs->trans("Label").''; + print ''.$langs->trans("Label").''; // On sell - print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'; $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); print $form->selectarray('statut',$statutarray,GETPOST('statut')); print ''; // To buy - print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'; $statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy")); print $form->selectarray('statut_buy',$statutarray,GETPOST('statut_buy"')); print ''; + $showbarcode=(! empty($conf->barcode->enabled) && $user->rights->barcode->lire); + + if ($showbarcode) + { + print ''.$langs->trans('BarcodeType').''; + if (isset($_POST['fk_barcode_type'])) + { + $fk_barcode_type=GETPOST('fk_barcode_type'); + } + else + { + if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; + } + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; + $formbarcode = new FormBarCode($db); + print $formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1); + print ''.$langs->trans("BarcodeValue").''; + $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; + //if (empty($tmpcode) $tmpcode=$modBarCodeProduct->getNextValue($object,0); + print ''; + print ''; + } + + // Description (used in invoice, propal...) + print ''.$langs->trans("Description").''; + + $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 90); + $doleditor->Create(); + + print ""; + // Stock min level if ($type != 1 && ! empty($conf->stock->enabled)) { print ''.$langs->trans("StockLimit").''; print ''; - print ''; + print ''; // Stock desired level - print ''.$langs->trans("DesiredStock").''; + print ''.$langs->trans("DesiredStock").''; print ''; print ''; } @@ -737,18 +772,10 @@ else print ''; } - // Description (used in invoice, propal...) - print ''.$langs->trans("Description").''; - - $doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 90); - $doleditor->Create(); - - print ""; - // Nature if ($type != 1) { - print ''.$langs->trans("Nature").''; + print ''.$langs->trans("Nature").''; $statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); print $form->selectarray('finished',$statutarray,GETPOST('finished'),1); print ''; @@ -757,7 +784,7 @@ else // Duration if ($type == 1) { - print ''.$langs->trans("Duration").'  '; + print ''.$langs->trans("Duration").'  '; print ''.$langs->trans("Hour").' '; print ''.$langs->trans("Day").' '; print ''.$langs->trans("Week").' '; @@ -769,38 +796,37 @@ else if ($type != 1) // Le poids et le volume ne concerne que les produits et pas les services { // Weight - print ''.$langs->trans("Weight").''; + print ''.$langs->trans("Weight").''; print ''; print $formproduct->select_measuring_units("weight_units","weight"); print ''; // Length - print ''.$langs->trans("Length").''; + print ''.$langs->trans("Length").''; print ''; print $formproduct->select_measuring_units("size_units","size"); print ''; // Surface - print ''.$langs->trans("Surface").''; + print ''.$langs->trans("Surface").''; print ''; print $formproduct->select_measuring_units("surface_units","surface"); print ''; // Volume - print ''.$langs->trans("Volume").''; + print ''.$langs->trans("Volume").''; print ''; print $formproduct->select_measuring_units("volume_units","volume"); print ''; } // Customs code - print ''.$langs->trans("CustomCode").''; - + print ''.$langs->trans("CustomCode").''; // Origin country - print ''.$langs->trans("CountryOrigin").''; + print ''.$langs->trans("CountryOrigin").''; print $form->select_country(GETPOST('country_id','int'),'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print ''; // Other attributes - $parameters=array('colspan' => ' colspan="2"'); + $parameters=array('colspan' => ' colspan="3"'); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook) && ! empty($extrafields->attribute_label)) { @@ -808,10 +834,10 @@ else } // Note (private, no output on invoices, propales...) - print ''.$langs->trans("NoteNotVisibleOnBill").''; + print ''.$langs->trans("NoteNotVisibleOnBill").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('note', GETPOST('note'), '', 180, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70); + $doleditor = new DolEditor('note', GETPOST('note'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70); $doleditor->Create(); print ""; @@ -881,13 +907,13 @@ else print ''; // Ref - print ''; + print ''; // Label - print ''; + print ''; // Status - print ''; // To Buy - print ''; // Description (used in invoice, propal...) - print '"; print "\n"; - // Nature - if($object->type!=1) - { - print ''; - } - + // Stock if ($object->isproduct() && ! empty($conf->stock->enabled)) { - print "".'".''; + print ''; - print "".''; } @@ -953,10 +971,19 @@ else print ''; } + // Nature + if($object->type!=1) + { + print ''; + } + if ($object->isservice()) { // Duration - print ''; // Length - print ''; // Surface - print ''; // Volume - print ''; } // Customs code - print ''; - + print ''; // Origin country - print ''; @@ -1012,9 +1038,9 @@ else } // Note - print '"; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 77d00d0e921..cb5d2dfb1bc 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -794,7 +794,6 @@ else $s=$modCodeClient->getToolTip($langs,$object,0); print $form->textwithpicto('',$s,1); print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; + print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; + print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; print '
'.$langs->trans("Description").''; + print '
'.$langs->trans("Description").''; // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 90); + $doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); $doleditor->Create(); print "
'.$langs->trans("Nature").''; - $statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); - print $form->selectarray('finished',$statutarray,$object->finished); - print '
'.$langs->trans("StockLimit").''; + print "
'.$langs->trans("StockLimit").''; print ''; - print '
'.$langs->trans("DesiredStock").''; + print ''.$langs->trans("DesiredStock").''; print ''; print '
'.$langs->trans("Nature").''; + $statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); + print $form->selectarray('finished',$statutarray,$object->finished); + print '
'.$langs->trans("Duration").''; + print '
'.$langs->trans("Duration").''; print '  '; print 'duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); print '  '; @@ -973,32 +1000,31 @@ else else { // Weight - print '
'.$langs->trans("Weight").''; + print '
'.$langs->trans("Weight").''; print ' '; print $formproduct->select_measuring_units("weight_units", "weight", $object->weight_units); print '
'.$langs->trans("Length").''; + print '
'.$langs->trans("Length").''; print ' '; print $formproduct->select_measuring_units("size_units", "size", $object->length_units); print '
'.$langs->trans("Surface").''; + print '
'.$langs->trans("Surface").''; print ' '; print $formproduct->select_measuring_units("surface_units", "surface", $object->surface_units); print '
'.$langs->trans("Volume").''; + print '
'.$langs->trans("Volume").''; print ' '; print $formproduct->select_measuring_units("volume_units", "volume", $object->volume_units); print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; + print ''.$langs->trans("CountryOrigin").''; print $form->select_country($object->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); print '
'.$langs->trans("NoteNotVisibleOnBill").''; + print '
'.$langs->trans("NoteNotVisibleOnBill").''; - $doleditor = new DolEditor('note', $object->note, '', 200, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70); + $doleditor = new DolEditor('note', $object->note, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 80); $doleditor->Create(); print "
'; - print ''; if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire))