<?php
/**********************************************************************
Copyright (C) FrontAccounting, LLC.
- Released under the terms of the GNU Affero General Public License,
- AGPL, as published by the Free Software Foundation, either version
- 3 of the License, or (at your option) any later version.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
$page_security = 2;
$path_to_root="../..";
function tmpl_checkbox($row)
{
$name = "chgtpl" .$row['order_no'];
- $value = $row['type'] ? ' checked' : '';
-
- return "<input $value type='checkbox' name='$name' value='1'"
- ." onclick='JsHttpRequest.request(\"_{$name}_update\", this.form);'"
- ." title='"._('Set this order as a template for direct deliveries/invoices')
- ."' >"
-// add also old checkbox name+value for check after 'Update'
- ."<input name='last[".$row['order_no']."]' type='hidden' value='"
- .($row['type'] ? 1 : 0)."'>\n";
+ $value = $row['type'] ? 1:0;
+
+// save also in hidden field for testing during 'Update'
+
+ return checkbox(null, $name, $value, true,
+ _('Set this order as a template for direct deliveries/invoices'))
+ . hidden('last['.$row['order_no'].']', $value, false);
}
//---------------------------------------------------------------------------------------------
// Update db record if respective checkbox value has changed.
if ($id != -1)
change_tpl_flag($id);
-if (isset($_POST['Update'])) {
+if (isset($_POST['Update']) && isset($_POST['last'])) {
foreach($_POST['last'] as $id => $value)
if ($value != check_value('chgtpl'.$id))
change_tpl_flag($id);
$table->set_sql($sql);
$table->set_columns($cols);
}
+$table->width = "80%";
start_form();
display_db_pager($table);