Merge remote-tracking branch 'Dolibarr/develop' into 14
This commit is contained in:
commit
62bee01002
@ -15,7 +15,7 @@ NEW: Add a performance center page with all information and advices related to t
|
||||
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
|
||||
NEW: All main menu entries are using the picto of the module
|
||||
NEW: Add a copy to clipboard button on some fields
|
||||
NEW: Add an example of scheduled job to send email reminder for unpayed invoices
|
||||
NEW: Add an example of scheduled job to send email reminder for unpaid invoices
|
||||
NEW: Can make massive stock transfers from a CSV file.
|
||||
NEW: Accountancy - Add FEC import
|
||||
NEW: Accountancy - Add a confirmation form with options on export
|
||||
@ -34,7 +34,7 @@ NEW: Add some company information in the dropdown login menu
|
||||
NEW: Add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug"
|
||||
NEW: Add contact tag and bulk email status on the thirparty+contact create form
|
||||
NEW: Add db fields note_public and note_private for ECM module
|
||||
NEW: Manage deposit on supplier invoice (& somes ajustments)
|
||||
NEW: Support down payment on supplier invoice (& somes ajustments)
|
||||
NEW: Add edit/delete action icons on categories list pages
|
||||
NEW: Add hidden option to auto load input line extrafield into new lines
|
||||
NEW: Add import profile to import BOM
|
||||
@ -73,8 +73,8 @@ NEW: Can toggle FCKeditor on public/private notes
|
||||
NEW: Can use captcha on public page to create a ticket
|
||||
NEW: Check update availability for externals modules using a button on module page
|
||||
NEW: Choose lines to use while creating intervention card from origin
|
||||
NEW: Column shippement method, payment mode, payment term in proposal and order list
|
||||
NEW: Conf for default actiomm status
|
||||
NEW: Column shipment method, payment mode, payment term in proposal and order list
|
||||
NEW: Conf for default actioncomm status
|
||||
NEW: customer ref for product customer prices
|
||||
NEW: date and user signature on proposal (Issue 16062)
|
||||
NEW: Dictionary for availability - Add a column position
|
||||
|
||||
@ -61,7 +61,7 @@ if (empty($user->rights->compta->resultat->lire) && empty($user->rights->account
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$zone = GETPOST('areacode', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
|
||||
@ -52,7 +52,7 @@ $result = restrictedArea($user, 'adherent');
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$zone = GETPOST('areacode', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
|
||||
@ -115,7 +115,7 @@ if ($action == 'add') {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
||||
$sql .= "box_id, position, box_order, fk_user, entity";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= $boxid['value'].", ".((int) $pos).", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
|
||||
$sql .= ((int) $boxid['value']).", ".((int) $pos).", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".((int) $fk_user).", ".$conf->entity;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog("boxes.php activate box", LOG_DEBUG);
|
||||
@ -149,11 +149,6 @@ if ($action == 'delete') {
|
||||
if (!empty($obj->box_id)) {
|
||||
$db->begin();
|
||||
|
||||
// Remove all personalized setup when a box is activated or disabled (why removing all ? We removed only removed boxes)
|
||||
// $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param";
|
||||
// $sql.= " WHERE param LIKE 'MAIN_BOXES_%'";
|
||||
// $resql = $db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " AND box_id=".((int) $obj->box_id);
|
||||
@ -184,6 +179,7 @@ if ($action == 'switch') {
|
||||
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
|
||||
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid);
|
||||
dol_syslog($sql);
|
||||
$resultupdatefrom = $db->query($sql);
|
||||
|
||||
@ -76,7 +76,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".get_exdir(0, 0, 0, 1, $object);
|
||||
$upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/".get_exdir(0, 0, 0, 1, $object);
|
||||
}
|
||||
|
||||
// Security check - Protection if external user
|
||||
@ -152,7 +152,7 @@ if ($object->id) {
|
||||
$param = '&id='.$object->id;
|
||||
|
||||
//$relativepathwithnofile='bom/' . dol_sanitizeFileName($object->id).'/';
|
||||
$relativepathwithnofile = 'bom/'.dol_sanitizeFileName($object->ref).'/';
|
||||
$relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
} else {
|
||||
|
||||
@ -97,45 +97,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$linkback = '<a href="'.dol_buildpath('/bom/bom_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
/*
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->bom->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref.=' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
||||
|
||||
@ -4153,20 +4153,23 @@ class Facture extends CommonInvoice
|
||||
// $sql.= " AND (f.paye = 1"; // Classee payee completement
|
||||
// $sql.= " OR f.close_code IS NOT NULL)"; // Classee payee partiellement
|
||||
$sql .= " AND ff.type IS NULL"; // Renvoi vrai si pas facture de remplacement
|
||||
$sql .= " AND f.type != ".self::TYPE_CREDIT_NOTE; // Type non 2 si facture non avoir
|
||||
$sql .= " AND f.type <> ".self::TYPE_CREDIT_NOTE; // Exclude credit note invoices from selection
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE)) {
|
||||
// Select the last situation invoice
|
||||
$sqlSit = 'SELECT MAX(fs.rowid)';
|
||||
$sqlSit .= " FROM ".MAIN_DB_PREFIX."facture as fs";
|
||||
$sqlSit .= " WHERE fs.entity IN (".getEntity('invoice').")";
|
||||
$sqlSit .= " AND fs.type = ".self::TYPE_SITUATION;
|
||||
$sqlSit .= " AND fs.fk_statut in (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")";
|
||||
$sqlSit .= " GROUP BY fs.situation_cycle_ref";
|
||||
$sqlSit .= " ORDER BY fs.situation_counter";
|
||||
$sql .= " AND ( f.type != ".self::TYPE_SITUATION." OR f.rowid IN (".$this->db->sanitize($sqlSit).") )"; // Type non 5 si facture non avoir
|
||||
// Keep invoices that are not situation invoices or that are the last in serie if it is a situation invoice
|
||||
$sql .= " AND (f.type <> ".self::TYPE_SITUATION." OR f.rowid IN ";
|
||||
$sql .= '(SELECT MAX(fs.rowid)'; // This select returns several ID becasue of the group by later
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as fs";
|
||||
$sql .= " WHERE fs.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND fs.type = ".self::TYPE_SITUATION;
|
||||
$sql .= " AND fs.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_CLOSED.")";
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND fs.fk_soc = ".((int) $socid);
|
||||
}
|
||||
$sql .= " GROUP BY fs.situation_cycle_ref)"; // For each situation_cycle_ref, we take the higher rowid
|
||||
$sql .= ")";
|
||||
} else {
|
||||
$sql .= " AND f.type != ".self::TYPE_SITUATION; // Type non 5 si facture non avoir
|
||||
$sql .= " AND f.type <> ".self::TYPE_SITUATION; // Keep invoices that are not situation invoices
|
||||
}
|
||||
|
||||
if ($socid > 0) {
|
||||
|
||||
@ -137,7 +137,7 @@ if ($action == 'add') {
|
||||
|
||||
// Check reserved keyword with more than 3 characters
|
||||
if (!$error) {
|
||||
if (in_array(GETPOST('attrname', 'aZ09'), array('and', 'keyword', 'table', 'index', 'integer', 'float', 'double', 'position'))) {
|
||||
if (in_array(GETPOST('attrname', 'aZ09'), array('and', 'keyword', 'table', 'index', 'int', 'integer', 'float', 'double', 'real', 'position'))) {
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$mesg[] = $langs->trans("ErrorReservedKeyword", GETPOST('attrname', 'aZ09'));
|
||||
|
||||
@ -712,7 +712,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
|
||||
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
|
||||
// If we build one invoice for several order, we must put the invoice of order on the line
|
||||
// If we build one invoice for several orders, we must put the ref of order on the invoice line
|
||||
if (!empty($createbills_onebythird)) {
|
||||
$desc = dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day'));
|
||||
}
|
||||
@ -772,6 +772,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$objecttmp->context['createfromclone'];
|
||||
|
||||
$result = $objecttmp->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
|
||||
@ -2215,7 +2215,11 @@ class ExtraFields
|
||||
continue; // Value was not provided, we should not set it.
|
||||
}
|
||||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
|
||||
$value_key = price2num($value_arr);
|
||||
if ($keysuffix != 'search_') { // If value is for a search, we must keep complex string like '>100 <=150'
|
||||
$value_key = price2num($value_arr);
|
||||
} else {
|
||||
$value_key = $value_arr;
|
||||
}
|
||||
} else {
|
||||
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
|
||||
continue; // Value was not provided, we should not set it.
|
||||
|
||||
@ -85,7 +85,7 @@ class InfoBox
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $mode 'available' or 'activated'
|
||||
* @param string $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...)
|
||||
* @param int $zone Name or area (-1 for all, 0 for Homepage, 1 for Accountancy, 2 for xxx, ...)
|
||||
* @param User|null $user Object user to filter
|
||||
* @param array $excludelist Array of box id (box.box_id = boxes_def.rowid) to exclude
|
||||
* @param int $includehidden Include also hidden boxes
|
||||
@ -97,7 +97,6 @@ class InfoBox
|
||||
|
||||
$boxes = array();
|
||||
|
||||
$confuserzone = 'MAIN_BOXES_'.$zone;
|
||||
if ($mode == 'activated') { // activated
|
||||
$sql = "SELECT b.rowid, b.position, b.box_order, b.fk_user,";
|
||||
$sql .= " d.rowid as box_id, d.file, d.note, d.tms";
|
||||
@ -217,7 +216,7 @@ class InfoBox
|
||||
* Save order of boxes for area and user
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $zone Name of area (0 for Homepage, ...)
|
||||
* @param int $zone Name of area (0 for Homepage, ...)
|
||||
* @param string $boxorder List of boxes with correct order 'A:123,456,...-B:789,321...'
|
||||
* @param int $userid Id of user
|
||||
* @return int <0 if KO, 0=Nothing done, > 0 if OK
|
||||
@ -278,14 +277,13 @@ class InfoBox
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes";
|
||||
$sql .= "(box_id, position, box_order, fk_user, entity)";
|
||||
$sql .= " values (";
|
||||
$sql .= " ".$id.",";
|
||||
$sql .= " ".$zone.",";
|
||||
$sql .= " ".((int) $id).",";
|
||||
$sql .= " ".((int) $zone).",";
|
||||
$sql .= " '".$db->escape($colonne.$ii)."',";
|
||||
$sql .= " ".$userid.",";
|
||||
$sql .= " ".$conf->entity;
|
||||
$sql .= " ".((int) $userid).",";
|
||||
$sql .= " ".((int) $conf->entity);
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class()."::saveboxorder", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
||||
@ -263,73 +263,12 @@ class modWorkstation extends DolibarrModules
|
||||
$this->menu = array();
|
||||
$r = 0;
|
||||
// Add here entries to declare new menus
|
||||
/* BEGIN MODULEBUILDER TOPMENU */
|
||||
/*$this->menu[$r++] = array(
|
||||
'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'top', // This is a Top menu entry
|
||||
'titre'=>$langs->trans('GPAO'),
|
||||
'mainmenu'=>'gpao',
|
||||
'leftmenu'=>'',
|
||||
'url'=>'/workstation/workstationindex.php',
|
||||
'langs'=>'workstation@workstation', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000 + $r,
|
||||
'enabled'=>'$conf->workstation->enabled', // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->workstation->workstation->read' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);*/
|
||||
/* END MODULEBUILDER TOPMENU */
|
||||
/* BEGIN MODULEBUILDER LEFTMENU WORKSTATION
|
||||
$this->menu[$r++]=array(
|
||||
'fk_menu'=>'fk_mainmenu=workstation', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Top menu entry
|
||||
'titre'=>'Workstation',
|
||||
'mainmenu'=>'workstation',
|
||||
'leftmenu'=>'workstation',
|
||||
'url'=>'/workstation/workstationindex.php',
|
||||
'langs'=>'workstation@workstation', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->workstation->enabled', // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'$user->rights->workstation->workstation->read', // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
$this->menu[$r++]=array(
|
||||
'fk_menu'=>'fk_mainmenu=workstation,fk_leftmenu=workstation', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'List_Workstation',
|
||||
'mainmenu'=>'workstation',
|
||||
'leftmenu'=>'workstation_workstation_list',
|
||||
'url'=>'/workstation/workstation_list.php',
|
||||
'langs'=>'workstation@workstation', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->workstation->enabled', // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->rights->workstation->workstation->read', // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
$this->menu[$r++]=array(
|
||||
'fk_menu'=>'fk_mainmenu=workstation,fk_leftmenu=workstation', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'New_Workstation',
|
||||
'mainmenu'=>'workstation',
|
||||
'leftmenu'=>'workstation_workstation_new',
|
||||
'url'=>'/workstation/workstation_card.php?action=create',
|
||||
'langs'=>'workstation@workstation', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->workstation->enabled', // Define condition to show or hide menu entry. Use '$conf->workstation->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->rights->workstation->workstation->write', // Use 'perms'=>'$user->rights->workstation->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
|
||||
);
|
||||
*/
|
||||
|
||||
$this->menu[$r++]=array(
|
||||
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'fk_menu'=>'fk_mainmenu=mrp',
|
||||
// This is a Left menu entry
|
||||
'type'=>'left',
|
||||
'titre'=>$langs->trans('Workstations'),
|
||||
'titre'=>'Workstations',
|
||||
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'),
|
||||
'mainmenu'=>'mrp',
|
||||
'leftmenu'=>'workstation_workstation',
|
||||
@ -350,7 +289,7 @@ class modWorkstation extends DolibarrModules
|
||||
'fk_menu'=>'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
|
||||
// This is a Left menu entry
|
||||
'type'=>'left',
|
||||
'titre'=>$langs->trans('WorkstationCreate'),
|
||||
'titre'=>'WorkstationCreate',
|
||||
'mainmenu'=>'mrp',
|
||||
'leftmenu'=>'workstation_workstation_left_create',
|
||||
'url'=>'/workstation/workstation_card.php?action=create',
|
||||
@ -370,7 +309,7 @@ class modWorkstation extends DolibarrModules
|
||||
'fk_menu'=>'fk_mainmenu=mrp,fk_leftmenu=workstation_workstation',
|
||||
// This is a Left menu entry
|
||||
'type'=>'left',
|
||||
'titre'=>$langs->trans('List'),
|
||||
'titre'=>'List',
|
||||
'mainmenu'=>'mrp',
|
||||
'leftmenu'=>'workstation_workstation_left_list',
|
||||
'url'=>'/workstation/workstation_list.php',
|
||||
|
||||
@ -1930,7 +1930,7 @@ if ($action == 'create') {
|
||||
print $societe->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||
} else {
|
||||
print img_picto('', 'company').$form->select_company($societe->id, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
|
||||
print img_picto('', 'company').$form->select_company($societe->id, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx');
|
||||
// reload page to retrieve supplier informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@ -158,8 +158,8 @@ $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if ($catid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ppf.fk_soc = s.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product AND p.entity = ppf.entity";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ppf.fk_soc = s.rowid AND s.entity IN (".getEntity('societe').")";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
if ($sRefSupplier) {
|
||||
$sql .= natural_search('ppf.ref_fourn', $sRefSupplier);
|
||||
|
||||
@ -52,7 +52,7 @@ if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FO
|
||||
}
|
||||
if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$zone = GETPOST('areacode', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
@ -415,7 +415,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
|
||||
|
||||
$boxwork = '';
|
||||
$boxwork .= '<div class="box">';
|
||||
$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">'."\n";
|
||||
$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard centpercent">'."\n";
|
||||
$boxwork .= '<tr class="liste_titre">';
|
||||
$boxwork .= '<th class="liste_titre"><div class="inline-block valignmiddle">'.$langs->trans("DolibarrWorkBoard").'</div>';
|
||||
if ($showweather) {
|
||||
@ -797,7 +797,7 @@ function getWeatherStatus($totallate)
|
||||
$offset = 0;
|
||||
$factor = 10; // By default
|
||||
|
||||
$used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL';
|
||||
$used_conf = empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_LEVEL' : 'MAIN_METEO_PERCENTAGE_LEVEL';
|
||||
|
||||
$level0 = $offset;
|
||||
$weather->level = 0;
|
||||
|
||||
@ -32,6 +32,9 @@
|
||||
|
||||
-- Missing in v13 or lower
|
||||
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN note_private text AFTER fk_user_m;
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN note_public text AFTER note_private;
|
||||
|
||||
ALTER TABLE llx_accounting_bookkeeping DROP INDEX idx_accounting_bookkeeping_numero_compte;
|
||||
ALTER TABLE llx_accounting_bookkeeping DROP INDEX idx_accounting_bookkeeping_code_journal;
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the incl
|
||||
$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
|
||||
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
|
||||
$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1].'/myobject';
|
||||
|
||||
// Security check (enable the most restrictive one)
|
||||
//if ($user->socid > 0) accessforbidden();
|
||||
|
||||
@ -278,6 +278,71 @@ class Mos extends DolibarrApi
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Produce and consume
|
||||
*
|
||||
* Example:
|
||||
* {
|
||||
* "inventorylabel": "Produce and consume using API",
|
||||
* "inventorycode": "PRODUCEAPI-YY-MM-DD",
|
||||
* "autoclose": 1,
|
||||
* "arraytoconsume": [],
|
||||
* "arraytoproduce": []
|
||||
* }
|
||||
*
|
||||
* @param int $id ID of state
|
||||
* @param array $request_data Request datas
|
||||
*
|
||||
* @url POST {id}/produceandconsume
|
||||
*
|
||||
* @return int ID of MO
|
||||
*/
|
||||
public function produceAndConsume($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->mrp->write) {
|
||||
throw new RestException(401, 'Not enough permission');
|
||||
}
|
||||
$result = $this->mo->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'MO not found');
|
||||
}
|
||||
|
||||
if ($this->mo->status != Mo::STATUS_VALIDATED && $this->mo->status != Mo::STATUS_INPROGRESS) {
|
||||
throw new RestException(401, 'Error bad status of MO');
|
||||
}
|
||||
|
||||
$labelmovement = '';
|
||||
$codemovement = '';
|
||||
$autoclose = 1;
|
||||
$arraytoconsume = array();
|
||||
$arraytoproduce = array();
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'inventorylabel') {
|
||||
$labelmovement = $value;
|
||||
}
|
||||
if ($field == 'inventorycode') {
|
||||
$codemovement = $value;
|
||||
}
|
||||
if ($field == 'autoclose') {
|
||||
$autoclose = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($labelmovement)) {
|
||||
throw new RestException(500, "Field inventorylabel not prodivded");
|
||||
}
|
||||
if (empty($codemovement)) {
|
||||
throw new RestException(500, "Field inventorycode not prodivded");
|
||||
}
|
||||
|
||||
// TODO Add code for consume and produce...
|
||||
throw new RestException(500, "Feature not yet available");
|
||||
|
||||
return $this->mo->id;
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
|
||||
@ -74,7 +74,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
$upload_dir = $conf->mrp->multidir_output[$object->entity ? $object->entity : $conf->entity]."/mo/".get_exdir(0, 0, 0, 1, $object);
|
||||
$upload_dir = $conf->mrp->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object);
|
||||
}
|
||||
|
||||
// Security check - Protection if external user
|
||||
@ -184,7 +184,7 @@ if ($object->id) {
|
||||
$param = '&id='.$object->id;
|
||||
|
||||
//$relativepathwithnofile='mo/' . dol_sanitizeFileName($object->id).'/';
|
||||
$relativepathwithnofile = 'mo/'.dol_sanitizeFileName($object->ref).'/';
|
||||
$relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
} else {
|
||||
|
||||
@ -145,11 +145,11 @@ if (empty($reshook)) {
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
|
||||
if ($action == 'confirm_reopen') {
|
||||
if ($action == 'confirm_reopen' && $permissiontoadd) {
|
||||
$result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_REOPEN');
|
||||
}
|
||||
|
||||
if ($action == 'confirm_addconsumeline' && GETPOST('addconsumelinebutton')) {
|
||||
if ($action == 'confirm_addconsumeline' && GETPOST('addconsumelinebutton') && $permissiontoadd) {
|
||||
$moline = new MoLine($db);
|
||||
|
||||
// Line to produce
|
||||
@ -169,7 +169,7 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (in_array($action, array('confirm_consumeorproduce', 'confirm_consumeandproduceall'))) {
|
||||
if (in_array($action, array('confirm_consumeorproduce', 'confirm_consumeandproduceall')) && $permissiontoproduce) {
|
||||
$stockmove = new MouvementStock($db);
|
||||
|
||||
$labelmovement = GETPOST('inventorylabel', 'alphanohtml');
|
||||
|
||||
@ -1076,23 +1076,23 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (!empty($modCodeProduct->code_auto)) {
|
||||
$tmpcode = $modCodeProduct->getNextValue($object, $type);
|
||||
}
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input id="ref" name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alphanohtml') : $tmpcode).'">';
|
||||
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="ref" name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref', 'alphanohtml') : $tmpcode).'">';
|
||||
if ($refalreadyexists) {
|
||||
print $langs->trans("RefAlreadyExists");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label', $label_security_check)).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOST('label', $label_security_check)).'"></td></tr>';
|
||||
|
||||
// On sell
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
||||
$statutarray = array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
print $form->selectarray('statut', $statutarray, GETPOST('statut'));
|
||||
print '</td></tr>';
|
||||
|
||||
// To buy
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
||||
$statutarray = array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
||||
print $form->selectarray('statut_buy', $statutarray, GETPOST('statut_buy'));
|
||||
print '</td></tr>';
|
||||
@ -1102,7 +1102,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
|
||||
print $form->selectarray('status_batch', $statutarray, GETPOST('status_batch'));
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
// Product specific batch number management
|
||||
$status_batch = GETPOST('status_batch');
|
||||
if ($status_batch !== '0') {
|
||||
@ -1111,38 +1111,45 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$tooltip .= $langs->trans("GenericMaskCodes3");
|
||||
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch"));
|
||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||
print '<td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
|
||||
if (($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') || ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced')) {
|
||||
if (($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|
||||
|| ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced')) {
|
||||
print '<tr><td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
|
||||
$inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK;
|
||||
$inherited_mask_sn = $conf->global->SN_ADVANCED_MASK;
|
||||
print '<td id="field_mask">';
|
||||
print $form->textwithpicto('<input type="text" class="flat" size="24" name="batch_mask" id="batch_mask_input">', $tooltip, 1, 1);
|
||||
print '</td>';
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#field_mask, #mask_option").addClass("hideobject");
|
||||
$("#status_batch").on("change", function () {
|
||||
console.log("We change batch status");
|
||||
var optionSelected = $("option:selected", this);
|
||||
var valueSelected = this.value;
|
||||
$("#field_mask, #mask_option").addClass("hideobject");
|
||||
';
|
||||
if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') {
|
||||
print '
|
||||
if (this.value == 1) {
|
||||
$("#field_mask, #mask_option").toggleClass("hideobject");
|
||||
$("#batch_mask_input").val("'.$inherited_mask_lot.'");
|
||||
}
|
||||
';
|
||||
}
|
||||
if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced') {
|
||||
print '
|
||||
if (this.value == 2) {
|
||||
$("#field_mask, #mask_option").toggleClass("hideobject");
|
||||
$("#batch_mask_input").val("'.$inherited_mask_sn.'");
|
||||
}
|
||||
';
|
||||
}
|
||||
print '
|
||||
})
|
||||
})
|
||||
</script>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="2"></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$showbarcode = empty($conf->barcode->enabled) ? 0 : 1;
|
||||
@ -1163,9 +1170,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$formbarcode = new FormBarCode($db);
|
||||
print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
|
||||
print '</td>';
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
print '</tr><tr>';
|
||||
}
|
||||
print '</tr><tr>';
|
||||
print '<td>'.$langs->trans("BarcodeValue").'</td><td>';
|
||||
$tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode;
|
||||
if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
|
||||
@ -1176,7 +1181,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Description (used in invoice, propal...)
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
|
||||
$doleditor = new DolEditor('desc', GETPOST('desc', 'restricthtml'), '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
@ -1184,7 +1189,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</td></tr>";
|
||||
|
||||
// Public URL
|
||||
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
||||
print img_picto('', 'globe', 'class="pictofixedwidth"');
|
||||
print '<input type="text" name="url" class="quatrevingtpercent" value="'.GETPOST('url').'">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1192,7 +1198,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Default warehouse
|
||||
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
|
||||
print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse'), 'fk_default_warehouse', 'warehouseopen', 1);
|
||||
print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse', 'int'), 'fk_default_warehouse', 'warehouseopen', 1, 0, 0, '', 0, 0, array(), 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit').'">';
|
||||
print '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span>';
|
||||
print '</a>';
|
||||
@ -1203,11 +1209,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).'</td><td>';
|
||||
print '<input name="seuil_stock_alerte" class="maxwidth50" value="'.GETPOST('seuil_stock_alerte').'">';
|
||||
print '</td>';
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
print '</tr><tr>';
|
||||
}
|
||||
|
||||
print '</tr><tr>';
|
||||
|
||||
// Stock desired level
|
||||
print '<td>'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).'</td><td>';
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).'</td><td>';
|
||||
print '<input name="desiredstock" class="maxwidth50" value="'.GETPOST('desiredstock').'">';
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
@ -1217,7 +1223,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Duration
|
||||
if ($type == 1) {
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td>';
|
||||
print '<input name="duration_value" size="4" value="'.GETPOST('duration_value', 'int').'">';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", GETPOST('duration_value', 'alpha'), 0, 1);
|
||||
print '</td></tr>';
|
||||
@ -1225,20 +1231,20 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if ($type != 1) { // Nature, Weight and volume only applies to products and not to services
|
||||
// Nature
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td colspan="3">';
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
||||
$statutarray = array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||
print $form->selectarray('finished', $statutarray, GETPOST('finished', 'alpha'), 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Brut Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||
print '<input name="weight" size="4" value="'.GETPOST('weight').'">';
|
||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2);
|
||||
print '</td></tr>';
|
||||
|
||||
// Brut Length
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td>';
|
||||
print '<input name="size" class="width50" value="'.GETPOST('size').'"> x ';
|
||||
print '<input name="sizewidth" class="width50" value="'.GETPOST('sizewidth').'"> x ';
|
||||
print '<input name="sizeheight" class="width50" value="'.GETPOST('sizeheight').'">';
|
||||
@ -1247,14 +1253,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) {
|
||||
// Brut Surface
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||
print '<input name="surface" size="4" value="'.GETPOST('surface').'">';
|
||||
print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ?GETPOST('surface_units', 'alpha') : '0', 0, 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) {
|
||||
// Brut Volume
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||
print '<input name="volume" size="4" value="'.GETPOST('volume').'">';
|
||||
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ?GETPOST('volume_units', 'alpha') : '0', 0, 2);
|
||||
print '</td></tr>';
|
||||
@ -1262,7 +1268,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) {
|
||||
// Net Measure
|
||||
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td>';
|
||||
print '<input name="net_measure" size="4" value="'.GETPOST('net_measure').'">';
|
||||
print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0);
|
||||
print '</td></tr>';
|
||||
@ -1272,41 +1278,37 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Units
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<tr><td>'.$langs->trans('DefaultUnitToShow').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, 'units');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Custom code
|
||||
if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type)) {
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.GETPOST('customcode').'"></td></tr>';
|
||||
print '<tr><td class="wordbreak">'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.GETPOST('customcode').'"></td></tr>';
|
||||
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
|
||||
print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 widthcentpercentminusx');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
|
||||
// State
|
||||
if (empty($conf->global->PRODUCT_DISABLE_STATE)) {
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
print '</tr><tr>';
|
||||
}
|
||||
print '<tr>';
|
||||
if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) {
|
||||
print '<td>'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
print '<td>'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).'</td><td>';
|
||||
} else {
|
||||
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td>';
|
||||
}
|
||||
|
||||
print $formcompany->select_state($object->state_id, $object->country_code);
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Quality control
|
||||
@ -1316,7 +1318,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => 3, 'cols' => '3');
|
||||
$parameters = array('colspan' => ' colspan="2"', 'cols'=>2);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
@ -1326,7 +1328,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Note (private, no output on invoices, propales...)
|
||||
//if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode
|
||||
//{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
||||
|
||||
// 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_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_8, '90%');
|
||||
@ -1337,7 +1339,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if ($conf->categorie->enabled) {
|
||||
// Categories
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print "</td></tr>";
|
||||
@ -1385,6 +1387,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Accountancy codes
|
||||
print '<!-- accountancy codes -->'."\n";
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
@ -1396,7 +1399,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
} else {
|
||||
$accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_sell_intra
|
||||
@ -1408,7 +1411,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
} else {
|
||||
$accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1420,7 +1423,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
} else {
|
||||
$accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
@ -1431,7 +1434,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
} else {
|
||||
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
@ -1443,7 +1446,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
} else {
|
||||
$accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1455,10 +1458,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
} else {
|
||||
$accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1);
|
||||
print '</td></tr>';
|
||||
} else // For external software
|
||||
{
|
||||
} else {// For external software
|
||||
if (!empty($accountancy_code_sell)) {
|
||||
$object->accountancy_code_sell = $accountancy_code_sell;
|
||||
}
|
||||
@ -1480,36 +1482,36 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell" value="'.$object->accountancy_code_sell.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell_intra" value="'.$object->accountancy_code_sell_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_sell_export" value="'.$object->accountancy_code_sell_export.'">';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_sell_export" value="'.$object->accountancy_code_sell_export.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy" value="'.$object->accountancy_code_buy.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy_intra" value="'.$object->accountancy_code_buy_intra.'">';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_intra" value="'.$object->accountancy_code_buy_intra.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_buy_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth100" name="accountancy_code_buy_export" value="'.$object->accountancy_code_buy_export.'">';
|
||||
print '<td class="maxwidthonsmartphone"><input class="minwidth150" name="accountancy_code_buy_export" value="'.$object->accountancy_code_buy_export.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
@ -1609,14 +1611,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
|
||||
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
|
||||
print $form->selectarray('status_batch', $statutarray, $object->status_batch);
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
if ($object->status_batch !== '0') {
|
||||
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Batch"), $langs->transnoentities("Batch"));
|
||||
$tooltip .= $langs->trans("GenericMaskCodes2");
|
||||
$tooltip .= $langs->trans("GenericMaskCodes3");
|
||||
$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Batch"), $langs->transnoentities("Batch"));
|
||||
$tooltip .= $langs->trans("GenericMaskCodes5");
|
||||
print '<td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
|
||||
print '<tr><td id="mask_option">'.$langs->trans("ManageLotMask").'</td>';
|
||||
if ($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') {
|
||||
$mask = ! empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK;
|
||||
}
|
||||
@ -1627,7 +1629,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$inherited_mask_sn = $conf->global->SN_ADVANCED_MASK;
|
||||
print '<td id="field_mask">';
|
||||
print $form->textwithpicto('<input type="text" class="flat" size="24" name="batch_mask" id="batch_mask_input" value="'.$mask.'">', $tooltip, 1, 1);
|
||||
print '</td>';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
@ -1637,24 +1638,33 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$("#field_mask, #mask_option").toggleClass("hideobject");
|
||||
}
|
||||
$("#status_batch").on("change", function () {
|
||||
console.log("We change batch status");
|
||||
var optionSelected = $("option:selected", this);
|
||||
var valueSelected = this.value;
|
||||
$("#field_mask, #mask_option").addClass("hideobject");
|
||||
';
|
||||
if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') {
|
||||
print '
|
||||
if (this.value == 1) {
|
||||
$("#field_mask, #mask_option").toggleClass("hideobject");
|
||||
$("#batch_mask_input").val("'.$inherited_mask_lot.'");
|
||||
}
|
||||
';
|
||||
}
|
||||
if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced') {
|
||||
print '
|
||||
if (this.value == 2) {
|
||||
$("#field_mask, #mask_option").toggleClass("hideobject");
|
||||
$("#batch_mask_input").val("'.$inherited_mask_sn.'");
|
||||
}
|
||||
';
|
||||
}
|
||||
print '
|
||||
})
|
||||
})
|
||||
</script>';
|
||||
} else {
|
||||
print '<td colspan="2"></td>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1677,17 +1687,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
||||
$formbarcode = new FormBarCode($db);
|
||||
print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
|
||||
print '</td><td>'.$langs->trans("BarcodeValue").'</td><td>';
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("BarcodeValue").'</td><td>';
|
||||
$tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode;
|
||||
if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) {
|
||||
$tmpcode = $modBarCodeProduct->getNextValue($object, $fk_barcode_type);
|
||||
}
|
||||
print '<input size="40" class="maxwidthonsmartphone" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).'">';
|
||||
print '<input class="maxwidth150 maxwidthonsmartphone" type="text" name="barcode" value="'.dol_escape_htmltag($tmpcode).'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Description (used in invoice, propal...)
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
|
||||
// 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, ROWS_4, '90%');
|
||||
@ -1697,7 +1708,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "\n";
|
||||
|
||||
// Public Url
|
||||
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("PublicUrl").'</td><td>';
|
||||
print '<input type="text" name="url" class="quatrevingtpercent" value="'.$object->url.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1707,7 +1718,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
|
||||
print $formproduct->selectWarehouses($object->fk_default_warehouse, 'fk_default_warehouse', 'warehouseopen', 1);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF'].'?action=create&type='.GETPOST('type', 'int')).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>';
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
/*
|
||||
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td>';
|
||||
print '<input name="seuil_stock_alerte" size="4" value="'.$object->seuil_stock_alerte.'">';
|
||||
@ -1727,25 +1738,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if ($object->isService()) {
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td>';
|
||||
print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
// Nature
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td colspan="3">';
|
||||
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
|
||||
print $formproduct->selectProductNature('finished', $object->finished);
|
||||
print '</td></tr>';
|
||||
|
||||
// Brut Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
||||
// Brut Length
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td>';
|
||||
print '<input name="size" size="5" value="'.$object->length.'">x';
|
||||
print '<input name="sizewidth" size="5" value="'.$object->width.'">x';
|
||||
print '<input name="sizeheight" size="5" value="'.$object->height.'"> ';
|
||||
@ -1754,14 +1765,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) {
|
||||
// Brut Surface
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||
print '<input name="surface" size="5" value="'.$object->surface.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("surface_units", "surface", $object->surface_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) {
|
||||
// Brut Volume
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||
print '<input name="volume" size="5" value="'.$object->volume.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
@ -1769,7 +1780,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) {
|
||||
// Net Measure
|
||||
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td>';
|
||||
print '<input name="net_measure" size="5" value="'.$object->net_measure.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("net_measure_units", "", $object->net_measure_units, 0, 0);
|
||||
print '</td></tr>';
|
||||
@ -1778,38 +1789,36 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Units
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
print '<tr><td>'.$langs->trans('DefaultUnitToShow').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>';
|
||||
print $form->selectUnits($object->fk_unit, 'units');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Custom code
|
||||
if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) {
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td></tr>';
|
||||
print '<tr><td class="wordbreak">'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td></tr>';
|
||||
// Origin country
|
||||
print '<td>'.$langs->trans("CountryOrigin").'</td>';
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', 'globe-americas', 'class="paddingrightonly"');
|
||||
print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone');
|
||||
if ($user->admin) {
|
||||
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
}
|
||||
print '</td>';
|
||||
print '</td></tr>';
|
||||
// State
|
||||
if (empty($conf->global->PRODUCT_DISABLE_STATE)) {
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
print '</tr><tr>';
|
||||
}
|
||||
print '<tr>';
|
||||
if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) {
|
||||
print '<td>'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
print '<td>'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).'</td><td>';
|
||||
} else {
|
||||
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td colspan="3">';
|
||||
print '<td>'.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).'</td><td>';
|
||||
}
|
||||
|
||||
print $formcompany->select_state($object->state_id, $object->country_code);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Quality control
|
||||
@ -1819,7 +1828,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('colspan' => ' colspan="3"', 'cols' => 3);
|
||||
$parameters = array('colspan' => ' colspan="2"', 'cols' => 2);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
@ -1828,7 +1837,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Tags-Categories
|
||||
if ($conf->categorie->enabled) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id, Categorie::TYPE_PRODUCT);
|
||||
@ -1844,7 +1853,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Note private
|
||||
if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="3">';
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
||||
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
@ -1862,41 +1871,41 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Accountancy_code_sell
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
|
||||
print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_sell_intra
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, '', 1, 1);
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_sell_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_export, 'accountancy_code_sell_export', 1, '', 1, 1);
|
||||
print $formaccounting->select_account($object->accountancy_code_sell_export, 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
|
||||
print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
if ($mysoc->isInEEC()) {
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, '', 1, 1);
|
||||
print $formaccounting->select_account($object->accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy_code_buy_export
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($object->accountancy_code_buy_export, 'accountancy_code_buy_export', 1, '', 1, 1);
|
||||
print $formaccounting->select_account($object->accountancy_code_buy_export, 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300');
|
||||
print '</td></tr>';
|
||||
} else {
|
||||
// For external software
|
||||
|
||||
@ -382,11 +382,13 @@ class FormProduct
|
||||
* @param string $default Preselected value
|
||||
* @param int|string $adddefault 1=Add empty unit called "Default", ''=Add empty value
|
||||
* @param int $mode 1=Use short label as value, 0=Use rowid, 2=Use scale (power)
|
||||
* @param string $morecss More CSS
|
||||
* @return string
|
||||
*/
|
||||
public function selectMeasuringUnits($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0, $mode = 0)
|
||||
public function selectMeasuringUnits($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0, $mode = 0, $morecss = 'maxwidth125')
|
||||
{
|
||||
global $langs, $conf, $mysoc, $db;
|
||||
|
||||
$langs->load("other");
|
||||
|
||||
$return = '';
|
||||
@ -412,7 +414,7 @@ class FormProduct
|
||||
dol_print_error($db);
|
||||
return -1;
|
||||
} else {
|
||||
$return .= '<select class="flat" name="'.$name.'">';
|
||||
$return .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$name.'">';
|
||||
if ($adddefault || $adddefault === '') {
|
||||
$return .= '<option value="0">'.($adddefault ? $langs->trans("Default") : '').'</option>';
|
||||
}
|
||||
|
||||
@ -918,7 +918,7 @@ if ($ispaymentok) {
|
||||
// TODO send email with acknowledgment for the donation
|
||||
// (need that the donation module can gen a pdf document for the cerfa with pre filled content)
|
||||
} elseif (array_key_exists('ATT', $tmptag) && $tmptag['ATT'] > 0) {
|
||||
// Record payment
|
||||
// Record payment for attendee
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($db);
|
||||
$result = $object->fetch($ref);
|
||||
@ -1090,7 +1090,7 @@ if ($ispaymentok) {
|
||||
$ispostactionok = -1;
|
||||
}
|
||||
} elseif (array_key_exists('BOO', $tmptag) && $tmptag['BOO'] > 0) {
|
||||
// Record payment
|
||||
// Record payment for booth or conference
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($db);
|
||||
$result = $object->fetch($ref);
|
||||
|
||||
@ -57,7 +57,7 @@ $resultboxes = FormOther::getBoxesArea($user, "3");
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$zone = GETPOST('areacode', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
|
||||
@ -62,7 +62,7 @@ $resultboxes = FormOther::getBoxesArea($user, "1");
|
||||
if (GETPOST('addbox')) {
|
||||
// Add box (when submit is done from a form when ajax disabled)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
|
||||
$zone = GETPOST('areacode', 'aZ09');
|
||||
$zone = GETPOST('areacode', 'int');
|
||||
$userid = GETPOST('userid', 'int');
|
||||
$boxorder = GETPOST('boxorder', 'aZ09');
|
||||
$boxorder .= GETPOST('boxcombo', 'aZ09');
|
||||
|
||||
@ -16,12 +16,15 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$object = new ProductAttribute($db);
|
||||
$rowid = GETPOST('rowid', 'int'); // Id of line for up / down when no javascript available
|
||||
|
||||
$permissiontoread = $user->rights->produit->lire || $user->rights->service->lire;
|
||||
$permissiontoadd = $user->rights->produit->creer || $user->rights->service->creer;
|
||||
|
||||
// Security check
|
||||
if (empty($conf->variants->enabled)) {
|
||||
@ -30,6 +33,8 @@ if (empty($conf->variants->enabled)) {
|
||||
if ($user->socid > 0) { // Protection if external user
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
//$result = restrictedArea($user, 'variant');
|
||||
if (!$permissiontoread) accessforbidden();
|
||||
|
||||
@ -39,13 +44,13 @@ if (!$permissiontoread) accessforbidden();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'up') {
|
||||
if ($action == 'up' && $permissiontoadd) {
|
||||
$object->fetch($rowid);
|
||||
$object->moveUp();
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
exit();
|
||||
} elseif ($action == 'down') {
|
||||
} elseif ($action == 'down' && $permissiontoadd) {
|
||||
$object->fetch($rowid);
|
||||
$object->moveDown();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user