CREATE TABLE llx_livraisondet_extrafields (
  rowid int(11) NOT NULL AUTO_INCREMENT,
  tms timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  fk_object int(11) NOT NULL,
  import_key varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL,
  affecsal varchar(255) COLLATE utf8_unicode_ci DEFAULT '0',
  design_aff varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  codecompta varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  affecsal_temps varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  show_total_ht int(11) DEFAULT NULL,
  show_reduc int(11) DEFAULT NULL,
  PRIMARY KEY (rowid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


CREATE TABLE llx_livraison_extrafields (
  rowid int(11) NOT NULL AUTO_INCREMENT,
  tms timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  fk_object int(11) NOT NULL,
  import_key varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL,
  rfltr_model_id int(11) DEFAULT NULL,
  notes text COLLATE utf8_unicode_ci DEFAULT NULL,
  listeintervenant varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  nbheureintervenants varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (rowid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO llx_extrafields (name, elementtype, label, type, size, fieldcomputed, fielddefault, fieldunique, fieldrequired, perms, enabled, pos, alwayseditable, param, list, printable, totalizable, langs, help, fk_user_author, fk_user_modif) VALUES
('rfltr_model_id', 'livraison', 'model doc edit', 'int', '10', NULL, NULL, 0, 0, NULL, '1', 0, 1, '', '0', 0, 0, NULL, '1', 1, 1),
('notes', 'livraison', 'Notes', 'text', '3000', NULL, NULL, 0, 0, NULL, '1', 10, 1, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '1', 0, 0, NULL, NULL, 1, 1),
('listeintervenant', 'livraison', 'Liste Intervenant', 'varchar', '255', NULL, NULL, 0, 0, NULL, '1', 104, 1, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '0', 0, 0, NULL, NULL, 1, 1),
('nbheureintervenants', 'livraison', 'Nombre heures intervenants', 'varchar', '255', NULL, NULL, 0, 0, NULL, '1', 105, 1, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '0', 0, 0, NULL, NULL, 1, 1),
('codecompta', 'livraisondet', 'Code compta', 'varchar', '255', NULL, NULL, 0, 0, NULL, '1', 100, 1, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '0', 0, 0, NULL, NULL, 1, 1),
('affecsal_temps', 'livraisondet', 'Affectation salarié temps', 'varchar', '255', NULL, NULL, 0, 0, NULL, '1', 100, 1, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '1', 0, 0, NULL, NULL, 1, 1),
('design_aff', 'livraisondet', 'Désignation affichée', 'varchar', '100', NULL, NULL, 0, 0, NULL, '1', 10, 1, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '1', 1, 0, NULL, NULL, 1, 1),
('show_total_ht', 'livraisondet', 'Afficher le Total HT sur le sous-total', 'int', '10', NULL, NULL, 0, 0, NULL, '1', 0, 0, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '0', 0, 0, NULL, '1', 1, 1),
('show_reduc', 'livraisondet', 'Afficher la réduction sur le sous-total', 'int', '10', NULL, NULL, 0, 0, NULL, '1', 0, 0, 'a:1:{s:7:\"options\";a:1:{s:0:\"\";N;}}', '0', 0, 0, NULL, '1', 1, 1),
('affecsal', 'livraisondet', 'Affectation salarié', 'sellist', '', NULL, '0', 0, 0, NULL, '1', 20, 1, 'a:1:{s:7:\"options\";a:1:{s:52:\"user:concat(lastname, \' \',firstname):rowid::rowid>=2\";N;}}', '1', 0, 0, NULL, NULL, 1, 1);

INSERT INTO llx_const(name,value,type,visible,note,entity) VALUES
('MAIN_MODULE_LIVRAISON_ADDON_NUMBER','mod_livraison_standard','chaine',0,'',1)
('MAIN_MODULE_LIVRAISON_LINES','shipment','chaine',0,'',1)

ALTER TABLE llx_livraisondet_extrafields
  ADD KEY idx_livraisondet_extrafields (fk_object);

--
-- Index pour la table llx_livraison_extrafields
--
ALTER TABLE llx_livraison_extrafields
  ADD KEY idx_livraison_extrafields (fk_object);

