<commit_before><?php

// Prep for Settlement Test #3516
class Controller_Api_Script_PexCardAdmin extends Crunchbutton_Controller_RestAccount {

	public function init() {

		// $this->processAndValidateCSVData();

		// $this->insertData();

		die('hard');


	}

	public function insertData() {

		$cards = [
// '<NAME>' => [ 'status' => '', 'date' => 'n/a', 'serial' => '', 'id_admin' => '3' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/10/2014', 'serial' => '4', 'id_admin' => '512' ],
'<NAME>' => [ 'status' => 'active', 'date' => '23/10/2014', 'serial' => '8', 'id_admin' => '570' ],
'<NAME>' => [ 'status' => 'active', 'date' => '25/10/2014', 'serial' => '5', 'id_admin' => '515' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '9', 'id_admin' => '585' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '10', 'id_admin' => '532' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '21', 'id_admin' => '499' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '14', 'id_admin' => '518' ],
'<NAME>' => [ 'status' => 'active', 'date' => '30/10/2014', 'serial' => '28', 'id_admin' => '599' ],
'<NAME>' => [ 'status' => 'active', 'date' => '30/10/2014', 'serial' => '12', 'id_admin' => '569' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '195', 'id_admin' => '398' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/11/2014', 'serial' => '25', 'id_admin' => '594' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/11/2014', 'serial' => '56', 'id_admin' => '608' ],
// // '<NAME>' => [ 'status' => '', 'date' => 'n/a', 'serial' => '30', 'id_admin' => '598' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/11/2014', 'serial' => '79', 'id_admin' => '620' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/11/2014', 'serial' => '88', 'id_admin' => '560' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/11/2014', 'serial' => '51', 'id_admin' => '450' ],
// // '<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '', 'id_admin' => '514' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '68', 'id_admin' => '610' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '90', 'id_admin' => '619' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '99', 'id_admin' => '607' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '66', 'id_admin' => '632' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '27', 'id_admin' => '597' ], // -> here
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '61', 'id_admin' => '312' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '84', 'id_admin' => '622' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '16', 'id_admin' => '578' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '76', 'id_admin' => '556' ],
'<NAME>' => [ 'status' => 'active', 'date' => '05/11/2014', 'serial' => '67', 'id_admin' => '621' ],
'<NAME>' => [ 'status' => 'active', 'date' => '05/11/2014', 'serial' => '47', 'id_admin' => '644' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '85', 'id_admin' => '624' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '78', 'id_admin' => '641' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '86', 'id_admin' => '557' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '91', 'id_admin' => '703' ], // -> here
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '73', 'id_admin' => '617' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '74', 'id_admin' => '634' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '24', 'id_admin' => '659' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '22', 'id_admin' => '657' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '94', 'id_admin' => '630' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '58', 'id_admin' => '209' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '29', 'id_admin' => '662' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/11/2014', 'serial' => '70', 'id_admin' => '615' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/10/2014', 'serial' => '63', 'id_admin' => '611' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/11/2014', 'serial' => '71', 'id_admin' => '666' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/11/2014', 'serial' => '64', 'id_admin' => '439' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/11/2014', 'serial' => '300', 'id_admin' => '639' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/11/2014', 'serial' => '299', 'id_admin' => '660' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/11/2014', 'serial' => '296', 'id_admin' => '642' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '272', 'id_admin' => '649' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '32', 'id_admin' => '388' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '83', 'id_admin' => '670' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '290', 'id_admin' => '638' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '95', 'id_admin' => '628' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '269', 'id_admin' => '647' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '274', 'id_admin' => '645' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '295', 'id_admin' => '566' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '294', 'id_admin' => '604' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '279', 'id_admin' => '669' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/11/2014', 'serial' => '7', 'id_admin' => '675' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/11/2014', 'serial' => '297', 'id_admin' => '651' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/11/2014', 'serial' => '284', 'id_admin' => '658' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '163', 'id_admin' => '688' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '164', 'id_admin' => '692' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '178', 'id_admin' => '682' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '13', 'id_admin' => '686' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '268', 'id_admin' => '696' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '165', 'id_admin' => '693' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '157', 'id_admin' => '536' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '162', 'id_admin' => '691' ],
'<NAME>' => [ 'status' => 'active', 'date' => '16/11/2014', 'serial' => '146', 'id_admin' => '701' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '159', 'id_admin' => '683' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '142', 'id_admin' => '603' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '145', 'id_admin' => '700' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '170', 'id_admin' => '709' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '167', 'id_admin' => '687' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '148', 'id_admin' => '704' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/11/2014', 'serial' => '143', 'id_admin' => '697' ],
// '<NAME>' => [ 'status' => 'active', 'date' => '18/11/2014', 'serial' => '', 'id_admin' => '718' ],
// '<NAME>' => [ 'status' => '', 'date' => 'n/a', 'serial' => '104', 'id_admin' => '564' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '122', 'id_admin' => '571' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '156', 'id_admin' => '707' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '126', 'id_admin' => '722' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '234', 'id_admin' => '636' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '135', 'id_admin' => '719' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '212', 'id_admin' => '717' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '210', 'id_admin' => '743' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '151', 'id_admin' => '706' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '174', 'id_admin' => '725' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '131', 'id_admin' => '720' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '237', 'id_admin' => '744' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '282', 'id_admin' => '654' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '113', 'id_admin' => '732' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '281', 'id_admin' => '652' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '166', 'id_admin' => '684' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '238', 'id_admin' => '633' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '227', 'id_admin' => '677' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '175', 'id_admin' => '736' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '116', 'id_admin' => '735' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/11/2014', 'serial' => '127', 'id_admin' => '614' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/11/2014', 'serial' => '138', 'id_admin' => '711' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/11/2014', 'serial' => '283', 'id_admin' => '655' ],
'<NAME>' => [ 'status' => 'active', 'date' => '23/11/2014', 'serial' => '276', 'id_admin' => '664' ],
'<NAME>' => [ 'status' => 'active', 'date' => '23/11/2014', 'serial' => '181', 'id_admin' => '730' ],
'<NAME>' => [ 'status' => 'active', 'date' => '25/11/2014', 'serial' => '153', 'id_admin' => '613' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/12/2014', 'serial' => '129', 'id_admin' => '716' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/12/2014', 'serial' => '136', 'id_admin' => '721' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/12/2014', 'serial' => '53', 'id_admin' => '422' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '107', 'id_admin' => '724' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '200', 'id_admin' => '612' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '173', 'id_admin' => '775' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '228', 'id_admin' => '753' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/12/2014', 'serial' => '154', 'id_admin' => '506' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/12/2014', 'serial' => '155', 'id_admin' => '554' ],
'<NAME>' => [ 'status' => 'active', 'date' => '05/12/2014', 'serial' => '255', 'id_admin' => '68' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '263', 'id_admin' => '329' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '31', 'id_admin' => '359' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '222', 'id_admin' => '488' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '11', 'id_admin' => '826' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '240', 'id_admin' => '838' ], // -> here
'<NAME>' => [ 'status' => 'active', 'date' => '07/12/2014', 'serial' => '152', 'id_admin' => '825' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/12/2014', 'serial' => '123', 'id_admin' => '833' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/12/2014', 'serial' => '161', 'id_admin' => '742' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/12/2014', 'serial' => '134', 'id_admin' => '821' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/12/2014', 'serial' => '139', 'id_admin' => '855' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/12/2014', 'serial' => '26', 'id_admin' => '859' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/12/2014', 'serial' => '987', 'id_admin' => '822' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/12/2014', 'serial' => '981', 'id_admin' => '267' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/12/2014', 'serial' => '98', 'id_admin' => '868' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/12/2014', 'serial' => '118', 'id_admin' => '842' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/12/2014', 'serial' => '293', 'id_admin' => '845' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/12/2014', 'serial' => '57', 'id_admin' => '874' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/12/2014', 'serial' => '264', 'id_admin' => '386' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/12/2014', 'serial' => '141', 'id_admin' => '831' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/12/2014', 'serial' => '59', 'id_admin' => '875' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/12/2014', 'serial' => '226', 'id_admin' => '827' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '988', 'id_admin' => '853' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '990', 'id_admin' => '856' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '185', 'id_admin' => '880' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '280', 'id_admin' => '676' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '905', 'id_admin' => '872' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '902', 'id_admin' => '877' ],
'<NAME>' => [ 'status' => 'active', 'date' => '16/12/2014', 'serial' => '999', 'id_admin' => '870' ],
'<NAME>' => [ 'status' => 'active', 'date' => '16/12/2014', 'serial' => '996', 'id_admin' => '864' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/12/2014', 'serial' => '986', 'id_admin' => '852' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/12/2014', 'serial' => '186', 'id_admin' => '873' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/12/2014', 'serial' => '267', 'id_admin' => '887' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '989', 'id_admin' => '854' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '183', 'id_admin' => '865' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '239', 'id_admin' => '879' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '117', 'id_admin' => '840' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/01/2015', 'serial' => '128', 'id_admin' => '878' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/01/2015', 'serial' => '927', 'id_admin' => '871' ],
		];

		$customers = Crunchbutton_Pexcard_Card::card_list();

		foreach( $cards as $name => $card ){

			$saved = false;

			if( $card[ 'status' ] == 'active' && is_numeric( $card[ 'serial' ] ) && strlen( $card[ 'date' ] ) == 10 ){

				$date = explode( '/', $card[ 'date' ] );
				$date = $date[ '2' ] . '-' . $date[ '1' ] . '-' . $date[ '0' ] . ' 00:00:01';

				$admin = Admin::o( $card[ 'id_admin' ] );

				if( $admin->id_admin ){

					$pexcard = Cockpit_Admin_Pexcard::q( 'SELECT * FROM admin_pexcard WHERE card_serial = ' . intval( $card[ 'serial' ] ) );

					if( $pexcard->id_admin_pexcard ){
						if( $pexcard->id_admin != $admin->id_admin ){
							// die( $name );
						}
					}

					foreach( $customers->body as $customer ){

						if( intval( $customer->lastName ) == intval( $card[ 'serial' ] ) ){

							$admin_pexcard = Cockpit_Admin_Pexcard::getByPexcard( $customer->id );<commit_msg>closed #4282<commit_after><?php

// Prep for Settlement Test #3516
class Controller_Api_Script_PexCardAdmin extends Crunchbutton_Controller_RestAccount {

	public function init() {

		// $this->processAndValidateCSVData();

		$this->insertData();


	}

	public function insertData() {

		$cards = [
// '<NAME>' => [ 'status' => '', 'date' => 'n/a', 'serial' => '', 'id_admin' => '3' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/10/2014', 'serial' => '4', 'id_admin' => '512' ],
'<NAME>' => [ 'status' => 'active', 'date' => '23/10/2014', 'serial' => '8', 'id_admin' => '570' ],
'<NAME>' => [ 'status' => 'active', 'date' => '25/10/2014', 'serial' => '5', 'id_admin' => '515' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '9', 'id_admin' => '585' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '10', 'id_admin' => '532' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '21', 'id_admin' => '499' ],
'<NAME>' => [ 'status' => 'active', 'date' => '29/10/2014', 'serial' => '14', 'id_admin' => '518' ],
'<NAME>' => [ 'status' => 'active', 'date' => '30/10/2014', 'serial' => '28', 'id_admin' => '599' ],
'<NAME>' => [ 'status' => 'active', 'date' => '30/10/2014', 'serial' => '12', 'id_admin' => '569' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '195', 'id_admin' => '398' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/11/2014', 'serial' => '25', 'id_admin' => '594' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/11/2014', 'serial' => '56', 'id_admin' => '608' ],
'<NAME>' => [ 'status' => '', 'date' => '01/01/2015', 'serial' => '30', 'id_admin' => '598' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/11/2014', 'serial' => '79', 'id_admin' => '620' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/11/2014', 'serial' => '88', 'id_admin' => '560' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/11/2014', 'serial' => '51', 'id_admin' => '450' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '', 'id_admin' => '514' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '68', 'id_admin' => '610' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '90', 'id_admin' => '619' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/11/2014', 'serial' => '99', 'id_admin' => '607' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '66', 'id_admin' => '632' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '27', 'id_admin' => '597' ], // -> here
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '61', 'id_admin' => '312' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '84', 'id_admin' => '622' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '16', 'id_admin' => '578' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/11/2014', 'serial' => '76', 'id_admin' => '556' ],
'<NAME>' => [ 'status' => 'active', 'date' => '05/11/2014', 'serial' => '67', 'id_admin' => '621' ],
'<NAME>' => [ 'status' => 'active', 'date' => '05/11/2014', 'serial' => '47', 'id_admin' => '644' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '85', 'id_admin' => '624' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '78', 'id_admin' => '641' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '86', 'id_admin' => '557' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '91', 'id_admin' => '703' ], // -> here
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '73', 'id_admin' => '617' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '74', 'id_admin' => '634' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '24', 'id_admin' => '659' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/11/2014', 'serial' => '22', 'id_admin' => '657' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '94', 'id_admin' => '630' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '58', 'id_admin' => '209' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/11/2014', 'serial' => '29', 'id_admin' => '662' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/11/2014', 'serial' => '70', 'id_admin' => '615' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/10/2014', 'serial' => '63', 'id_admin' => '611' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/11/2014', 'serial' => '71', 'id_admin' => '666' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/11/2014', 'serial' => '64', 'id_admin' => '439' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/11/2014', 'serial' => '300', 'id_admin' => '639' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/11/2014', 'serial' => '299', 'id_admin' => '660' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/11/2014', 'serial' => '296', 'id_admin' => '642' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '272', 'id_admin' => '649' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '32', 'id_admin' => '388' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '83', 'id_admin' => '670' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '290', 'id_admin' => '638' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/11/2014', 'serial' => '95', 'id_admin' => '628' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '269', 'id_admin' => '647' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '274', 'id_admin' => '645' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '295', 'id_admin' => '566' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '294', 'id_admin' => '604' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/11/2014', 'serial' => '279', 'id_admin' => '669' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/11/2014', 'serial' => '7', 'id_admin' => '675' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/11/2014', 'serial' => '297', 'id_admin' => '651' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/11/2014', 'serial' => '284', 'id_admin' => '658' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '163', 'id_admin' => '688' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '164', 'id_admin' => '692' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '178', 'id_admin' => '682' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/11/2014', 'serial' => '13', 'id_admin' => '686' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '268', 'id_admin' => '696' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '165', 'id_admin' => '693' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '157', 'id_admin' => '536' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/11/2014', 'serial' => '162', 'id_admin' => '691' ],
'<NAME>' => [ 'status' => 'active', 'date' => '16/11/2014', 'serial' => '146', 'id_admin' => '701' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '159', 'id_admin' => '683' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '142', 'id_admin' => '603' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '145', 'id_admin' => '700' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '170', 'id_admin' => '709' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '167', 'id_admin' => '687' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/11/2014', 'serial' => '148', 'id_admin' => '704' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/11/2014', 'serial' => '143', 'id_admin' => '697' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/11/2014', 'serial' => '', 'id_admin' => '718' ],
'<NAME>' => [ 'status' => '', 'date' => '01/01/2015', 'serial' => '104', 'id_admin' => '564' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '122', 'id_admin' => '571' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '156', 'id_admin' => '707' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '126', 'id_admin' => '722' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '234', 'id_admin' => '636' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '135', 'id_admin' => '719' ],
'<NAME>' => [ 'status' => 'active', 'date' => '19/11/2014', 'serial' => '212', 'id_admin' => '717' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '210', 'id_admin' => '743' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '151', 'id_admin' => '706' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '174', 'id_admin' => '725' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '131', 'id_admin' => '720' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '237', 'id_admin' => '744' ],
'<NAME>' => [ 'status' => 'active', 'date' => '20/11/2014', 'serial' => '282', 'id_admin' => '654' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '113', 'id_admin' => '732' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '281', 'id_admin' => '652' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '166', 'id_admin' => '684' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '238', 'id_admin' => '633' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '227', 'id_admin' => '677' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '175', 'id_admin' => '736' ],
'<NAME>' => [ 'status' => 'active', 'date' => '21/11/2014', 'serial' => '116', 'id_admin' => '735' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/11/2014', 'serial' => '127', 'id_admin' => '614' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/11/2014', 'serial' => '138', 'id_admin' => '711' ],
'<NAME>' => [ 'status' => 'active', 'date' => '22/11/2014', 'serial' => '283', 'id_admin' => '655' ],
'<NAME>' => [ 'status' => 'active', 'date' => '23/11/2014', 'serial' => '276', 'id_admin' => '664' ],
'<NAME>' => [ 'status' => 'active', 'date' => '23/11/2014', 'serial' => '181', 'id_admin' => '730' ],
'<NAME>' => [ 'status' => 'active', 'date' => '25/11/2014', 'serial' => '153', 'id_admin' => '613' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/12/2014', 'serial' => '129', 'id_admin' => '716' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/12/2014', 'serial' => '136', 'id_admin' => '721' ],
'<NAME>' => [ 'status' => 'active', 'date' => '01/12/2014', 'serial' => '53', 'id_admin' => '422' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '107', 'id_admin' => '724' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '200', 'id_admin' => '612' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '173', 'id_admin' => '775' ],
'<NAME>' => [ 'status' => 'active', 'date' => '02/12/2014', 'serial' => '228', 'id_admin' => '753' ],
'<NAME>' => [ 'status' => 'active', 'date' => '03/12/2014', 'serial' => '154', 'id_admin' => '506' ],
'<NAME>' => [ 'status' => 'active', 'date' => '04/12/2014', 'serial' => '155', 'id_admin' => '554' ],
'<NAME>' => [ 'status' => 'active', 'date' => '05/12/2014', 'serial' => '255', 'id_admin' => '68' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '263', 'id_admin' => '329' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '31', 'id_admin' => '359' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '222', 'id_admin' => '488' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '11', 'id_admin' => '826' ],
'<NAME>' => [ 'status' => 'active', 'date' => '06/12/2014', 'serial' => '240', 'id_admin' => '838' ], // -> here
'<NAME>' => [ 'status' => 'active', 'date' => '07/12/2014', 'serial' => '152', 'id_admin' => '825' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/12/2014', 'serial' => '123', 'id_admin' => '833' ],
'<NAME>' => [ 'status' => 'active', 'date' => '08/12/2014', 'serial' => '161', 'id_admin' => '742' ],
'<NAME>' => [ 'status' => 'active', 'date' => '09/12/2014', 'serial' => '134', 'id_admin' => '821' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/12/2014', 'serial' => '139', 'id_admin' => '855' ],
'<NAME>' => [ 'status' => 'active', 'date' => '10/12/2014', 'serial' => '26', 'id_admin' => '859' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/12/2014', 'serial' => '987', 'id_admin' => '822' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/12/2014', 'serial' => '981', 'id_admin' => '267' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/12/2014', 'serial' => '98', 'id_admin' => '868' ],
'<NAME>' => [ 'status' => 'active', 'date' => '11/12/2014', 'serial' => '118', 'id_admin' => '842' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/12/2014', 'serial' => '293', 'id_admin' => '845' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/12/2014', 'serial' => '57', 'id_admin' => '874' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/12/2014', 'serial' => '264', 'id_admin' => '386' ],
'<NAME>' => [ 'status' => 'active', 'date' => '13/12/2014', 'serial' => '141', 'id_admin' => '831' ],
'<NAME>' => [ 'status' => 'active', 'date' => '12/12/2014', 'serial' => '59', 'id_admin' => '875' ],
'<NAME>' => [ 'status' => 'active', 'date' => '14/12/2014', 'serial' => '226', 'id_admin' => '827' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '988', 'id_admin' => '853' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '990', 'id_admin' => '856' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '185', 'id_admin' => '880' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '280', 'id_admin' => '676' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '905', 'id_admin' => '872' ],
'<NAME>' => [ 'status' => 'active', 'date' => '15/12/2014', 'serial' => '902', 'id_admin' => '877' ],
'<NAME>' => [ 'status' => 'active', 'date' => '16/12/2014', 'serial' => '999', 'id_admin' => '870' ],
'<NAME>' => [ 'status' => 'active', 'date' => '16/12/2014', 'serial' => '996', 'id_admin' => '864' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/12/2014', 'serial' => '986', 'id_admin' => '852' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/12/2014', 'serial' => '186', 'id_admin' => '873' ],
'<NAME>' => [ 'status' => 'active', 'date' => '17/12/2014', 'serial' => '267', 'id_admin' => '887' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '989', 'id_admin' => '854' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '183', 'id_admin' => '865' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '239', 'id_admin' => '879' ],
'<NAME>' => [ 'status' => 'active', 'date' => '18/12/2014', 'serial' => '117', 'id_admin' => '840' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/01/2015', 'serial' => '128', 'id_admin' => '878' ],
'<NAME>' => [ 'status' => 'active', 'date' => '07/01/2015', 'serial' => '927', 'id_admin' => '871' ],
		];

		$customers = Crunchbutton_Pexcard_Card::card_list();

		foreach( $cards as $name => $card ){
			if( trim( $card[ 'serial' ] ) == '' && $card[ 'id_admin' ] ){
				$admin = Admin::o( $card[ 'id_admin' ] );
				if( $admin->id_admin ){
					$pexcard = Cockpit_Admin_Pexcard::q( 'SELECT * FROM admin_pexcard WHERE id_admin = ' . $admin->id_admin );
					if( $pexcard->id_admin_pexcard ){
						$pexcard->id_admin = null;
						$pexcard->save();
					}
					$payment_type = $admin->payment_type();
					$payment_type->using_pex = 0;
					$payment_type->using_pex_date = null;
					$payment_type->save();
				}
			}
		}

		foreach( $cards as $name => $card ){

			$saved = false;

			if( $card[ 'status' ] == 'active' && is_numeric( $card[ 'serial' ] ) && strlen( $card[ 'date' ] ) == 10 ){

				$date = explode( '/', $card[ 'date' ] );
				$date = $date[ '2' ] . '-' . $date[ '1' ] . '-' . $date[ '0' ] . ' 00:00:01';

				$admin = Admin::o( $card[ 'id_admin' ] );

				if( $admin->id_admin ){

					$pexcard = Cockpit_Admin_Pexcard::q( 'SELECT * FROM admin_pexcard WHERE card_serial = ' . intval( $card[ 'serial' ] ) );

					if( $pexcard->id_admin_pexcard ){
						if( $pexcard->id_admin != $admin->id_admin ){
							// die( $name );
						}
					}

					foreach( $customers->body as $customer ){

						if( intval( $customer->lastName ) == intval( $card[ 'serial' ] ) ){

							$admin_pexcard = Cockpit_Admin_Pexcard::getByPexcard( $customer->id );
{'fraction_non_alphanumeric': 0.35899340424267634, 'fraction_numerical': 0.1215461405906471, 'mean_word_length': 4.41489703989704, 'pattern_counts': {'":': 0, '<': 307, '<?xml version=': 0, '>': 1851, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3435532', 'n_tokens_mistral': 16566, 'n_tokens_neox': 13783, 'n_words': 2925}