File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7272
7373 flash ()->info (tr ('Impianti aggiornati correttamente! ' ));
7474
75+ break ;
76+
77+ case 'copy_bulk ' :
78+ foreach ($ id_records as $ id_record ) {
79+ $ database ->beginTransaction ();
80+ $ dbo ->query ('CREATE TEMPORARY TABLE tmp SELECT * FROM my_impianti WHERE id= ' .prepare ($ id_record ));
81+ $ dbo ->query ('ALTER TABLE tmp DROP id ' );
82+ $ dbo ->query ('INSERT INTO my_impianti SELECT NULL,tmp. * FROM tmp ' );
83+ $ idimpianto_new = $ dbo ->lastInsertedID ();
84+ $ dbo ->query ('DROP TEMPORARY TABLE tmp ' );
85+
86+ $ dbo ->query ('UPDATE my_impianti SET matricola = CONCAT (matricola, " (copia)") WHERE id = ' .prepare ($ idimpianto_new ));
87+ }
88+
89+ flash ()->info (tr ('Impianti duplicati correttamente! ' ));
90+
7591 break ;
7692}
7793$ operations ['change_customer ' ] = [
104120 ],
105121];
106122
123+ $ operations ['copy_bulk ' ] = [
124+ 'text ' => '<span><i class="fa fa-copy"></i> ' .tr ('Duplica impianti ' ),
125+ 'data ' => [
126+ 'title ' => tr ('Vuoi davvero fare una copia degli impianti selezionati? ' ),
127+ 'button ' => tr ('Procedi ' ),
128+ 'class ' => 'btn btn-lg btn-warning ' ,
129+ 'blank ' => false ,
130+ ],
131+ ];
132+
107133return $ operations ;
You can’t perform that action at this time.
0 commit comments