}
function post_to_detail_ids() {
+ if(!isset($_POST['detail'])) return;
$detail_ids = array();
foreach($_POST['detail'] as $detail_id => $values) {
array_push($detail_ids, $detail_id);
if(!isset($_POST['Update']) || $_POST['Update'] != 'Update') return;
$cart = post_to_detail_ids();
+ if($cart === null) return;
begin_transaction();
hook_db_prewrite($cart, 'order_xtra');
// update in database all field
$splitter = new Splitter($_POST);
begin_transaction();
$cart = post_to_detail_ids();
+ if($cart === null) return;
hook_db_prewrite($cart, 'order_xtra');
if($splitter->splitAll()) display_warning("Items have been split.");
hook_db_postwrite($cart, 'order_xtra');
'#checkAll': function (e) {
e.onchange = function() {
$('.check_detail').prop('checked', e.checked)
+ $('.check_detail').trigger('change');
}
}
+ ,'tr': function(e) {
+ // find if there is a check detail box on link all input to it
+ var tr = $(e);
+ var check = tr.find('.check_detail');
+ if(check.length != 1) return;
+ check = check[0];
+ var jcheck = $(check);
+ var inputs = tr.find('input');
+ inputs.each(function(index, input) {
+ if(input === check) return;
+ $(input).prop('disabled', true)
+ })
+
+ check.onchange = function() {
+ inputs.each(function(index, input) {
+ var on = jcheck.prop('checked')
+ if(input == check) return;
+ $(input).prop('disabled', !on);
+ })
+ };
+ }
}
Behaviour.register(inserts);
</script>