diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 41028cdbe372b56f1fafa84e4edd57b20ce16ec3..717208b704e3c41e8dcf1d17469b73581a1e8612 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1,13 +1,13 @@ <?php -/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> - * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> - * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> - * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> - * Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr> - * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> - * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> +/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> + * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2005 Marc Barilley <marc@ocebo.com> + * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> + * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> + * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1787,75 +1787,87 @@ class Propal extends CommonObject $error=0; $this->db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id; - if ($this->db->query($sql)) + + if (! $error && ! $notrigger) + { + // Call triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PROPAL_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // End call triggers + } + + if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id; if ($this->db->query($sql)) { - // Delete linked object - $res = $this->deleteObjectLinked(); - if ($res < 0) $error++; - - // Delete linked contacts - $res = $this->delete_linked_contact(); - if ($res < 0) $error++; - - if (! $error) + $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id; + if ($this->db->query($sql)) { - // We remove directory - $propalref = dol_sanitizeFileName($this->ref); - if ($conf->propale->dir_output) + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + + // Delete linked contacts + $res = $this->delete_linked_contact(); + if ($res < 0) $error++; + + if (! $error) { - $dir = $conf->propale->dir_output . "/" . $propalref ; - $file = $conf->propale->dir_output . "/" . $propalref . "/" . $propalref . ".pdf"; - if (file_exists($file)) + // We remove directory + $propalref = dol_sanitizeFileName($this->ref); + if ($conf->propale->dir_output) { - dol_delete_preview($this); - - if (!dol_delete_file($file)) + $dir = $conf->propale->dir_output . "/" . $propalref ; + $file = $conf->propale->dir_output . "/" . $propalref . "/" . $propalref . ".pdf"; + if (file_exists($file)) { - $this->error='ErrorFailToDeleteFile'; - $this->db->rollback(); - return 0; + dol_delete_preview($this); + + if (!dol_delete_file($file)) + { + $this->error='ErrorFailToDeleteFile'; + $this->db->rollback(); + return 0; + } } - } - if (file_exists($dir)) - { - $res=@dol_delete_dir($dir); - if (! $res) + if (file_exists($dir)) { - $this->error='ErrorFailToDeleteDir'; - $this->db->rollback(); - return 0; + $res=@dol_delete_dir($dir); + if (! $res) + { + $this->error='ErrorFailToDeleteDir'; + $this->db->rollback(); + return 0; + } } } } - } - - if (! $error && ! $notrigger) - { - // Call triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // End call triggers - } - - if (! $error) - { - dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG); - $this->db->commit(); - return 1; + + if (! $error) + { + dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG); + $this->db->commit(); + return 1; + } + else + { + $this->error=$this->db->lasterror(); + dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); + $this->db->rollback(); + return 0; + } } else { $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); - return 0; + return -3; } } else @@ -1869,8 +1881,8 @@ class Propal extends CommonObject else { $this->error=$this->db->lasterror(); - dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); - $this->db->rollback(); + dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); + $this->db->rollback(); return -1; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index a8457896ed4306f928ecc751a6042e3cc8642175..46859b8e251928690fd860d9bdb3b842a8ab99fc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1,7 +1,7 @@ <?php /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> - * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> @@ -2315,69 +2315,74 @@ class Commande extends CommonObject $error = 0; $this->db->begin(); - - // Delete order details - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; - dol_syslog("Commande::delete sql=".$sql); - if (! $this->db->query($sql) ) - { - dol_syslog(get_class($this)."::delete error", LOG_ERR); - $error++; - } - - // Delete order - $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); - if (! $this->db->query($sql) ) + + if (! $error && ! $notrigger) { - dol_syslog(get_class($this)."::delete error", LOG_ERR); - $error++; + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('ORDER_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers } - - // Delete linked object - $res = $this->deleteObjectLinked(); - if ($res < 0) $error++; - - // Delete linked contacts - $res = $this->delete_linked_contact(); - if ($res < 0) $error++; - - // On efface le repertoire de pdf provisoire - $comref = dol_sanitizeFileName($this->ref); - if ($conf->commande->dir_output) - { - $dir = $conf->commande->dir_output . "/" . $comref ; - $file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf"; - if (file_exists($file)) // We must delete all files before deleting directory - { - dol_delete_preview($this); - - if (!dol_delete_file($file)) - { - $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); - $this->db->rollback(); - return 0; - } - } - if (file_exists($dir)) - { - if (!dol_delete_dir($dir)) - { - $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir); - $this->db->rollback(); - return 0; - } - } - } - - if (! $error && ! $notrigger) + + if (! $error) { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('ORDER_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers + // Delete order details + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; + dol_syslog("Commande::delete sql=".$sql); + if (! $this->db->query($sql) ) + { + dol_syslog(get_class($this)."::delete error", LOG_ERR); + $error++; + } + + // Delete order + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; + dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG); + if (! $this->db->query($sql) ) + { + dol_syslog(get_class($this)."::delete error", LOG_ERR); + $error++; + } + + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + + // Delete linked contacts + $res = $this->delete_linked_contact(); + if ($res < 0) $error++; + + // On efface le repertoire de pdf provisoire + $comref = dol_sanitizeFileName($this->ref); + if ($conf->commande->dir_output) + { + $dir = $conf->commande->dir_output . "/" . $comref ; + $file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf"; + if (file_exists($file)) // We must delete all files before deleting directory + { + dol_delete_preview($this); + + if (!dol_delete_file($file)) + { + $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); + $this->db->rollback(); + return 0; + } + } + if (file_exists($dir)) + { + if (!dol_delete_dir($dir)) + { + $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir); + $this->db->rollback(); + return 0; + } + } + } } if (! $error) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b8b580f04548bf5927adf2a5935690b89b9da0cc..506c60327e8d8b3363dfc2911cf6487eeafd947a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> - * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> @@ -1131,10 +1131,25 @@ class Facture extends CommonObject $error=0; $this->db->begin(); - - // Delete linked object - $res = $this->deleteObjectLinked(); - if ($res < 0) $error++; + + if (! $error && ! $notrigger) + { + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('BILL_DELETE',$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + } + + if (! $error) + { + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + } if (! $error) { @@ -1177,16 +1192,6 @@ class Facture extends CommonObject $resql=$this->db->query($sql); if ($resql) { - if (! $notrigger) - { - // Appel des triggers - include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); - $interface=new Interfaces($this->db); - $result=$interface->run_triggers('BILL_DELETE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } - // Fin appel triggers - } - $this->db->commit(); return 1; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d15a1eb133d38452ddd69ab0db0907f2c1167898..50e0372adce3934662951251e99223fadfc6e0a3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1562,7 +1562,7 @@ abstract class CommonObject { // Parse element/subelement (ex: project_task) $module = $element = $subelement = $objecttype; - if (preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) + if ($objecttype != 'order_supplier' && $objecttype != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$objecttype,$regs)) { $module = $element = $regs[1]; $subelement = $regs[2]; @@ -1583,8 +1583,8 @@ abstract class CommonObject else if ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } - else if ($objecttype == 'invoice_supplier') { - $classpath = 'fourn/class'; + else if ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { + $classpath = 'fourn/class'; $module = 'fournisseur'; } else if ($objecttype == 'order_supplier') { $classpath = 'fourn/class'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index fde9f1a237b4dee10c0cb1416a014030dadde98d..9995aaa152efb5e991844b42b1eead0e7701690e 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -1,30 +1,30 @@ <?php -/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> -* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> -* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.fr> -* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> -* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ +/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> + * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> + * Copyright (C) 2005 Marc Barilley <marc@ocebo.fr> + * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> + * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ /** * \file htdocs/fourn/facture/fiche.php -* \ingroup facture, fournisseur -* \brief Page for supplier invoice card (view, edit, validate) -*/ + * \ingroup facture, fournisseur + * \brief Page for supplier invoice card (view, edit, validate) + */ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); @@ -126,14 +126,19 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse } } -if ($action == 'confirm_deleteproductline' && $confirm == 'yes') +if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) { - if ($user->rights->fournisseur->facture->creer) - { - $object->fetch($id); - $object->deleteline(GETPOST('lineid')); - $action = ''; - } + $object->fetch($id); + $ret = $object->deleteline(GETPOST('lineid')); + if ($ret > 0) + { + Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); + exit; + } + else + { + $mesg='<div class="error">'.$object->error.'</div>'; + } } if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) @@ -187,37 +192,6 @@ if($action == 'deletepaiement') } } -if ($action == 'update' && ! $_POST['cancel']) -{ - $error=0; - - $date = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $date_echeance = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); - - if (! $date) - { - $msg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEch")); - $error++; - } - if ($date_echeance && $date_echeance < $date) - { - $date_echeance = $date; - } - - if (! $error) - { - // TODO move to DAO class - $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn set '; - $sql .= " facnumber='".$db->escape(trim($_POST['facnumber']))."'"; - $sql .= ", libelle='".$db->escape(trim($_POST['libelle']))."'"; - $sql .= ", note='".$db->escape($_POST['note'])."'"; - $sql .= ", datef = '".$db->idate($date)."'"; - $sql .= ", date_lim_reglement = '".$db->idate($date_echeance)."'"; - $sql .= ' WHERE rowid = '.$id; - $result = $db->query($sql); - } -} - // Create if ($action == 'add' && $user->rights->fournisseur->facture->creer) { @@ -404,13 +378,6 @@ if ($action == 'add' && $user->rights->fournisseur->facture->creer) } } -if ($action == 'del_ligne') -{ - $object->fetch($id); - $object->deleteline(GETPOST('lineid')); - $action = 'edit'; -} - // Modification d'une ligne if ($action == 'update_line') { @@ -434,7 +401,7 @@ if ($action == 'update_line') $prod = new Product($db); $prod->fetch($_POST['idprod']); $label = $prod->description; - if (trim($_POST['label']) != trim($label)) $label=$_POST['label']; + if (trim($_POST['desc']) != trim($label)) $label=$_POST['desc']; $type = $prod->type; $localtax1tx = $prod->localtax1_tx; @@ -447,7 +414,7 @@ if ($action == 'update_line') $societe=new Societe($db); $societe->fetch($object->socid); } - $label = $_POST['label']; + $label = $_POST['desc']; $type = $_POST["type"]?$_POST["type"]:0; $localtax1tx= get_localtax($_POST['tauxtva'], 1, $societe); $localtax2tx= get_localtax($_POST['tauxtva'], 2, $societe); @@ -512,9 +479,9 @@ if ($action == 'addline') $localtax1tx= get_localtax($tauxtva, 1, $societe); $localtax2tx= get_localtax($tauxtva, 2, $societe); - if (! $_POST['label']) + if (! $_POST['dp_desc']) { - $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>'; + $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")).'</div>'; } else { @@ -525,14 +492,14 @@ if ($action == 'addline') $price_base_type = 'HT'; //$desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0) - $result=$object->addline($_POST['label'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, 0, $datestart, $dateend, 0, 0, $price_base_type, $type); + $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva, $localtax1tx, $localtax2tx, $_POST['qty'], 0, 0, $datestart, $dateend, 0, 0, $price_base_type, $type); } else { $ttc = price2num($_POST['amountttc']); $ht = $ttc / (1 + ($tauxtva / 100)); $price_base_type = 'HT'; - $result=$object->addline($_POST['label'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, 0, $datestart, $dateend, 0, 0, $price_base_type, $type); + $result=$object->addline($_POST['dp_desc'], $ht, $tauxtva,$localtax1tx, $localtax2tx, $_POST['qty'], 0, 0, $datestart, $dateend, 0, 0, $price_base_type, $type); } } } @@ -1170,7 +1137,7 @@ else // Confirmation de la suppression d'une ligne produit if ($action == 'confirm_delete_line') { - $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteproductline', '', 1, 1); + $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$_GET["lineid"], $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 1, 1); if ($ret == 'html') print '<br>'; } @@ -1285,10 +1252,9 @@ else print '</td></tr>'; // Label - print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td><td colspan="3">'; - print $form->editfieldval("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)); - print '</td>'; - + print '<tr><td>'.$form->editfieldkey("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td>'; + print '<td colspan="3">'.$form->editfieldval("Label",'label',$object->label,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer)).'</td>'; + /* * List of payments */ @@ -1370,13 +1336,13 @@ else print '</tr>'; // Date - print '<tr><td>'.$form->editfieldkey("Date",'date',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0)).'</td><td colspan="3">'; - print $form->editfieldval("Date",'date',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'day'); + print '<tr><td>'.$form->editfieldkey("Date",'date',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker').'</td><td colspan="3">'; + print $form->editfieldval("Date",'date',$object->datep,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker'); print '</td>'; // Due date - print '<tr><td>'.$form->editfieldkey("DateMaxPayment",'date_echeance',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0)).'</td><td colspan="3">'; - print $form->editfieldval("DateMaxPayment",'date_echeance',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'day'); + print '<tr><td>'.$form->editfieldkey("DateMaxPayment",'date_echeance',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker').'</td><td colspan="3">'; + print $form->editfieldval("DateMaxPayment",'date_echeance',$object->date_echeance,$object,($object->statut<2 && $user->rights->fournisseur->facture->creer && $object->getSommePaiement() <= 0),'datepicker'); print '</td>'; // Status @@ -1471,7 +1437,7 @@ else $var=!$var; // Edit line - if ($object->statut == 0 && $action == 'mod_ligne' && $_GET['etat'] == '0' && $_GET['lineid'] == $object->lines[$i]->rowid) + if ($object->statut == 0 && $action == 'edit_line' && $_GET['etat'] == '0' && $_GET['lineid'] == $object->lines[$i]->rowid) { print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&etat=1&lineid='.$object->lines[$i]->rowid.'" method="post">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; @@ -1500,7 +1466,7 @@ else require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); $nbrows=ROWS_2; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $doleditor=new DolEditor('label',$object->lines[$i]->description,'',128,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); + $doleditor=new DolEditor('desc',$object->lines[$i]->description,'',128,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); $doleditor->Create(); print '</td>'; @@ -1577,7 +1543,7 @@ else print '<td align="right" nowrap="nowrap">'.price($object->lines[$i]->total_ttc).'</td>'; print '<td align="center" width="16">'; - if ($object->statut == 0) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=mod_ligne&etat=0&lineid='.$object->lines[$i]->rowid.'">'.img_edit().'</a>'; + if ($object->statut == 0) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit_line&etat=0&lineid='.$object->lines[$i]->rowid.'">'.img_edit().'</a>'; else print ' '; print '</td>'; @@ -1595,7 +1561,7 @@ else * Form to add new line */ - if ($object->statut == 0 && $action != 'mod_ligne') + if ($object->statut == 0 && $action != 'edit_line') { print '<tr class="liste_titre">'; print '<td>'; @@ -1630,7 +1596,7 @@ else require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); $nbrows=ROWS_2; if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $doleditor=new DolEditor('label',GETPOST("label"),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); + $doleditor=new DolEditor('dp_desc',GETPOST("dp_desc"),'',100,'dolibarr_details','',false,true,$conf->global->FCKEDITOR_ENABLE_DETAILS,$nbrows,70); $doleditor->Create(); print '</td>'; @@ -1861,7 +1827,7 @@ else } } -$db->close(); - llxFooter(); + +$db->close(); ?> diff --git a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql index df58ad3b95b6980edeb659386d04e208bd865661..d7bf4e25bafe5a575a65fa9a5981eb08d0d931fa 100755 --- a/htdocs/install/mysql/migration/3.1.0-3.2.0.sql +++ b/htdocs/install/mysql/migration/3.1.0-3.2.0.sql @@ -183,6 +183,7 @@ insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (13, 'Cotisation sur la valeur ajoutée des entreprises', 0, 1, 'TAXCVAE', '1'); ALTER TABLE llx_paiement ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; +ALTER TABLE llx_product_price ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; -- Restore foreign key (on llx_expedition_methode before) on correct table (llx_c_shipment_mode) ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_expedition_methode; diff --git a/htdocs/install/mysql/tables/llx_product_price.sql b/htdocs/install/mysql/tables/llx_product_price.sql index 638d339548e64c6971e8bd6571ab9b2f31169fc5..12f1257f1568da9be5721c7b00eb8d3804ff82e0 100644 --- a/htdocs/install/mysql/tables/llx_product_price.sql +++ b/htdocs/install/mysql/tables/llx_product_price.sql @@ -1,5 +1,6 @@ -- ============================================================================ -- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> +-- Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> -- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> -- -- This program is free software; you can redistribute it and/or modify @@ -19,21 +20,22 @@ create table llx_product_price ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - fk_product integer NOT NULL, - date_price datetime NOT NULL, - price_level smallint NULL DEFAULT 1, - price double(24,8) DEFAULT NULL, - price_ttc double(24,8) DEFAULT NULL, - price_min double(24,8) default NULL, - price_min_ttc double(24,8) default NULL, - price_base_type varchar(3) DEFAULT 'HT', - tva_tx double(6,3) NOT NULL, - recuperableonly integer NOT NULL DEFAULT '0', - localtax1_tx double(6,3) DEFAULT 0, - localtax2_tx double(6,3) DEFAULT 0, - fk_user_author integer, - tosell tinyint DEFAULT 1 + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, -- Multi company id + tms timestamp, + fk_product integer NOT NULL, + date_price datetime NOT NULL, + price_level smallint NULL DEFAULT 1, + price double(24,8) DEFAULT NULL, + price_ttc double(24,8) DEFAULT NULL, + price_min double(24,8) default NULL, + price_min_ttc double(24,8) default NULL, + price_base_type varchar(3) DEFAULT 'HT', + tva_tx double(6,3) NOT NULL, + recuperableonly integer NOT NULL DEFAULT '0', + localtax1_tx double(6,3) DEFAULT 0, + localtax2_tx double(6,3) DEFAULT 0, + fk_user_author integer, + tosell tinyint DEFAULT 1 )ENGINE=innodb; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 3d682c7ca3777631a6f3f44c4e9184d464d48868..3a911be8bbed19062bd274e3de58dd580e33bfc0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -100,6 +100,7 @@ class Project extends CommonObject $sql.= ", datec"; $sql.= ", dateo"; $sql.= ", datee"; + $sql.= ", entity"; $sql.= ") VALUES ("; $sql.= "'" . $this->db->escape($this->ref) . "'"; $sql.= ", '" . $this->db->escape($this->title) . "'"; @@ -111,6 +112,7 @@ class Project extends CommonObject $sql.= ", " . ($this->datec != '' ? $this->db->idate($this->datec) : 'null'); $sql.= ", " . ($this->dateo != '' ? $this->db->idate($this->dateo) : 'null'); $sql.= ", " . ($this->datee != '' ? $this->db->idate($this->datee) : 'null'); + $sql.= ", ".$conf->entity; $sql.= ")"; dol_syslog("Project::create sql=" . $sql, LOG_DEBUG);