';
- print '
';
+ dol_fiche_end();
+
+ print '
';
+ print ' ';
print '
';
print '';
@@ -324,17 +323,17 @@
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{
- $res = $object->fetch_optionals();
+ $res = $object->fetch_optionals();
$head = bomPrepareHead($object);
- print dol_get_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
+ dol_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
$formconfirm = '';
// Confirmation to delete
if ($action == 'delete')
{
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline')
@@ -454,7 +453,7 @@
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
$formquestion = array();
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
@@ -536,7 +535,7 @@
print '
';
- print dol_get_fiche_end();
+ dol_fiche_end();
@@ -546,129 +545,133 @@
if (!empty($object->table_element_line))
{
- print '
\n";
+ if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
+ include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
+ }
+
+ print '
';
+ if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
+ {
+ print '
';
+ }
+
+ if (!empty($object->lines))
+ {
+ $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
+ }
+
+ // Form to add new line
+ if ($object->status == 0 && $permissiontoadd && $action != 'selectlines')
+ {
+ if ($action != 'editline')
+ {
+ // Add products/services form
+ $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
+
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ }
+ }
+
+ if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
+ {
+ print '
';
+ }
+ print '
';
+
+ print "\n";
}
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
- print '
'."\n";
}
@@ -700,41 +705,41 @@
if ($action != 'presend')
{
- print '
';
- print '
'; // ancre
-
- // Documents
- $objref = dol_sanitizeFileName($object->ref);
- $relativepath = $objref.'/'.$objref.'.pdf';
- $filedir = $conf->bom->dir_output.'/'.$objref;
- $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
- $genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
- $delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
- print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
-
- // Show links to link elements
- $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
- $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
-
-
- print '
';
-
- $MAXEVENT = 10;
-
- $morehtmlright = '
';
- $morehtmlright .= $langs->trans("SeeAll");
- $morehtmlright .= ' ';
-
- // List of actions on element
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
- $formactions = new FormActions($db);
- $somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
-
- print '
';
+ print '
';
+ print '
'; // ancre
+
+ // Documents
+ $objref = dol_sanitizeFileName($object->ref);
+ $relativepath = $objref.'/'.$objref.'.pdf';
+ $filedir = $conf->bom->dir_output.'/'.$objref;
+ $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
+ $genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
+ $delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
+ print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
+
+ // Show links to link elements
+ $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
+ $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+
+
+ print '
';
+
+ $MAXEVENT = 10;
+
+ $morehtmlright = '
';
+ $morehtmlright .= $langs->trans("SeeAll");
+ $morehtmlright .= ' ';
+
+ // List of actions on element
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
+ $formactions = new FormActions($db);
+ $somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
+
+ print '
';
}
//Select mail models is same action as presend
- if (GETPOST('modelselected')) $action = 'presend';
+ if (GETPOST('modelselected')) $action = 'presend';
// Presend form
$modelmail = 'bom';
--- /tmp/dsg/dolibarr/htdocs/bom/github_bom_document.php
+++ /tmp/dsg/dolibarr/htdocs/bom/client_bom_document.php
@@ -69,7 +69,8 @@
// Load object
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);
+//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->id);
+if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".dol_sanitizeFileName($object->ref);
/*
@@ -97,7 +98,7 @@
*/
$head = bomPrepareHead($object);
- print dol_get_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom');
+ dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom');
// Build file list
@@ -114,9 +115,9 @@
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
- print '
';
+ print '
';
- print '
';
+ print '
';
print '
';
// Number of files
@@ -129,7 +130,7 @@
print '';
- print dol_get_fiche_end();
+ dol_fiche_end();
$modulepart = 'bom';
$permission = $user->rights->bom->write;
@@ -140,7 +141,9 @@
$relativepathwithnofile = 'bom/'.dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
-} else {
+}
+else
+{
accessforbidden('', 0, 1);
}
--- /tmp/dsg/dolibarr/htdocs/bom/github_bom_list.php
+++ /tmp/dsg/dolibarr/htdocs/bom/client_bom_list.php
@@ -45,8 +45,8 @@
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST('sortfield', 'aZ09comma');
-$sortorder = GETPOST('sortorder', 'aZ09comma');
+$sortfield = GETPOST('sortfield', 'alpha');
+$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
@@ -81,11 +81,11 @@
//$result = restrictedArea($user, 'bom', $id, '');
// Initialize array of search criterias
-$search_all = GETPOST("search_all", 'alpha');
+$search_all = trim(GETPOST("search_all", 'alpha'));
$search = array();
foreach ($object->fields as $key => $val)
{
- if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
+ if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
}
// List of fields to search into when doing a "search in all"
@@ -196,8 +196,11 @@
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
- } else $nbok++;
- } else {
+ }
+ else $nbok++;
+ }
+ else
+ {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
@@ -209,7 +212,9 @@
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
- } else {
+ }
+ else
+ {
$db->rollback();
}
//var_dump($listofobjectthirdparties);exit;
@@ -246,8 +251,11 @@
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
- } else $nbok++;
- } else {
+ }
+ else $nbok++;
+ }
+ else
+ {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
@@ -259,7 +267,9 @@
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
$db->commit();
- } else {
+ }
+ else
+ {
$db->rollback();
}
//var_dump($listofobjectthirdparties);exit;
@@ -311,7 +321,6 @@
}
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
-
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -355,7 +364,9 @@
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
{
$num = $nbtotalofrecords;
-} else {
+}
+else
+{
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
@@ -382,6 +393,21 @@
// --------------------------------------------------------------------
llxHeader('', $title, $help_url);
+
+// Example : Adding jquery code
+print '';
$arrayofselected = is_array($toselect) ? $toselect : array();
@@ -424,7 +450,7 @@
$topicmail = "SendBillOfMaterialsRef";
$modelmail = "bom";
$objecttmp = new BOM($db);
-$trackid = 'bom'.$object->id;
+$trackid = 'xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all)
@@ -454,7 +480,7 @@
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
-print '';
+print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '
'."\n";
@@ -471,10 +497,11 @@
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '';
- if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
+ if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
- } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ' ';
+ }
+ elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ' ';
print ' ';
}
}
@@ -542,22 +569,22 @@
// Store properties in $object
$object->setVarsFromFetchObj($obj);
- // Show here line of result
- print '';
- foreach ($object->fields as $key => $val)
- {
- $cssforfield = (empty($val['css']) ? '' : $val['css']);
- if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
- elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
-
- if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
- elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
-
- if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
- if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
-
- if (!empty($arrayfields['t.'.$key]['checked']))
- {
+ // Show here line of result
+ print ' ';
+ foreach ($object->fields as $key => $val)
+ {
+ $cssforfield = (empty($val['css']) ? '' : $val['css']);
+ if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
+ elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
+
+ if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+ elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+
+ if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
+ if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
+
+ if (!empty($arrayfields['t.'.$key]['checked']))
+ {
print '';
if ($key == 'status') print $object->getLibStatut(5);
else print $object->showOutputField($val, $key, $object->$key, '');
@@ -568,8 +595,8 @@
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
$totalarray['val']['t.'.$key] += $object->$key;
}
- }
- }
+ }
+ }
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
--- /tmp/dsg/dolibarr/htdocs/bom/github_bom_note.php
+++ /tmp/dsg/dolibarr/htdocs/bom/client_bom_note.php
@@ -33,7 +33,7 @@
// Get parameters
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
-$action = GETPOST('action', 'aZ09');
+$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
@@ -83,7 +83,7 @@
$head = bomPrepareHead($object);
- print dol_get_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom');
+ dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom');
// Object card
// ------------------------------------------------------------
@@ -144,7 +144,7 @@
print '';
- print dol_get_fiche_end();
+ dol_fiche_end();
}
// End of page