<?php

/**
 * Callback for all products
 * @param Array $prods
 */
function cb_isValidAllProducts( $prods ) {
	$error = 0;	$aError = array();

	// Test for unique EAN numbers {{{
	$aEAN = array();
	foreach( $prods as $k => $prod ) {
		$line = $k + 1 + 3;
		if( $prod[ "EAN" ] ) {
			$aEAN[ $prod[ "EAN" ] ][] = $line;
		}
	}
	foreach( $aEAN as $k => $v ) {
		if( count( $v ) > 1 ) {
			$error++;
			$aError[] = "Doppelte EAN Nummer ( $k ) in Zeilen: " . implode( ",", $v );
		}
	}
	// }}}
	
	return array( $error, $aError );
}

/*
 * Callback for single product
 * @param Array $prod
 * @param Integer $line
 */
 

function cb_isValidProduct( $prod, $line ) {
	$error = 0;	$aError = array();
	
	// Test for field contains XXX {{{
	if( ! strlen( $prod[ "DESCRIPTION_SHORT"] ) )  {
		$error++;
		$aError[] = "Zeile $line: Fehlender Feldinhalt -> DESCRIPTION_SHORT";
	}

/*
	if( ! strlen( $prod[ "SUPPLIER_AID"] ) )  {
		$error++;
		$aError[] = "Zeile $line: Fehlender Feldinhalt -> SUPPLIER_AID";
	}
*/
	
	// }}}

	return array( $error, $aError );
}



SUPPLIER_AID

?>
