Example #1
0
	function getCodeName($ic_id = null, $long = false){
		if(is_null($ic_id)){
			$ic_id = $this->id;
		}
		
		$ic = new SI_ItemCode();
		$results = $ic->retrieveSet('WHERE id = '.$ic_id, true);

		if($results == false){
			$this->error = "Error looking up item code: ".$ic->getLastError();
			return FALSE;
		}
		
		$name = '';
		foreach($results as $row){
			$name = $row['code'];
			if($long){
				$name .= ' - '.$row['description'];
			}
		}
		
		return $name;
	}
Example #2
0
function soap_get_item_codes($username, $password)
{
    $user = auth_user($username, $password);
    if ($user === FALSE) {
        return new soap_fault('Client', '', 'Access Denied');
    }
    $ic = new SI_ItemCode();
    $ics = $ic->retrieveSet(" ORDER BY code ");
    return object_to_data($ics, array('id', 'code', 'description'));
}
Example #3
0
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 */
require_once('includes/common.php');
require_once('includes/SI_User.php');

checkLogin("admin");

require_once('includes/SI_ItemCode.php');

$item_code = new SI_ItemCode();
$item_codes = $item_code->retrieveSet("ORDER BY code");
if($item_codes === FALSE){
	$error_msg .= "Error getting item_codes!\n";
	debug_message($item_code->getLastError());
}

$title = "Item Code Administration";

require('header.php') ?>
<div class="tableContainer">
<a href="javascript:;" class="tCollapse" onclick="toggleGrid(this)"><img src="images/arrow_down.jpg" alt="Hide table" />Item Codes</a><div>
	<div class="gridToolbar">
		  <a href="item_code.php?mode=add" style="background-image:url(images/new_invoice.png);">New Item Code</a>
	</div>
<table border="0" cellspacing="0" cellpadding="0">
	<tr>
Example #4
0
 function guessMappings()
 {
     $si_user = new SI_User();
     $si_users = $si_user->getAll();
     if ($si_users !== false) {
         for ($i = 0; $i < count($si_users); $i++) {
             $normalized_name = $this->normalize($si_users[$i]->first_name . ' ' . $si_users[$i]->last_name);
             if (isset($this->users[$normalized_name])) {
                 $this->users[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->users[$normalized_name]['param'] = $si_users[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_users[$i]->last_name . ' ' . $si_users[$i]->first_name);
             if (isset($this->users[$normalized_name])) {
                 $this->users[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->users[$normalized_name]['param'] = $si_users[$i]->id;
                 continue;
             }
         }
     }
     $si_task = new SI_Task();
     $si_tasks = $si_task->retrieveSet();
     if ($si_tasks !== false) {
         for ($i = 0; $i < count($si_tasks); $i++) {
             $normalized_name = $this->normalize($si_tasks[$i]->name);
             if (isset($this->tasks[$normalized_name])) {
                 $this->tasks[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->tasks[$normalized_name]['param'] = $si_tasks[$i]->id;
                 continue;
             }
         }
     }
     $si_item_code = new SI_ItemCode();
     $si_item_codes = $si_item_code->retrieveSet();
     if ($si_item_codes !== false) {
         for ($i = 0; $i < count($si_item_codes); $i++) {
             $normalized_name = $this->normalize($si_item_codes[$i]->code);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_item_codes[$i]->description);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
             $normalized_name = $this->normalize($si_item_codes[$i]->code . ' - ' . $si_item_codes[$i]->description);
             if (isset($this->item_codes[$normalized_name])) {
                 $this->item_codes[$normalized_name]['action'] = SI_IMPORT_ACTION_MAP;
                 $this->item_codes[$normalized_name]['param'] = $si_item_codes[$i]->id;
                 continue;
             }
         }
     }
 }
Example #5
0
if(isset($_REQUEST['update_ts'])){
	$last_update_ts = $_REQUEST['update_ts'];
}else{
	$last_update_ts = time() - (60 * 60 * 24 * 30);	
}

$company = new SI_Company();
$companies = $company->retrieveSet("WHERE updated_ts > $last_update_ts");
if($companies === FALSE){
	$error_msg .= "Error getting companies updated since ".date('m-d-Y', $last_update_ts);
	debug_message($company->getLastError());
}

$item_code = new SI_ItemCode();
$item_codes = $item_code->retrieveSet("WHERE updated_ts > $last_update_ts");
if($item_codes === FALSE){
	$error_msg .= "Error getting item codes updated since ".date('m-d-Y', $last_update_ts);
	debug_message($item_code->getLastError());
}

$account = new SI_Account();
$accounts = $account->retrieveSet("WHERE updated_ts > $last_update_ts");
if($accounts === FALSE){
	$error_msg .= "Error getting accounts updated since ".date('m-d-Y', $last_update_ts);
	debug_message($account->getLastError());
}

$invoice = new SI_Invoice();
$invoices = $invoice->retrieveSet("WHERE updated_ts > $last_update_ts");
if($invoices === FALSE){