#!/bin/sh
. ./patch-lib

case $DEBUG in
  1) debug_mode 1
     ;;
  *)
     ;;
esac

log "Patch 2.4 start..."

# facturation générale des devis
patch241() {
	intit="[PATCH 241] Perf : mise en base du calcul du montant des devis"
	echo -e "\t$intit"
	log "$intit"
	exec_sql "BEGIN ; \
ALTER TABLE devis ADD COLUMN montant_ht_calc int4; \
ALTER TABLE devis ALTER COLUMN montant_ht_calc SET DEFAULT 0; \
UPDATE DEVIS SET  montant_ht_calc = 0; \
END;"
}

patch241bis() {
	echo "I an trying to load http://$DBHOST/pimengest2/php4/index.php?patch_241_update_base=1"
	echo "If it does't work, please login on pimengest2 and load go to this URL"

	wget -O /tmp/pimengest2-patch241 http://${DBHOST}/pimengest2/php4/index.php?patch_241_update_base=1
}

################################################
#                                              #
#      ECRIVEZ ICI LES PATCHES SOUHAITES       #
#        PimenTech ne supporte que la          #
#        version entierement patchée !         #
#                                              #
################################################

patch241
patch241bis

log "Patch 2.4 done."

