From b141f3caf5c5fcb170f9f9dd4c61c1c00947da17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Apr 2012 10:49:18 +0200 Subject: [PATCH] Revert "to add delivery date" This reverts commit 8a20b670e7676d9dd386319165ea2ec1c78bda77. --- .../class/fournisseur.commande.class.php | 38 +--- htdocs/fourn/commande/fiche.php | 215 ++++++++---------- .../install/mysql/migration/3.1.0-3.2.0.sql | 2 - .../mysql/tables/llx_commande_fournisseur.sql | 5 +- 4 files changed, 92 insertions(+), 168 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d0790550aa7..96525557ced 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -54,7 +54,6 @@ class CommandeFournisseur extends Commande var $fourn_id; var $date; var $date_commande; - var $date_livraison; // Date livraison souhaitee var $total_ht; var $total_tva; var $total_localtax1; // Total Local tax 1 @@ -1368,41 +1367,6 @@ class CommandeFournisseur extends Commande return $result ; } - /** - * Set the planned delivery date - * - * @param User $user Objet utilisateur qui modifie - * @param timestamp $date_livraison Date de livraison - * @return int <0 si ko, >0 si ok - */ - function set_date_livraison($user, $date_livraison) - { - if ($user->rights->fournisseur->commande->creer) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; - $sql.= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); - $sql.= " WHERE rowid = ".$this->id; - - dol_syslog("CommandeFournisseur::set_date_livraison sql=".$sql,LOG_DEBUG); - $resql=$this->db->query($sql); - if ($resql) - { - $this->date_livraison = $date_livraison; - return 1; - } - else - { - $this->error=$this->db->error(); - dol_syslog("CommandeFournisseur::set_date_livraison ".$this->error,LOG_ERR); - return -1; - } - } - else - { - return -2; - } - } - /** * Update a supplier order from a customer order * @@ -1866,4 +1830,4 @@ class CommandeFournisseurLigne extends OrderLine } } -?> \ No newline at end of file +?> diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index caf83271bbd..21f93a08fcc 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -48,12 +48,12 @@ $langs->load('products'); $langs->load('stocks'); $id = GETPOST('id','int'); -$ref = GETPOST('ref','alpha'); -$action = GETPOST('action','alpha'); -$confirm = GETPOST('confirm','alpha'); -$comclientid = GETPOST('comid','int'); +$ref = GETPOST("ref"); +$action = GETPOST("action"); +$confirm = GETPOST("confirm"); +$comclientid = GETPOST("comid"); $socid = GETPOST('socid','int'); -$projectid = GETPOST('projectid','int'); +$projectid = GETPOST("projectid"); // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -87,19 +87,6 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer) $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); } -// date de livraison -if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer) -{ - $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); - - $object->fetch($id); - $result=$object->set_date_livraison($user,$datelivraison); - if ($result < 0) - { - $mesg='
'.$object->error.'
'; - } -} - // Set project else if ($action == 'classin' && $user->rights->fournisseur->commande->creer) { @@ -113,18 +100,18 @@ else if ($action == 'setremisepercent' && $user->rights->fournisseur->commande-> $result = $object->set_remise($user, $_POST['remise_percent']); } -else if ($action == 'setnote_public' && $user->rights->propale->creer) -{ - $object->fetch($id); - $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); -} - -else if ($action == 'setnote' && $user->rights->propale->creer) -{ - $object->fetch($id); - $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); - if ($result < 0) dol_print_error($db,$object->error); +else if ($action == 'setnote_public' && $user->rights->propale->creer) +{ + $object->fetch($id); + $result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); +} + +else if ($action == 'setnote' && $user->rights->propale->creer) +{ + $object->fetch($id); + $result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES)); + if ($result < 0) dol_print_error($db,$object->error); } else if ($action == 'reopen' && $user->rights->fournisseur->commande->approuver) @@ -825,64 +812,64 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P } } -if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) +if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { - if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer) - { - $result = $object->fetch($id); - - if ($result > 0 && $id > 0) + if ($action == 'addcontact' && $user->rights->fournisseur->commande->creer) + { + $result = $object->fetch($id); + + if ($result > 0 && $id > 0) { - $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); - } - - if ($result >= 0) - { - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else - { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') - { - $langs->load("errors"); - $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; - } - else - { - $mesg = '
'.$object->error.'
'; - } - } - } - - // bascule du statut d'un contact - else if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer) - { - if ($object->fetch($id)) - { - $result=$object->swapContactStatus(GETPOST('ligne')); - } - else - { - dol_print_error($db); - } - } - - // Efface un contact - else if ($action == 'deletecontact' && $user->rights->fournisseur->commande->creer) - { - $object->fetch($id); - $result = $object->delete_contact($_GET["lineid"]); - - if ($result >= 0) - { - Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; - } - else { - dol_print_error($db); - } + $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); + $result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]); + } + + if ($result >= 0) + { + Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else + { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + $langs->load("errors"); + $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; + } + else + { + $mesg = '
'.$object->error.'
'; + } + } + } + + // bascule du statut d'un contact + else if ($action == 'swapstatut' && $user->rights->fournisseur->commande->creer) + { + if ($object->fetch($id)) + { + $result=$object->swapContactStatus(GETPOST('ligne')); + } + else + { + dol_print_error($db); + } + } + + // Efface un contact + else if ($action == 'deletecontact' && $user->rights->fournisseur->commande->creer) + { + $object->fetch($id); + $result = $object->delete_contact($_GET["lineid"]); + + if ($result >= 0) + { + Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } + else { + dol_print_error($db); + } } } @@ -1115,30 +1102,6 @@ if ($id > 0 || ! empty($ref)) } print ''; - // Delivery date planed - print ''; - print ''; - - if ($action != 'editdate_livraison') print ''; - print '
'; - print $langs->trans('DateDeliveryPlanned'); - print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'
'; - print ''; - if ($action == 'editdate_livraison') - { - print '
'; - print ''; - print ''; - $form->select_date($object->date_livraison?$object->date_livraison:-1,'liv_','','','',"setdate_livraison"); - print ''; - print '
'; - } - else - { - print $object->date_livraison ? dol_print_date($object->date_livraison,'daytext') : ' '; - } - print ''; - // Project if ($conf->projet->enabled) { @@ -1192,22 +1155,22 @@ if ($id > 0 || ! empty($ref)) print "
"; - if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) - { + if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + { require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'); - require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); - $formcompany= new FormCompany($db); - - $blocname = 'contacts'; - $title = $langs->trans('ContactsAddresses'); - include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'); - } - - if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) - { - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'); + require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"); + $formcompany= new FormCompany($db); + + $blocname = 'contacts'; + $title = $langs->trans('ContactsAddresses'); + include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'); + } + + if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $blocname = 'notes'; + $title = $langs->trans('Notes'); + include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'); } dol_htmloutput_mesg($mesg); @@ -1759,4 +1722,4 @@ if ($id > 0 || ! empty($ref)) // End of page llxFooter(); $db->close(); -?> \ No newline at end of file +?> 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 b3ef221cf1a..b5ccfefeb4a 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 @@ -451,5 +451,3 @@ ALTER TABLE llx_commande_fournisseur ADD COLUMN extraparams varchar(255) AFTER i ALTER TABLE llx_facture_fourn ADD COLUMN extraparams varchar(255) AFTER import_key; ALTER TABLE llx_boxes ADD COLUMN maxline integer NULL; - -ALTER TABLE llx_commande_fournisseur ADD COLUMN date_livraison date NULL; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql index 9cfca75f307..1c1a00dbbe0 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur.sql @@ -53,12 +53,11 @@ create table llx_commande_fournisseur note text, note_public text, model_pdf varchar(255), - - date_livraison date default NULL, + fk_cond_reglement integer, -- condition de reglement fk_mode_reglement integer, -- mode de reglement fk_methode_commande integer default 0, -- should be named fk_input_method import_key varchar(14), extraparams varchar(255) -- for stock other parameters with json format -)ENGINE=innodb; \ No newline at end of file +)ENGINE=innodb;