From 686f07f6423dd40f480ca257042cf3248b25d115 Mon Sep 17 00:00:00 2001 From: Daniel Seifert Date: Tue, 30 Jun 2020 09:26:28 +0200 Subject: [PATCH] add shell scripts for changing article tax rates via mysql command --- bin/raiseArticleTaxMysql | 32 ++++++++++++++++++++++++++++++++ bin/reduceArticleTaxMysql | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 bin/raiseArticleTaxMysql create mode 100644 bin/reduceArticleTaxMysql diff --git a/bin/raiseArticleTaxMysql b/bin/raiseArticleTaxMysql new file mode 100644 index 0000000..0a9ef74 --- /dev/null +++ b/bin/raiseArticleTaxMysql @@ -0,0 +1,32 @@ +#!/bin/bash + +# Mail-Versand erfolgt bei Profihost ueber den Cronjob selbst, andere Provider erfordern ggf. expliziten Versand + +TODAY=$(date) +HOST=$(hostname) +DOMAIN='myhost.de' + +DOMAIN='myhost.de' +MYSQLUSER='mysql_user' +MYSQLPASS='mysql_pass' +MYSQLDB='mysql_db' +MYSQLHOST='127.0.0.1' +MYSQLPORT='3306' + +echo "------------------------------------------------------------------------------------------" +echo "USt.-Anpassung 01.01.2021" +echo "Date: $TODAY Host: $HOST ($DOMAIN)" +echo "------------------------------------------------------------------------------------------" + +printf '\n 16%% -> 19%%\n\n' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Vor Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 16;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'UPDATE oxarticles SET oxvat = 19 WHERE oxvat = 16;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Nach Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 16;' +printf '\n' + +echo "------------------------------------------------------------------------------------------" +printf '\n 5%% -> 7%%\n\n' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Vor Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 5;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'UPDATE oxarticles SET oxvat = 7 WHERE oxvat = 5;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Nach Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 5;' +printf '\n' diff --git a/bin/reduceArticleTaxMysql b/bin/reduceArticleTaxMysql new file mode 100644 index 0000000..4a5e8b0 --- /dev/null +++ b/bin/reduceArticleTaxMysql @@ -0,0 +1,32 @@ +#!/bin/bash + +# Mail-Versand erfolgt bei Profihost ueber den Cronjob selbst, andere Provider erfordern ggf. expliziten Versand + +TODAY=$(date) +HOST=$(hostname) +DOMAIN='myhost.de' + +DOMAIN='myhost.de' +MYSQLUSER='mysql_user' +MYSQLPASS='mysql_pass' +MYSQLDB='mysql_db' +MYSQLHOST='127.0.0.1' +MYSQLPORT='3306' + +echo "------------------------------------------------------------------------------------------" +echo "USt.-Anpassung 01.07.2020" +echo "Date: $TODAY Host: $HOST ($DOMAIN)" +echo "------------------------------------------------------------------------------------------" + +printf '\n 19%% -> 16%%\n\n' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Vor Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 19;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'UPDATE oxarticles SET oxvat = 16 WHERE oxvat = 19;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Nach Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 19;' +printf '\n' + +echo "------------------------------------------------------------------------------------------" +printf '\n 7%% -> 5%%\n\n' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Vor Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 7;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'UPDATE oxarticles SET oxvat = 5 WHERE oxvat = 7;' +mysql5 -u$MYSQLUSER -p$MYSQLPASS -D$MYSQLDB -h$MYSQLHOST -P$MYSQLPORT -e 'SELECT CONCAT("Nach Umstellung: ", COUNT(*), " Artikel gefunden") as result FROM oxarticles WHERE oxvat = 7;' +printf '\n'