Ejemplo n.º 1
0
						<div class="caClientOrderCustomerFormItemSummary">
<?php 
                $t_commerce_item->load($va_item["item_id"]);
                if ($vb_can_download_item = $t_commerce_item->userCanDownloadItem()) {
                    print caNavLink($this->request, _t('Download'), 'download', '', 'Account', 'Download', array('item_id' => $va_item['item_id'], 'download' => 1)) . "</a>";
                } else {
                    if (is_null($vb_can_download_item)) {
                        print "<a href='#' class='download'>" . _t('Not yet available for download') . "</a>";
                    }
                }
                ?>
							<em><?php 
                print $va_item['name'] . "</em> (" . $va_item['idno'] . ")";
                ?>
							<div><?php 
                print $t_order_item->getChoiceListValue('service', $va_item['service']);
                ?>
</div>
							<div>
<?php 
                print "<a href='#' onclick='caMediaPanel.showPanel(\"" . caNavUrl($this->request, 'Detail', 'Object', 'GetRepresentationInfo', array('object_id' => $va_item['object_id'], 'order_item_id' => $va_item['item_id'])) . "\"); return false;' >" . ($va_item['representation_count'] == 1 ? _t('Click to view selected image') : _t('Click to view %1 selected images', $va_item['selected_representation_count'])) . "</a><br/>\n";
                ?>
							</div>
							<div>
