18 require_once SQ_PACKAGES_PATH.
'/cms/form/form_email/form_email_edit_fns.inc';
20 require_once SQ_FUDGE_PATH.
'/datetime_field/datetime_field.inc';
21 require_once SQ_FUDGE_PATH.
'/general/datetime.inc';
53 $bodycopies = $asset->_bodycopies;
54 foreach ($bodycopies as $one_bodycopy) {
55 $bodycopy_asset = $asset->getBodycopy($one_bodycopy);
56 echo
'<div style="padding:1ex;">';
57 echo get_asset_tag_line($bodycopy_asset->id,
'contents');
95 $am =& $GLOBALS[
'SQ_SYSTEM']->am;
96 $write_access = $asset->writeAccess(
'attributes');
100 echo
'<table class="sq-backend-table">';
102 echo
'<th>Question Name</th>';
103 echo
'<th>Ecom Enabled?</th>';
104 echo
'<th>Is Taxable?</th>';
105 echo
'<th>Options</th>';
108 $all_form_questions = $asset->getAllQuestions();
109 $taxable_rules = $asset->attr(
'taxable_rules');
111 foreach ($all_form_questions as $q_id => $question_data) {
112 if (!$asset->_isAllowedQuestionType($question_data[
'question_type_code'])) {
116 $rule = $asset->_getEcommerceRule($q_id);
117 $ecom_enabled = ($rule !== FALSE);
121 echo $question_data[
'attributes'][
'name'];
124 $ecom_enabled_prefix = $prefix.
'_ecom_enabled['.$q_id.
']';
126 check_box($ecom_enabled_prefix, $q_id, $ecom_enabled);
128 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.($ecom_enabled ?
'tick' :
'cross').
'.gif" />';
132 $taxable = array_get_index($taxable_rules, $q_id, FALSE);
133 $taxable_prefix = $prefix.
'_taxable['.$q_id.
']';
135 check_box($taxable_prefix, $q_id, $taxable);
137 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.($taxable ?
'tick' :
'cross').
'.gif" />';
142 $question = $am->getAsset($q_id);
143 if ($question->isSelection()) {
144 echo
'<table class="sq-backend-table">';
145 $options = $question->getOptions();
146 $local_prefix = $prefix.
'_ecom_rule['.$q_id.
']';
147 foreach ($options as $key => $option_text) {
149 if (!($question instanceof Form_question_type_select) || !$question->isEmptyOption($key)){
151 $rule_value = array_get_index($rule, $key, 0);
152 echo
'<td class="sq-backend-table-header" nowrap="nowrap">';
155 echo
'<td class="sq-backend-table-cell" width="100%">';
156 text_box($local_prefix.
'['.$key.
']', $rule_value, 5);
163 echo translate(
'ecom_form_numeric_field');
166 $am->forgetAsset($question);
168 echo
'<em style="color: grey;">E-commerce support for this question is not enabled</em>';
178 return $write_access;
196 $rule_list_name = $prefix.
'_ecom_enabled';
197 $rule_list = array_get_index($_REQUEST, $rule_list_name);
199 $new_rule_list = Array();
200 if (!empty($rule_list) && is_array($rule_list)) {
201 foreach ($rule_list as $id) {
202 $rule = $asset->_getEcommerceRule($id);
211 $new_rule_list[$id] = $new_rule;
215 $asset->setAttrValue(
'rules', $new_rule_list);
217 $rule_settings = array_get_index($_REQUEST, $prefix.
'_ecom_rule', Array());
219 foreach ($rule_settings as $q_id => $rule) {
220 $asset->_setEcommerceRule($q_id, $rule);
223 $taxable = array_get_index($_REQUEST, $prefix.
'_taxable', Array());
224 $asset->setAttrValue(
'taxable_rules', $taxable);
243 $am =& $GLOBALS[
'SQ_SYSTEM']->am;
244 $write_access = $asset->writeAccess(
'attributes');
248 echo
'<table class="sq-backend-table">';
250 echo
'<th>Question Name</th>';
251 echo
'<th>Enabled?</th>';
253 echo
'<th>Value Options</th>';
256 $all_form_questions = $asset->getAllQuestions();
257 $var_rules = $asset->attr(
'key_val_rules');
259 foreach ($all_form_questions as $q_id => $question_data) {
260 if (!$asset->_isAllowedPassThroughQuestionType($question_data[
'question_type_code'])) {
264 $var_enabled = isset($var_rules[$q_id]);
268 echo $question_data[
'attributes'][
'name'];
271 $var_enabled_name = $prefix.
'_var_enabled['.$q_id.
']';
273 check_box($var_enabled_name, $q_id, $var_enabled);
275 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.($var_enabled ?
'tick' :
'cross').
'.gif" />';
279 $pass_through_key_name = $prefix.
'_pass_through_key['.$q_id.
']';
282 text_box($pass_through_key_name, array_get_index($var_rules[$q_id],
'key',
''));
284 echo
'<em style="color: grey;">None</em>';
288 echo array_get_index($var_rules[$q_id],
'key',
'');
290 echo
'<em style="color: grey;">None</em>';
296 $question = $am->getAsset($q_id);
298 echo
'<table class="sq-backend-table">';
299 $options = $question->getOptions();
300 $var_value = array_get_index($var_rules[$q_id],
'value', Array());
301 $local_prefix = $prefix.
'_pass_through_value['.$q_id.
']';
302 foreach ($options as $key => $option_text) {
304 if (!($question instanceof Form_question_type_select) || !$question->isEmptyOption($key)){
306 $rule_value = array_get_index($var_value, $key,
'');
307 echo
'<td class="sq-backend-table-header" nowrap="nowrap">';
310 echo
'<td class="sq-backend-table-cell" width="100%">';
311 text_box($local_prefix.
'['.$key.
']', $rule_value);
318 echo
'The value supplied by the user will be passed through to the Payment Gateway.';
321 $am->forgetAsset($question);
323 echo
'<em style="color: grey;">Pass through variable is not enabled for this question</em>';
333 return $write_access;
351 $var_list = array_get_index($_REQUEST, $prefix.
'_var_enabled', Array());
353 $new_var_list = Array();
354 if (!empty($var_list)) {
355 $key_list = array_get_index($_REQUEST, $prefix.
'_pass_through_key', Array());
356 $value_list = array_get_index($_REQUEST, $prefix.
'_pass_through_value', Array());
357 foreach ($var_list as $id) {
359 $new_var_list[$id] = Array(
360 'key' => array_get_index($key_list, $id,
''),
361 'value' => array_get_index($value_list, $id, Array()));
365 $asset->setAttrValue(
'key_val_rules', $new_var_list);
384 if (!$asset->writeAccess(
'attributes'))
return FALSE;
385 if (array_get_index($_POST, $prefix.
'_export_switch', 0) == 1) {
390 echo hidden_field($prefix.
'_export_switch',
'0');
392 echo normal_button($prefix.
'_export', translate(
'download_file'),
'this.form.'.$prefix.
'_export_switch.value = 1; this.form.submit(); SQ_FORM_SUBMITTED = false; this.form.'.$prefix.
'_export_switch.value = 0; return true;');
411 if (!$_POST[$prefix.
'_export_switch'])
return TRUE;
414 header(
'Content-Type: application/xml');
417 header(
'Content-Disposition: attachment; filename=order-summary-'.$asset->id.
'.xml;');
419 echo
'<orders>'.
"\n";
422 $children_id = $GLOBALS[
'SQ_SYSTEM']->am->getChildren($asset->id,
'order', FALSE);
424 foreach ($children_id as $child_id => $assettype) {
426 echo
"\t".
'<order id="'.$child_id.
'">'.
"\n";
429 $order_lines = $GLOBALS[
'SQ_SYSTEM']->am->getChildren($child_id,
'order_line', FALSE);
431 foreach ($order_lines as $line_id => $assettype) {
433 $child =& $GLOBALS[
'SQ_SYSTEM']->am->getAsset($line_id);
437 <order_line
id=
"<?php echo $child_id ?>">
438 <product
id=
"<?php echo $child->attr('product_assetid'); ?>"></product>
439 <quantity><?php echo $child->attr(
'quantity'); ?></quantity>
440 <price><?php echo $child->attr(
'price'); ?></price>
445 echo
"\t".
'</order>'.
"\n";
449 echo
'</orders>'.
"\n";
469 $log_file = $asset->_getLogFilePath();
470 if (is_readable($log_file)) {
471 $last_modified = filemtime($log_file);
472 $file_size = filesize($log_file);
473 echo
'Filename: <strong>'.$log_file.
'</strong>';
475 echo
'Last Modified: <strong>'.date(
'r', $last_modified).
'</strong>';
477 echo
'Size: <strong>'.$file_size.
'</strong>B';
479 echo
'Log file does not exist';
481 echo
'Filename: '.$log_file;
502 $types = Array(
'form_action_soap_call');
504 $names = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($types,
'name');
511 check_box($prefix.
'_new',
'1', FALSE,
'this.form.'.$prefix.
'_new_type.disabled = !this.checked; return true;');
512 ?><label
for=
"<?php echo $prefix ?>_new">Create a
new action of type:</label> <?php
513 $names = Array(
'' =>
'Select action type...') + $names;
514 combo_box($prefix.
'_new_type', $names, FALSE,
'', 0,
'disabled="disabled"');
517 ?><p>This screen must be locked before you can create a
new action.</p><?php
523 $o->
sectionNote(
'If you create a new action, the new action will be displayed immediately for you to edit. If you already have an action open to edit, the changes to that action will be saved when you commit before the new action is created.');
525 return $write_access;