2016-09-06 15:32:52 +02:00
< ? php
2016-09-06 16:48:13 +02:00
$_SERVER [ 'REMOTE_ADDR' ] = '127.0.0.1' ;
$_SERVER [ 'HTTP_HOST' ] = 'www.bebeboutik.com' ;
//include(dirname(__FILE__) . '/../../../config/settings.inc.php');
include ( dirname ( __FILE__ ) . '/../../../config/config.inc.php' );
include ( dirname ( __FILE__ ) . '/../philea_magistor.php' );
ini_set ( 'memory_limit' , '4G' );
$id_sale = ( int ) $argv [ 1 ];
//$_id_shipping = 4; // philea
if ( $id_sale == 0 ) {
exit ;
}
2016-10-25 09:34:32 +02:00
$dateNow = date ( 'ymdHis' );
2016-09-06 16:48:13 +02:00
$magistorModule = new philea_magistor ();
$id_lang = Configuration :: get ( 'PS_LANG_DEFAULT' );
$tab_conversion_carrier = philea_magistor :: getTabState ();
$socol_to_magistor = array (
'DOM' => 'SOCOLMDSS' , // Livraison à domicile
'DOS' => 'SOCOLMDS' ,
'RDV' => 'SOCOLMRDV' , // Livraison sur Rendez-vous
'CIT' => 'SOCOLCITY' , // Livraison en Cityssimo
'BPR' => 'SOCOLMBP' , // Livraison en Bureau de Poste
'CDI' => 'SOCOLMBP' , // Centre de distribution
'A2P' => 'SOCOLMC' , // Livraison Commerce de proximité
'ACP' => 'SOCOLMBP' , // Agence ColiPoste
);
$mr_to_magistor = array (
'24R' => 'MRMDSS' , // Point relais
'DRI' => 'MRMDS' , // Colis drive
'LD1' => 'MRMRDV' , // Domicile RDC (1 pers)
'LDS' => 'MRCITY' , // Domicile spé (2 pers)
'HOM' => 'MRMBP' , // Domicile spé
);
if ( $magistorModule -> active ) {
global $regex_file_out ;
$regex_file_out = '@^CDC02(.*)\.(BAL|DAT)@' ;
@ set_time_limit ( 0 );
$db = Db :: getInstance ();
$id_order_state = 2 ;
2016-09-28 16:56:19 +02:00
// for dev
// $include_orders = array();
// foreach($db->ExecuteS('
// SELECT DISTINCT d.`id_order`
// FROM `'._DB_PREFIX_.'order_detail` d
// LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON d.`product_id` = c.`id_product`
// LEFT JOIN `'._DB_PREFIX_.'philea_sent` pms ON (pms.`id_sale` = c.`id_sale` AND pms.`id_order` = d.`id_order`)
// LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = d.`id_order`)
// WHERE oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = d.`id_order` GROUP BY moh.`id_order`)
// AND oh.`id_order_state` IN (2, 3, 4, 13, 17, 9, 18, 19)
// AND c.`id_sale` = '.(int) $id_sale.'
// AND pms.`id_order` IS NULL
// AND d.`product_quantity` - d.`product_quantity_refunded` > 0
// ') as $row) {
// $include_orders[] = (int) $row['id_order'];
// }
2016-09-06 16:48:13 +02:00
$include_orders = array ();
foreach ( $db -> ExecuteS ( '
SELECT DISTINCT o . `id_order`
FROM `'._DB_PREFIX_.'order_state_current` o
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON o . `id_order` = d . `id_order`
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON d . `product_id` = c . `id_product`
2016-09-07 11:42:38 +02:00
LEFT JOIN `'._DB_PREFIX_.'philea_sent` pms ON ( pms . `id_sale` = c . `id_sale` AND pms . `id_order` = o . `id_order` )
2016-09-06 16:48:13 +02:00
WHERE o . `id_order_state` IN ( 2 , 3 , 4 , 13 , 17 , 9 , 18 , 19 )
AND c . `id_sale` = '.(int) $id_sale.'
AND pms . `id_order` IS NULL
AND d . `product_quantity` - d . `product_quantity_refunded` > 0
' ) as $row ) {
$include_orders [] = ( int ) $row [ 'id_order' ];
}
if ( count ( $include_orders ) == 0 ) {
exit ;
}
$exclude_orders = array ();
2016-10-20 09:43:37 +02:00
foreach ( $db -> ExecuteS ( '
SELECT DISTINCT `id_order`
FROM `'._DB_PREFIX_.'philea_sent`
WHERE `id_sale` = '.(int) $id_sale.'
' ) as $row ) {
$exclude_orders [] = ( int ) $row [ 'id_order' ];
}
2016-09-06 16:48:13 +02:00
$orders = $db -> ExecuteS ( '
SELECT * FROM `'._DB_PREFIX_.'orders`
2016-10-20 09:43:37 +02:00
WHERE `date_add` > " 2016-08-30 00:00:00 "
2016-09-06 16:48:13 +02:00
'.(count($exclude_orders) > 0? ' AND `id_order` NOT IN ( '.implode(' , ', $exclude_orders).' ) ': ' ').'
'.(count($include_orders) > 0? ' AND `id_order` IN ( '.implode(' , ', $include_orders).' ) ': ' ').'
' );
if ( count ( $orders ) == 0 ) {
exit ;
}
if (( int ) Db :: getInstance () -> getValue ( '
SELECT `featured`
FROM `'._DB_PREFIX_.'privatesale`
WHERE `id_sale` = '.(int) $id_sale.'
' )) {
$code_societe = 78 ; //(int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
} else {
$code_societe = ( int )( Configuration :: get ( 'PHILEA_MAGISTOR_CODE_STE' ));
}
2016-09-07 16:17:03 +02:00
$delai_livraison = 2 ; //(int)(Configuration::get('PHILEA_MAGISTOR_DELAI_LIVRAISON'));
2016-09-06 16:48:13 +02:00
//@TODO rendre configurable le champs "reference" entre "reference" et "ean13"
$referenceField = 'reference' ; //Configuration::get('PHILEA_MAGISTOR_REF_FIELD');
2016-10-21 13:39:56 +02:00
$fileName = dirname ( __FILE__ ) . '/OUT/CDC02' . $dateNow ;
2016-09-06 16:48:13 +02:00
$repo_archive = dirname ( __FILE__ ) . '/archives/OUT/CMD/' ;
$repo_paths = array ( date ( 'Y' ), date ( 'm' ));
foreach ( $repo_paths as $repo_path ) {
$repo_archive .= $repo_path . '/' ;
if ( ! file_exists ( $repo_archive ))
mkdir ( $repo_archive );
}
$fileArchive = $repo_archive . 'CDC02' . date ( 'ymdHis' );
$data = '' ;
foreach ( $orders as $o ) {
$partialOrder = false ;
$order = new Order ( $o [ 'id_order' ]);
$products = $order -> getProducts ();
// ANTADIS
$products_ids = array ();
foreach ( $products as $product ) {
$products_ids [] = ( int ) $product [ 'product_id' ];
}
$nbProducts = 0 ;
$nbProducts = ( int ) Db :: getInstance () -> getValue ( '
SELECT COUNT ( d . `id_order_detail` )
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c ON d . `product_id` = c . `id_product`
WHERE c . `id_sale` = '.(int) $id_sale.'
AND d . `id_order` = '.(int) $o[' id_order '].'
AND d . `product_quantity` - d . `product_quantity_refunded` > 0
' );
$prid = false ;
$delivery_info = false ;
$carrier_value = false ;
if ( $nbProducts ) {
/* if ( ! Db :: getInstance () -> getValue ( '
SELECT SUM ( `product_quantity` )
FROM `'._DB_PREFIX_.'order_detail` d
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
ON c . `id_product` = d . `product_id`
WHERE d . `id_order` = '.(int) $order->id.'
AND d . `product_quantity` - GREATEST ( d . `product_quantity_return` , d . `product_quantity_refunded` ) > 0
AND c . `id_sale` = '.(int) $id_sale.'
' )) {
continue ;
} */
$carriers_socol = array ( 67 , 87 , 88 , 89 );
$customer = new Customer ( $order -> id_customer );
$address_invoice = new Address ( $order -> id_address_invoice );
$address_delivery = new Address ( $order -> id_address_delivery );
if ( in_array (( int ) $order -> id_carrier , $carriers_socol )) {
$delivery_info = $db -> getRow ( '
SELECT *
FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
WHERE `id_cart` = '.(int) $order->id_cart.'
AND `delivery_mode` != " "
' );
if ( $delivery_info ) {
$carrier_value = $socol_to_magistor [ $delivery_info [ 'delivery_mode' ]];
$prid = $delivery_info [ 'prid' ];
}
}
if ( ! $carrier_value ) {
2016-09-07 16:17:03 +02:00
$carrier_value = $tab_conversion_carrier [ $order -> id_carrier . ':' ];
2016-09-06 16:48:13 +02:00
}
/* if ( $carrier_value == 'EXAPAQ_B2B' || $carrier_value == 'EXAPAQ' )
$carrier_value = 'DPD' ; */
## ASSIGN DATA
$data .= str_pad ( 'E01' , 10 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( $code_societe , 20 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( 'OP' . ( int ) $id_sale . '-' . $order -> id , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( $order -> id_customer , 8 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( date ( 'Ymd' , strtotime ( $order -> date_add ) + 86400 * $delai_livraison ), 8 , '0' , STR_PAD_LEFT );
$data .= str_pad ( '' , 4 , '0' , STR_PAD_LEFT );
$data .= str_pad ( $carrier_value , 50 , ' ' , STR_PAD_RIGHT ); //$db->getValue('SELECT name FROM `'._DB_PREFIX_.'carrier` WHERE id_carrier = '.$order->id_carrier)
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_invoice -> firstname . ' ' . $address_invoice -> lastname )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_invoice -> company )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_invoice -> address1 )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_invoice -> address2 )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_invoice -> other )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( $address_invoice -> postcode ), 0 , 8 ), 8 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( $address_invoice -> city ), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( utf8_decode ( $db -> getValue ( 'SELECT iso_code FROM `' . _DB_PREFIX_ . 'country` WHERE id_country = ' . $address_invoice -> id_country )), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( ( ! empty ( $address_invoice -> phone_mobile ) ? $address_invoice -> phone_mobile : $address_invoice -> phone ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( $customer -> email ), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
if ( in_array (( int ) $order -> id_carrier , $carriers_socol )
&& $delivery_info
&& $delivery_info [ 'delivery_mode' ] == 'DOM'
) {
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> lastname )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_invoice -> firstname . ' ' . $address_invoice -> lastname )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
} else {
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> firstname . ' ' . $address_delivery -> lastname )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> company )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
}
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> address1 )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> address2 )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> other )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT ); //ADRESSE 3
$data .= str_pad ( substr ( utf8_decode ( $address_delivery -> postcode ), 0 , 8 ), 8 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( $address_delivery -> city ), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( utf8_decode ( $db -> getValue ( 'SELECT iso_code FROM `' . _DB_PREFIX_ . 'country` WHERE id_country = ' . $address_delivery -> id_country )), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad (( ! empty ( $address_delivery -> phone_mobile ) ? $address_delivery -> phone_mobile : $address_delivery -> phone ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
// LIVRAISON SOCOL
if ( in_array (( int ) $order -> id_carrier , $carriers_socol ) && $delivery_info ) {
if ( $delivery_info [ 'delivery_mode' ] == 'DOM' ) {
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> firstname . ' ' . $address_delivery -> lastname )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> company )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
} else {
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> lastname )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_invoice -> firstname . ' ' . $address_invoice -> lastname )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
}
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> address1 )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> address2 )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $address_delivery -> other )), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT ); //ADRESSE 3
$data .= str_pad ( substr ( utf8_decode ( $address_delivery -> postcode ), 0 , 8 ), 8 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( substr ( utf8_decode ( $address_delivery -> city ), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( utf8_decode ( $db -> getValue ( 'SELECT `iso_code` FROM `' . _DB_PREFIX_ . 'country` WHERE `id_country` = ' . $address_delivery -> id_country )), 50 , ' ' , STR_PAD_RIGHT );
2016-09-08 12:40:32 +02:00
$data .= str_pad (( isset ( $address_delivery -> phone_mobile ) ? $address_delivery -> phone_mobile : $address_delivery -> phone ), 50 , ' ' , STR_PAD_RIGHT );
2016-09-06 16:48:13 +02:00
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
}
// LIVRAISON DOMICILE
else {
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); //ADRESSE 3
$data .= str_pad ( '' , 8 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT );
}
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_1
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_2
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_3
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_4
$data .= str_pad ( $prid ? $prid : '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_5
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_6
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_7
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // INFO_RELAIS_8
2016-09-07 11:42:38 +02:00
if ( Configuration :: get ( 'PHILEA_MAGISTOR_ASSURANCE' )
&& Configuration :: get ( 'PHILEA_MAGISTOR_ASSURANCE' ) <= ( $order -> total_paid_real - $order -> total_shipping )
2016-09-06 16:48:13 +02:00
&& Configuration :: get ( 'PHILEA_MAGISTOR_ASSURANCE' ) > 0
) {
$data .= str_pad ( str_replace ( '.' , ',' ,( $order -> total_paid_real - $order -> total_shipping )), 50 , ' ' , STR_PAD_RIGHT ); // VALEUR DE COMMANDE
} else {
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // VALEUR DE COMMANDE
}
$data .= str_pad ( '' , 50 , ' ' , STR_PAD_RIGHT ); // ZONE_10
$data .= str_pad ( utf8_decode ( cleanChar ( $address_delivery -> other )), 400 , ' ' , STR_PAD_RIGHT );
$data .= PHP_EOL ;
$products = $order -> getProducts ();
$nb_ligne = 0 ;
foreach ( $products as $product )
{
if ( ! Db :: getInstance () -> getRow ( '
SELECT `id_product`
FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_sale` = '.(int) $id_sale.'
AND `id_product` = '.(int) $product[' product_id '].'
' )) {
continue ;
}
$nb_ligne ++ ;
$ean = ! empty ( $product [ 'product_ean13' ]) ? $product [ 'product_ean13' ] : $product [ 'product_supplier_reference' ];
2016-09-15 16:29:54 +02:00
$ref = ( $product [ 'product_attribute_id' ] ? $product [ 'product_id' ] . '_' . $product [ 'product_attribute_id' ] : $product [ 'product_id' ]);
2016-09-06 16:48:13 +02:00
$data .= str_pad ( 'L01' , 10 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( 'OP' . ( int ) $id_sale . '-' . $order -> id , 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( $nb_ligne , 4 , '0' , STR_PAD_LEFT );
2016-09-15 16:29:54 +02:00
$data .= str_pad ( str_replace ( array ( " \r " , " \n " ), '' , $ref ), 50 , ' ' , STR_PAD_RIGHT );
2016-09-06 16:48:13 +02:00
$data .= str_pad ( max ( $product [ 'product_quantity' ] - max ( $product [ 'product_quantity_return' ], $product [ 'product_quantity_refunded' ]), 0 ), 8 , '0' , STR_PAD_LEFT );
$data .= str_pad ( substr ( utf8_decode ( cleanChar ( $product [ 'product_name' ])), 0 , 50 ), 50 , ' ' , STR_PAD_RIGHT );
$data .= str_pad ( str_replace ( array ( " \r " , " \n " ), '' , $ean ), 14 , ' ' , STR_PAD_LEFT );
$data .= PHP_EOL ;
}
Db :: getInstance () -> ExecuteS ( '
2016-09-07 11:42:38 +02:00
INSERT INTO `'._DB_PREFIX_.'philea_sent`
2016-09-06 16:48:13 +02:00
VALUES (
'.(int) $order->id.' ,
'.(int) $id_sale.' ,
NOW ()
)
' );
} //End if nbproducts
} //End foreach
if ( $orders and is_array ( $orders ))
{
2016-10-25 09:34:32 +02:00
$file = 'CDC02' . $dateNow . '.DAT' ;
2016-10-21 13:39:56 +02:00
Db :: getInstance () -> Execute ( '
INSERT INTO `'._DB_PREFIX_.'philea_syncreport` ( `id_sale` , `filename` , `date_add` )
VALUES (
'.(int)$id_sale.' ,
2016-10-25 09:34:32 +02:00
" '.pSQL( $file ).' " ,
2016-10-21 13:39:56 +02:00
NOW ()
)
' );
2016-09-06 16:48:13 +02:00
file_put_contents ( $fileName . '.DAT' , " \xEF \xBB \xBF " . utf8_encode ( $data ));
file_put_contents ( $fileName . '.BAL' , '' );
file_put_contents ( $fileArchive . '.DAT' , " \xEF \xBB \xBF " . utf8_encode ( $data ));
require_once ( 'connection_ftp.php' );
}
}
function cleanChar ( $string ) {
$unicode_0 = json_decode ( '"\u0006"' );
$unicode_1 = json_decode ( '"\u200b"' );
$string = str_replace ( " \r \n " , ' ' , $string );
$string = str_replace ( " \r " , ' ' , $string );
$string = str_replace ( " \r " , ' ' , $string );
$string = str_replace ( " \n " , ' ' , $string );
$string = str_replace ( " \n " , ' ' , $string );
$string = str_replace ( array ( '®' , '©' , '™' ), array ( '' , '' , '' ), $string );
$string = str_replace (
array ( '"' , 'ľ' , '°' , 'º' , 'ª' , 'Á' , '°' , 'º' , 'º' , 'º' , 'ª' , " \t " , " \n " , " \r " , ' ' , '– ' , ' ' , $unicode_0 , $unicode_1 , '«' , '»' ,),
array ( '' , 'l\'' , '.' , '.' , '.' , 'A' , '' , '' , '' , '' , 'a' , ' ' , ' ' , ' ' , ' ' , '-' , '' , '' , '' , '' , '' ,),
$string
);
return str_replace ( array ( '°' , 'º' , 'ª' , '&' , ';' ), '' , $string );
}