change to receptiondet_batch into sql
This commit is contained in:
parent
ab206910ab
commit
268024d424
8 changed files with 17 additions and 19 deletions
|
|
@ -50,8 +50,6 @@ ALTER TABLE llx_categories_extrafields DROP INDEX idx_categories_extrafields;
|
|||
ALTER TABLE llx_categories_extrafields ADD UNIQUE INDEX uk_categories_extrafields (fk_object);
|
||||
ALTER TABLE llx_commande_extrafields DROP INDEX idx_commande_extrafields;
|
||||
ALTER TABLE llx_commande_extrafields ADD UNIQUE INDEX uk_commande_extrafields (fk_object);
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields DROP INDEX idx_commande_fournisseur_dispatch_extrafields;
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD UNIQUE INDEX uk_commande_fournisseur_dispatch_extrafields (fk_object);
|
||||
ALTER TABLE llx_commande_fournisseur_extrafields DROP INDEX idx_commande_fournisseur_extrafields;
|
||||
ALTER TABLE llx_commande_fournisseur_extrafields ADD UNIQUE INDEX uk_commande_fournisseur_extrafields (fk_object);
|
||||
ALTER TABLE llx_commande_fournisseurdet_extrafields DROP INDEX idx_commande_fournisseurdet_extrafields;
|
||||
|
|
@ -203,5 +201,5 @@ ALTER TABLE llx_c_tva ADD COLUMN type_vat smallint NOT NULL DEFAULT 0 AFTER fk_p
|
|||
|
||||
ALTER TABLE llx_categorie ADD COLUMN position integer DEFAULT 0 AFTER color;
|
||||
|
||||
ALTER TABLE llx_product DROP COLUMN onportal;
|
||||
ALTER TABLE llx_product DROP COLUMN onportal;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
--
|
||||
-- ===================================================================
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commande (fk_commande);
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_reception (fk_reception);
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD CONSTRAINT fk_commande_fournisseur_dispatch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid);
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_product (fk_product);
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commandefourndet (fk_commandefourndet);
|
||||
ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_commande (fk_commande);
|
||||
ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_reception (fk_reception);
|
||||
ALTER TABLE llx_receptiondet_batch ADD CONSTRAINT fk_receptiondet_batch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid);
|
||||
ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_product (fk_product);
|
||||
ALTER TABLE llx_receptiondet_batch ADD INDEX idx_receptiondet_batch_fk_commandefourndet (fk_commandefourndet);
|
||||
|
|
|
|||
|
|
@ -14,17 +14,17 @@
|
|||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- This table is just an history table to track all receiption to do or done for a
|
||||
-- This table is just an history table to track all receiption to do or done for a
|
||||
-- particular supplier order. A movement with same information is also done
|
||||
-- into stock_movement so this table may be useless.
|
||||
--
|
||||
--
|
||||
-- Detail of each lines of a reception (qty, batch and into which warehouse must be
|
||||
-- received or has been receveived a purchase order line).
|
||||
--
|
||||
-- This table should be renamed into llx_receptiondet_batch
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_commande_fournisseur_dispatch
|
||||
create table llx_receptiondet_batch
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_product integer,
|
||||
|
|
|
|||
|
|
@ -17,4 +17,4 @@
|
|||
-- ===================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD UNIQUE INDEX uk_commande_fournisseur_dispatch_extrafields (fk_object);
|
||||
ALTER TABLE llx_receptiondet_batch_extrafields ADD UNIQUE INDEX uk_receptiondet_batch_extrafields (fk_object);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
-- This table should have been named llx_receptiondet_batch_extrafields
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_commande_fournisseur_dispatch_extrafields
|
||||
create table llx_receptiondet_batch_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- Similar for supplier with llx_commande_fournisseur_dispatch=llx_receptiondet_batch
|
||||
-- Similar for supplier with llx_receptiondet_batch
|
||||
-- ============================================================================
|
||||
|
||||
CREATE TABLE llx_expeditiondet_batch (
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_chargesociales FOR E
|
|||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur_dispatch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_receptiondet_batch FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseur_log FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_commande_fournisseurdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
|
||||
|
|
|
|||
|
|
@ -1484,10 +1484,10 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
|
|||
$repair_link_dispatch_lines_supplier_order_lines = GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha');
|
||||
|
||||
|
||||
echo '<tr><th>Repair llx_commande_fournisseur_dispatch.fk_commandefourndet</th></tr>';
|
||||
echo '<tr><th>Repair llx_receptiondet_batch.fk_commandefourndet</th></tr>';
|
||||
echo '<tr><td>Repair in progress. This may take a while.</td></tr>';
|
||||
|
||||
$sql_dispatch = 'SELECT * FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0';
|
||||
$sql_dispatch = 'SELECT * FROM '.MAIN_DB_PREFIX.'receptiondet_batch WHERE COALESCE(fk_commandefourndet, 0) = 0';
|
||||
$db->begin();
|
||||
$resql_dispatch = $db->query($sql_dispatch);
|
||||
$n_processed_rows = 0;
|
||||
|
|
@ -1527,7 +1527,7 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
|
|||
}
|
||||
$qty_for_line = min($remaining_qty, $obj_line->qty);
|
||||
if ($first_iteration) {
|
||||
$sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch';
|
||||
$sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'receptiondet_batch';
|
||||
$sql_attach .= ' SET fk_commandefourndet = '.((int) $obj_line->rowid).', qty = '.((float) $qty_for_line);
|
||||
$sql_attach .= ' WHERE rowid = '.((int) $obj_dispatch->rowid);
|
||||
$first_iteration = false;
|
||||
|
|
@ -1549,7 +1549,7 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
|
|||
);
|
||||
$sql_attach_values = join(', ', $sql_attach_values);
|
||||
|
||||
$sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch';
|
||||
$sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'receptiondet_batch';
|
||||
$sql_attach .= ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)';
|
||||
$sql_attach .= " VALUES (".$sql_attach_values.")";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue