SkayaWiki

DolibarrCheatSheet

JeromePetazzoni :: DerniersChangements :: DerniersCommentaires? :: ParametresUtilisateur :: http://www.enix.org/ :: Vous êtes ec2-3-146-178-220.us-east-2.compute.amazonaws.com


Duplicate a purchase order :

POID=00055
[ "$(mysql dolibarr -Nsr -e "SELECT COUNT(*) FROM llx_commande_fournisseur WHERE ref like '%$POID'")" = "1" ] || echo Ambigous

ROWID="$(mysql dolibarr -Nsr -e "SELECT rowid FROM llx_commande_fournisseur WHERE ref like '%$POID' LIMIT 1")" &&
NEWREF="(PROV-CL-$ROWID-$RANDOM)"
rm -f /tmp/llx.raw &&
mysql dolibarr -e "SELECT * FROM llx_commande_fournisseur WHERE rowid=$ROWID INTO OUTFILE '/tmp/llx.raw'" &&
sed -i "s/^$ROWID\t/\\\\N\t/" /tmp/llx.raw &&
sed -i "s/\tPO[^\t]*\t/\t$NEWREF\t/" /tmp/llx.raw &&
mysql dolibarr -e "LOAD DATA INFILE '/tmp/llx.raw' INTO TABLE llx_commande_fournisseur" &&
NEWID="$(mysql dolibarr -Nsr -e "SELECT rowid FROM llx_commande_fournisseur WHERE ref='$NEWREF'")" &&
[ "$(mysql dolibarr -Nsr -e "SELECT COUNT(*) FROM llx_commande_fournisseur WHERE ref='$NEWREF'")" = "1" ] &&
mysql dolibarr -e "UPDATE llx_commande_fournisseur SET fk_statut=0 WHERE rowid=$NEWID" &&
rm -f /tmp/llx.raw &&
mysql dolibarr -e "SELECT * FROM llx_commande_fournisseurdet where fk_commande=$ROWID INTO OUTFILE '/tmp/llx.raw'" &&
sed -i "s/^[^\t]*\t$ROWID\t/\\\\N\t$NEWID\t/" /tmp/llx.raw &&
mysql dolibarr -e "LOAD DATA INFILE '/tmp/llx.raw' INTO TABLE llx_commande_fournisseurdet" &&
echo "https://dolibarr.sipartech.com/fourn/commande/fiche.php?id=$NEWID"



Cleanup purchase order :

mysql dolibarr -e "SELECT description FROM llx_commande_fournisseurdet WHERE description LIKE '%span>'"
mysql dolibarr
UPDATE llx_commande_fournisseurdet SET description=REPLACE(description,
,'') WHERE description LIKE '%span>' ;

Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]