<?php 
                print $vs_currency_symbol . $va_item['fee'];
                if ((double) $va_item['additional_fees_total'] > 0) {
                    print " + " . _t('%1 addtl. fees', $vs_currency_symbol . $va_item['additional_fees_total']);
                }
                if ((double) $va_item['tax'] > 0) {
                    print " + " . _t('%1 tax', $vs_currency_symbol . $va_item['tax']);
Ejemplo n.º 2
0
 /**
  * Returns a list of fulfillment events for the currently loaded order
  *
  * @param array $pa_options An array of options (none supported yet)
  * @return array A list of arrays, each containing information about a specific fulfillment event. The list is ordered by date/time starting with the oldest event.
  */
 public function getFulfillmentLog($pa_options = null)
 {
     if (!($vn_order_id = $this->getPrimaryKey())) {
         return null;
     }
     $o_db = $this->getDb();
     $qr_res = $o_db->query("\n\t\t\tSELECT e.*, i.*, o.idno item_idno\n\t\t\tFROM ca_commerce_fulfillment_events e \n\t\t\tINNER JOIN ca_commerce_order_items AS i ON i.item_id = e.item_id\n\t\t\tINNER JOIN ca_objects AS o ON o.object_id = i.object_id\n\t\t\tWHERE \n\t\t\t\te.order_id = ?\n\t\t\tORDER BY e.occurred_on\n\t\t", (int) $vn_order_id);
     $t_object = new ca_objects();
     $va_labels = $t_object->getPreferredDisplayLabelsForIDs($qr_res->getAllFieldValues("object_id"));
     $t_item = new ca_commerce_order_items();
     $va_events = array();
     $qr_res->seek(0);
     $va_user_cache = array();
     while ($qr_res->nextRow()) {
         $va_row = $qr_res->getRow();
         $va_row['fulfillment_details'] = caUnserializeForDatabase($va_row['fulfillment_details']);
         $va_row['item_label'] = $va_labels[$va_row['object_id']];
         $va_row['fulfillment_method_display'] = $t_item->getChoiceListValue('fullfillment_method', $va_row['fullfillment_method']);
         $va_row['service_display'] = $t_item->getChoiceListValue('service', $va_row['service']);
         if ($vn_user_id = (int) $va_row['fulfillment_details']['user_id']) {
             if (!isset($va_user_cache[$vn_user_id])) {
                 $t_user = new ca_users($vn_user_id);
                 if ($t_user->getPrimaryKey()) {
                     $va_user_cache[$vn_user_id] = array('fname' => $t_user->get('fname'), 'lname' => $t_user->get('lname'), 'email' => $t_user->get('email'));
                 } else {
                     $va_user_cache[$vn_user_id] = null;
                 }
             }
             if (is_array($va_user_cache[$vn_user_id])) {
                 $va_row = array_merge($va_row, $va_user_cache[$vn_user_id]);
             }
         }
         $va_events[] = $va_row;
     }
     return $va_events;
 }
		<?php 
print "<h1>" . (($vn_item_count = sizeof($va_items)) != 1 ? _t("%1 Items", $vn_item_count) : _t("%1 Item", $vn_item_count)) . " <span style='font-size:.65em;'>" . caNavLink($this->request, _t('Manage'), '', 'client/orders', 'OrderEditor', 'ItemList', array('order_id' => $vn_order_id)) . "</span> <span style='font-size:.65em;'>" . caNavLink($this->request, _t('Print checklist'), '', 'client/orders', 'OrderEditor', 'GetCheckList', array('order_id' => $vn_order_id)) . "</span></h1>";
?>
	</div>
	
<?php 
print "<table cellspacing='0' style='padding: 0px 5px 0px 5px;'>";
print "<tr style='font-weight:bold; text-transform: uppercase; background-color: #f1f1f1;'><td width='200'>" . _t('Item Name') . "</td><td>" . _t('ID') . "</td><td>" . _t('Service') . "</td><td>" . _t('Fulfillment') . "</td><td>" . _t('Fee') . "</td><td>" . _t('Notes') . "</td></tr>";
$va_outstanding = 0;
$va_overdue = 0;
foreach ($va_items as $va_item) {
    $vn_object_id = $va_item['object_id'];
    print "<tr>";
    print "<td class='itemTitle{$vn_object_id}'>" . caNavLink($this->request, $va_item['name'], "", "editor", "objects/ObjectEditor", "Edit", array('object_id' => $va_item['object_id'])) . "</td>";
    print "<td>" . $va_item['idno'] . "</td>";
    print "<td>" . $t_item->getChoiceListValue('service', $va_item['service']) . "</td>";
    print "<td>" . $t_item->getChoiceListValue('fullfillment_method', $va_item['fullfillment_method']) . "</td>";
    print "<td>" . $vs_currency_symbol . (int) $va_item['fee'] . "</td>";
    print "<td>" . $va_item['notes'] . "</td>";
    print "</tr>";
    TooltipManager::add(".itemTitle{$vn_object_id}", "<table><tr><td>" . $va_item['thumbnail_tag'] . "</td><td><b>" . $va_item['idno'] . "<br/><br/></b>" . $va_item['name'] . "</td></tr></table>");
}
print "</table>";
print "<div style='height:70px; width: 100%; clear:both;'></div>";
// shipping
if ($t_order->requiresShipping()) {
    $va_shipping_name_list = array();
    foreach (array('shipping_city', 'shipping_zone', 'shipping_country') as $vs_shipping_field) {
        if ($vs_tmp = $t_order->get($vs_shipping_field)) {
            $va_shipping_name_list[] = $vs_tmp;
        }
     $vs_display_value .= $va_order['billing_country'] ? $va_order['billing_country'] . "<br/>\n" : "";
     $vs_display_value .= $va_order['billing_phone'] ? _t('Phone: %1', $va_order['billing_phone']) . "<br/>\n" : "";
     $vs_display_value .= $va_order['billing_fax'] ? _t('Fax: %1', $va_order['billing_fax']) . "<br/>\n" : "";
     $vs_display_value .= $va_order['billing_email'] ? $va_order['billing_email'] . "<br/>\n" : "";
     break;
 case 'created_on':
     $vs_display_value = caGetLocalizedDate($va_order[$vs_column_code], array('timeOmit' => true, 'dateFormat' => 'delimited'));
     $vs_size_attr = ' width="60"';
     break;
 case 'summary':
     $vs_display_value = "<strong>" . ($va_order['num_items'] == 1 ? _t('%1 item', $va_order['num_items']) : _t('%1 items', $va_order['num_items'])) . "</strong>\n";
     $va_items = $t_order->getItems(array('order_id' => $va_order['order_id']));
     if (is_array($va_items) && sizeof($va_items)) {
         $va_item_titles = array();
         foreach ($va_items as $vn_i => $va_item) {
             if ($vs_item_title = "[" . trim($va_item['idno']) . "] " . caTruncateStringWithEllipsis($va_item['name'], 20) . " (" . $t_item->getChoiceListValue('service', $va_item['service']) . ")") {
                 $va_item_titles[] = $vs_item_title;
             }
         }
         $vs_display_value .= ":<br/>\n" . join(",<br/>\n", $va_item_titles);
     }
     $vs_size_attr = ' width="300"';
     break;
 case 'order_status':
     $vs_display_value = $t_order->getChoiceListValue('order_status', $va_order[$vs_column_code]);
     $vs_size_attr = ' width="70"';
     break;
 case 'total':
     $vs_display_value = $vs_currency_symbol . sprintf("%4.2f", $va_order['order_total']);
     $vs_size_attr = ' width="70"';
     break;
        print $i == 1 ? "class='odd'" : "";
        ?>
>
				<td width="10" align="center">☐</td>
<?php 
        $vn_count = 0;
        foreach ($va_display_list as $vs_column_code => $vs_column_name) {
            // Skip first few columns as needed
            if ($vn_count < $vn_start) {
                $vn_count++;
                continue;
            }
            switch ($vs_column_code) {
                case 'fullfillment_method':
                case 'service':
                    $vs_display_value = $t_item->getChoiceListValue($vs_column_code, $va_item[$vs_column_code]);
                    break;
                default:
                    $vs_display_value = $va_item[$vs_column_code];
                    break;
            }
            print "<td{$vs_size_attr}>" . (strlen($vs_display_value) > 1200 ? strip_tags(substr($vs_display_value, 0, 1197)) . "..." : $vs_display_value) . "</td>";
            $vn_count++;
            if ($vn_count >= $vn_start + 7) {
                break;
            }
        }
        ?>
	
			</tr>
<?php