Skip to content

Commit

Permalink
str_replace --> preg_replace
Browse files Browse the repository at this point in the history
  • Loading branch information
juppe committed Feb 9, 2016
1 parent a2f98e8 commit 6093508
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion inc/unifaun_send.inc
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class Unifaun {
//$uni_snd_val = $uni_sender->addChild('val', ""); # Organisation number (only for Sweden)
//$uni_snd_val->addAttribute('n', "orgno");

$uni_snd_val = $uni_sender->addChild('val', utf8_encode(str_replace("0037", "FI", $this->postirow["yhtio_ovttunnus"]))); // VAT number
$uni_snd_val = $uni_sender->addChild('val', utf8_encode(preg_replace("/^0037/", "FI", $this->postirow["yhtio_ovttunnus"]))); // VAT number
$uni_snd_val->addAttribute('n', "vatno");

$uni_snd_val = $uni_sender->addChild('val', utf8_encode($this->sanitizeEmails($this->yhtiorow["email"]))); // E-mail
Expand Down
6 changes: 3 additions & 3 deletions inc/verkkolasku-in.inc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ if (!function_exists("verkkolasku_in")) {

if (!isset($yhtiorow) and $verkkotunnus_vas != 0) {
// 4 etsitään vastaanottavaa yritystä ytunnuksella..
$yyhtio1 = substr(str_replace("0037", "", $verkkotunnus_vas), 0, 8); // mahdollisella etunollalla
$yyhtio1 = substr(preg_replace("/^0037/", "", $verkkotunnus_vas), 0, 8); // mahdollisella etunollalla
$yyhtio2 = (int) $yyhtio1; // ilman etunollaa

$query = "SELECT * FROM yhtio WHERE ytunnus in ('$yyhtio1', '$yyhtio2')";
Expand Down Expand Up @@ -221,7 +221,7 @@ if (!function_exists("verkkolasku_in")) {

if (!isset($yhtiorow) and $yhtio != "" and $yhtio != 0) {
// 8 etsitään vastaanottavaa yritystä ytunnuksella..
$yyhtio3 = substr(str_replace("0037", "", $yhtio), 0, 8); // mahdollisella etunollalla
$yyhtio3 = substr(preg_replace("/^0037/", "", $yhtio), 0, 8); // mahdollisella etunollalla
$yyhtio4 = (int) $yyhtio3; // ilman etunollaa

$query = "SELECT * FROM yhtio WHERE ytunnus in ('$yyhtio3', '$yyhtio4')";
Expand Down Expand Up @@ -398,7 +398,7 @@ if (!function_exists("verkkolasku_in")) {

if (!isset($trow) and $laskuttajan_ovt != "") {
// 5 etsitään toimittaja ytunnuksella
$yovt1 = substr(str_replace("0037", "", $laskuttajan_ovt), 0, 8); // mahdollisella etunollalla
$yovt1 = substr(preg_replace("/^0037/", "", $laskuttajan_ovt), 0, 8); // mahdollisella etunollalla
$yovt2 = (int) $yovt1; // ilman etunollaa

$query = "SELECT *
Expand Down
4 changes: 2 additions & 2 deletions tilauskasittely/rahtikirja_postitarra_ulkomaa_pdf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ for ($tulostuskpl=1; $tulostuskpl<=$tulostakolli; $tulostuskpl++) {

$pdf->draw_text(115, 500, "Sender's business ID /", $firstpage, $pieni);
$pdf->draw_text(115, 495, "No de T.V.A. de l'expéditeur", $firstpage, $pieni);
$pdf->draw_text(185, 500, $postirow["yhtio_maa"]."-".str_replace("0037", "", $postirow["yhtio_ovttunnus"]), $firstpage, $norm);
$pdf->draw_text(185, 500, $postirow["yhtio_maa"]."-".preg_replace("/^0037/", "", $postirow["yhtio_ovttunnus"]), $firstpage, $norm);


$pdf->draw_text(18, 485, "Recipient (name and address) / Destinataire (nom et adresse)", $firstpage, $pieni);
Expand All @@ -233,7 +233,7 @@ for ($tulostuskpl=1; $tulostuskpl<=$tulostakolli; $tulostuskpl++) {
$pdf->draw_text(115, 420, "No de T.V.A.", $firstpage, $pieni);

if ($rakir_row["ovttunnus"] != "") {
$pdf->draw_text(155, 420, $rakir_row['maa']."-".str_replace("0037", "", $rakir_row["ovttunnus"]), $firstpage, $norm);
$pdf->draw_text(155, 420, $rakir_row['maa']."-".preg_replace("/^0037/", "", $rakir_row["ovttunnus"]), $firstpage, $norm);
}

// tuoteviivakoodin alle
Expand Down
2 changes: 1 addition & 1 deletion tilauskasittely/tulosta_asiakkaan_kuitti.inc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function tulosta_asiakkaan_kuitti($laskunro, $tulostimen_tunnus, $params = array
$yhtion_osoite = $lasku['yhtio_osoite'];
$yhtion_postino = $lasku['yhtio_postino'];
$yhtion_postitp = $lasku['yhtio_postitp'];
$yhtion_ytunnus = str_replace("0037", "", $lasku["yhtio_ovttunnus"]);
$yhtion_ytunnus = preg_replace("/^0037/", "", $lasku["yhtio_ovttunnus"]);
$yhtion_ytunnus = tulosta_ytunnus($yhtion_ytunnus, $lasku['yhtio_maa']);
$myyjan_nimi = $lasku['myyjan_nimi'];
$asiakkaan_kieli = $lasku["asiakkaan_kieli"];
Expand Down
8 changes: 4 additions & 4 deletions tilauskasittely/tulosta_elexvientiilmo.inc
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ if (mysql_num_rows($uresult) > 0) {
$Declaration = $FIExportDeclaration->appendChild($xml->createElement('Declaration'));
$Exporter = $Declaration->appendChild($xml->createElement('Exporter'));
$params = array();
$params['identity'] = tulosta_ytunnus(substr(str_replace("0037", "", $yhtiorow["ovttunnus"]), 0, 8), "", "V");
$params['identityExtension'] = substr(str_replace("0037", "", $yhtiorow["ovttunnus"]), 8);
$params['identity'] = tulosta_ytunnus(substr(preg_replace("/^0037/", "", $yhtiorow["ovttunnus"]), 0, 8), "", "V");
$params['identityExtension'] = substr(preg_replace("/^0037/", "", $yhtiorow["ovttunnus"]), 8);
$params['name1'] = $yhtiorow["nimi"];
//$params['name2'] = $yhtiorow["nimitark"];
$params['line'] = $yhtiorow["osoite"];
Expand All @@ -206,8 +206,8 @@ if (mysql_num_rows($uresult) > 0) {

$Agent = $Declaration->appendChild($xml->createElement('Agent'));
$params = array();
$params['identity'] = tulosta_ytunnus(substr(str_replace("0037", "", $lisrow["kolm_ovttunnus"]), 0, 8), "", "V");
$params['identityExtension'] = substr(str_replace("0037", "", $lisrow["kolm_ovttunnus"]), 8);
$params['identity'] = tulosta_ytunnus(substr(preg_replace("/^0037/", "", $lisrow["kolm_ovttunnus"]), 0, 8), "", "V");
$params['identityExtension'] = substr(preg_replace("/^0037/", "", $lisrow["kolm_ovttunnus"]), 8);
$params['name1'] = $lisrow["kolm_nimi"];
$params['name2'] = $lisrow["kolm_nimitark"];
$params['line'] = $lisrow["kolm_osoite"];
Expand Down
6 changes: 3 additions & 3 deletions tilauskasittely/tulosta_lahete.inc
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ if (!function_exists('alku_lahete')) {
$pdf->draw_text(150, 730, $ff_string, $thispage, $ff_font);

$pdf->draw_text(50, 717, t("Y-tunnus", $kieli), $thispage, $boldi);
$pdf->draw_text(150, 717, tulosta_ytunnus(str_replace("0037", "", $laskurow["yhtio_ovttunnus"]), $laskurow["yhtio_maa"], $laskurow["vienti"]), $thispage, $norm);
$pdf->draw_text(150, 717, tulosta_ytunnus(preg_replace("/^0037/", "", $laskurow["yhtio_ovttunnus"]), $laskurow["yhtio_maa"], $laskurow["vienti"]), $thispage, $norm);

$pdf->draw_text(50, 704, t("Nimi", $kieli), $thispage, $boldi);
$pdf->draw_text(150, 704, $yhtiorow["nimi"], $thispage, $norm);
Expand Down Expand Up @@ -3512,7 +3512,7 @@ if (!function_exists('loppu_lahete')) {
$y_postitp = $GLOBALS['eta_yhtio_postitp'];
$y_maa = $GLOBALS['eta_yhtio_maa'];
$y_kotipaikka = $GLOBALS['eta_yhtio_kotipaikka'];
$y_vatnumero = str_replace("0037", "", $GLOBALS['eta_yhtio_ovttunnus']);
$y_vatnumero = preg_replace("/^0037/", "", $GLOBALS['eta_yhtio_ovttunnus']);
$y_kotipaikka = $GLOBALS['eta_yhtio_kotipaikka'];
$y_iban = "";
$y_swift = "";
Expand All @@ -3526,7 +3526,7 @@ if (!function_exists('loppu_lahete')) {
$y_postitp = $laskurow["yhtio_postitp"];
$y_maa = $laskurow["yhtio_maa"];
$y_kotipaikka = $laskurow["yhtio_kotipaikka"];
$y_vatnumero = str_replace("0037", "", $laskurow["yhtio_ovttunnus"]);
$y_vatnumero = preg_replace("/^0037/", "", $laskurow["yhtio_ovttunnus"]);
$y_iban = $yhtiorow['pankkiiban1'];
$y_swift = $yhtiorow['pankkiswift1'];

Expand Down
2 changes: 1 addition & 1 deletion tilauskasittely/tulosta_lahete_kerayslista.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ if (!function_exists('loppu_kerayslista')) {
$y_postitp = $laskurow["yhtio_postitp"];
$y_maa = $laskurow["yhtio_maa"];
$y_kotipaikka = $laskurow["yhtio_kotipaikka"];
$y_vatnumero = str_replace("0037", "", $laskurow["yhtio_ovttunnus"]);
$y_vatnumero = preg_replace("/^0037/", "", $laskurow["yhtio_ovttunnus"]);
$y_iban = $yhtiorow['pankkiiban1'];
$y_swift = $yhtiorow['pankkiswift1'];

Expand Down
4 changes: 2 additions & 2 deletions tilauskasittely/tulosta_lasku.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2201,10 +2201,10 @@ if (!function_exists('loppu')) {
$y_vatnumero = $yhtiorow["ytunnus"];
}
elseif (!empty($toimipaikkarow["vat_numero"])) {
$y_vatnumero = str_replace("0037", "", $toimipaikkarow["vat_numero"]);
$y_vatnumero = preg_replace("/^0037/", "", $toimipaikkarow["vat_numero"]);
}
else {
$y_vatnumero = str_replace("0037", "", $laskurow["yhtio_ovttunnus"]);
$y_vatnumero = preg_replace("/^0037/", "", $laskurow["yhtio_ovttunnus"]);
}
$y_iban = $yhtiorow['pankkiiban1'];
$y_swift = $yhtiorow['pankkiswift1'];
Expand Down
4 changes: 2 additions & 2 deletions tilauskasittely/tulosta_tarjous.inc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ if (!function_exists('alku_tarjous')) {
$pdf_tarjous->draw_text(150, 730, $ff_string, $page_tarjous[$sivu], $ff_font);

$pdf_tarjous->draw_text(50, 717, t("Y-tunnus", $kieli), $page_tarjous[$sivu], $boldi);
$pdf_tarjous->draw_text(150, 717, tulosta_ytunnus(str_replace("0037", "", $laskurow["yhtio_ovttunnus"]), $laskurow["yhtio_maa"], $laskurow["vienti"]), $page_tarjous[$sivu], $norm);
$pdf_tarjous->draw_text(150, 717, tulosta_ytunnus(preg_replace("/^0037/", "", $laskurow["yhtio_ovttunnus"]), $laskurow["yhtio_maa"], $laskurow["vienti"]), $page_tarjous[$sivu], $norm);

$pdf_tarjous->draw_text(50, 704, t("Nimi", $kieli), $page_tarjous[$sivu], $boldi);
$pdf_tarjous->draw_text(150, 704, $yhtiorow['nimi'], $page_tarjous[$sivu], $norm);
Expand Down Expand Up @@ -1334,7 +1334,7 @@ if (!function_exists('loppu_tarjous')) {
$y_postitp = $laskurow["yhtio_postitp"];
$y_maa = $laskurow["yhtio_maa"];
$y_kotipaikka = $laskurow["yhtio_kotipaikka"];
$y_vatnumero = str_replace("0037", "", $laskurow["yhtio_ovttunnus"]);
$y_vatnumero = preg_replace("/^0037/", "", $laskurow["yhtio_ovttunnus"]);
$y_iban = $yhtiorow['pankkiiban1'];
$y_swift = $yhtiorow['pankkiswift1'];

Expand Down
2 changes: 1 addition & 1 deletion tilauskasittely/tulosta_vakerittely.inc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ if (!function_exists('vakadr_loppu')) {
$y_postitp = $laskurow["yhtio_postitp"];
$y_maa = $laskurow["yhtio_maa"];
$y_kotipaikka = $laskurow["yhtio_kotipaikka"];
$y_vatnumero = str_replace("0037", "", $laskurow["yhtio_ovttunnus"]);
$y_vatnumero = preg_replace("/^0037/", "", $laskurow["yhtio_ovttunnus"]);
$y_iban = $yhtiorow['pankkiiban1'];
$y_swift = $yhtiorow['pankkiswift1'];

Expand Down
6 changes: 3 additions & 3 deletions tilauskasittely/verkkolasku_finvoice.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ if (!function_exists('finvoice_otsik')) {
$tulostuspalvelu = "";
break;
}

// Trustkapitalilla pitä olla TULOSTUSPALVELU
if ($senderintermediator == '003723327487' and $yhtiorow['verkkolasku_lah'] == 'trustpoint') {
$tulostuspalvelu = "TULOSTUSPALVELU";
}

// Aloitellaan aineiston luontia. Kaikki tiedot pitää olla kunnossa, tai chn 112 "Pupesoft-Finvoice: Verkkolasku Pupesoftista-Pupesoftiin"
if (($senderpartyid != "" and $senderintermediator != "" and $tulostuspalvelu != "") or $lasrow["chn"] == "112") {

Expand Down Expand Up @@ -245,7 +245,7 @@ if (!function_exists('finvoice_otsik')) {
xml_add("SellerPartyIdentifier", tulosta_ytunnus($yhtiorow['ytunnus'], $y_maa), $tootfinvoice, 35);
//xml_add("SellerPartyIdentifierUrlText", "", $tootfinvoice);
xml_add("SellerOrganisationName", $y_nimi, $tootfinvoice, 35, 2);
xml_add("SellerOrganisationTaxCode", tulosta_ytunnus(str_replace("0037", "", $y_vatnumero), $y_maa, "VATNUMERO"), $tootfinvoice, 35);
xml_add("SellerOrganisationTaxCode", tulosta_ytunnus(preg_replace("/^0037/", "", $y_vatnumero), $y_maa, "VATNUMERO"), $tootfinvoice, 35);
//xml_add("SellerOrganisationTaxCodeUrlText", "", $tootfinvoice);

fputs($tootfinvoice, "<SellerPostalAddressDetails>\r\n");
Expand Down
2 changes: 1 addition & 1 deletion tilauskasittely/verkkolasku_finvoice_201.inc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ if (!function_exists('finvoice_otsik')) {
fputs($tootfinvoice, "<SellerPartyDetails>\r\n");
xml_add("SellerPartyIdentifier", tulosta_ytunnus($yhtiorow['ytunnus'], $y_maa), $tootfinvoice, 35);
xml_add("SellerOrganisationName", $y_nimi, $tootfinvoice, 70, 2);
xml_add("SellerOrganisationTaxCode", tulosta_ytunnus(str_replace("0037", "", $y_vatnumero), $y_maa, "VATNUMERO"), $tootfinvoice, 35);
xml_add("SellerOrganisationTaxCode", tulosta_ytunnus(preg_replace("/^0037/", "", $y_vatnumero), $y_maa, "VATNUMERO"), $tootfinvoice, 35);

fputs($tootfinvoice, "<SellerPostalAddressDetails>\r\n");
xml_add("SellerStreetName", $y_osoite, $tootfinvoice, 35, 2);
Expand Down
2 changes: 1 addition & 1 deletion verkkolaskuvirheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@

if (!isset($trow) and $laskuttajan_ovt != "") {
// 5 etsitään toimittaja ytunnuksella
$yovt1 = substr(str_replace("0037", "", $laskuttajan_ovt), 0, 8); // mahdollisella etunollalla
$yovt1 = substr(preg_replace("/^0037/", "", $laskuttajan_ovt), 0, 8); // mahdollisella etunollalla
$yovt2 = (int) $yovt1; // ilman etunollaa

$query = "SELECT *
Expand Down

0 comments on commit 6093508

Please sign in to comment.