diff --git a/htdocs/admin/askpricesupplier.php b/htdocs/admin/askpricesupplier.php index ae3f78ca3ce..67cf07378b6 100644 --- a/htdocs/admin/askpricesupplier.php +++ b/htdocs/admin/askpricesupplier.php @@ -22,12 +22,6 @@ * along with this program. If not, see . */ -/** - * \file htdocs/admin/propal.php - * \ingroup propale - * \brief Setup page for commercial proposal module - */ - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php'; @@ -147,22 +141,6 @@ if ($action == 'set_ASKPRICESUPPLIER_FREE_TEXT') } } -if ($action == 'setdefaultduration') -{ - $res = dolibarr_set_const($db, "ASKPRICESUPPLIER_VALIDITY_DURATION",$value,'chaine',0,'',$conf->entity); - - if (! $res > 0) $error++; - - if (! $error) - { - setEventMessage($langs->trans("SetupSaved")); - } - else - { - setEventMessage($langs->trans("Error"),'errors'); - } -} - if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER') { $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER",$value,'chaine',0,'',$conf->entity); @@ -282,7 +260,6 @@ print ''.$langs->trans("ShortInfo").''; print ''."\n"; clearstatcache(); - foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/askpricesupplier/"); @@ -296,7 +273,7 @@ foreach ($dirmodels as $reldir) while (($file = readdir($handle))!==false) { - if (substr($file, 0, 12) == 'mod_askpricesupplier_' && substr($file, dol_strlen($file)-3, 3) == 'php') + if (substr($file, 0, 21) == 'mod_askpricesupplier_' && substr($file, dol_strlen($file)-3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file)-4); @@ -546,32 +523,6 @@ print ''.$langs->trans("Value")."\n"; print " \n"; print ""; -$var=!$var; -print "
"; -print ''; -print ""; -print ""; -print ''.$langs->trans("DefaultAskDurationValidity").''; -print ''."global->ASKPRICESUPPLIER_VALIDITY_DURATION."\">"; -print ''; -print ''; -print '
'; - -/* -$var=! $var; -print '
'; -print ''; -print ''; -print ''; -print $langs->trans("UseCustomerContactAsPropalRecipientIfExist"); -print ''; -print $form->selectyesno("value",$conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1); -print ''; -print ''; -print "\n"; -print '
'; -*/ - $var=! $var; print '
'; print ''; @@ -622,7 +573,7 @@ else { $var=!$var; print ''; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPLLIER").' '.$langs->trans('NotAvailable').''; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER").' '.$langs->trans('NotAvailable').''; } print ''; diff --git a/htdocs/comm/admin/askpricesupplier_extrafields.php b/htdocs/comm/admin/askpricesupplier_extrafields.php index fa0bd058f0f..0e74ca265e9 100644 --- a/htdocs/comm/admin/askpricesupplier_extrafields.php +++ b/htdocs/comm/admin/askpricesupplier_extrafields.php @@ -18,12 +18,6 @@ * along with this program. If not, see . */ -/** - * \file htdocs/comm/admin/propal_extrafields.php - * \ingroup propal - * \brief Page to setup extra fields of third party - */ - require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -59,7 +53,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject=$langs->transnoentitiesnoconv("Proposals"); +$textobject=$langs->transnoentitiesnoconv("CommRequests"); llxHeader('',$langs->trans("AskPriceSupplierSetup")); @@ -69,7 +63,7 @@ $linkback=''.$langs->trans("BackToM print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(); +$head = askpricesupplier_admin_prepare_head(); dol_fiche_head($head, 'attributes', $langs->trans("CommRequests"), 0, 'askpricesupplier'); diff --git a/htdocs/comm/admin/askpricesupplierdet_extrafields.php b/htdocs/comm/admin/askpricesupplierdet_extrafields.php index 85647950276..a58164b63dd 100644 --- a/htdocs/comm/admin/askpricesupplierdet_extrafields.php +++ b/htdocs/comm/admin/askpricesupplierdet_extrafields.php @@ -21,12 +21,6 @@ * along with this program. If not, see . */ -/** - * \file htdocs/comm/admin/propaldet_extrafields.php - * \ingroup order - * \brief Page to setup extra fields of order - */ - require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -74,7 +68,7 @@ llxHeader('',$langs->trans("AskPriceSupplierSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup'); -$head = propal_admin_prepare_head(); +$head = askpricesupplier_admin_prepare_head(); dol_fiche_head($head, 'attributeslines', $langs->trans("CommRequests"), 0, 'askpricesupplier'); diff --git a/htdocs/comm/askpricesupplier.php b/htdocs/comm/askpricesupplier.php index f286dc03039..dc0b52e1cf1 100644 --- a/htdocs/comm/askpricesupplier.php +++ b/htdocs/comm/askpricesupplier.php @@ -25,11 +25,6 @@ * along with this program. If not, see . */ -/** - * \file htdocs/comm/propal.php - * \ingroup propale - * \brief Page of commercial proposals card and list - */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; @@ -135,7 +130,7 @@ if (empty($reshook)) } } - // Delete proposal + // Delete askprice else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->askpricesupplier->supprimer) { $result = $object->delete($user); @@ -207,29 +202,6 @@ if (empty($reshook)) } } - else if ($action == 'setdate' && $user->rights->askpricesupplier->creer) - { - $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - - /* PHFAVRE - if (empty($datep)) { - $error ++; - setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); - } - */ - - if (! $error) { - $result = $object->set_date($user, $datep); - if ($result < 0) - dol_print_error($db, $object->error); - } - } - else if ($action == 'setecheance' && $user->rights->askpricesupplier->creer) - { - $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); - if ($result < 0) - dol_print_error($db, $object->error); - } else if ($action == 'setdate_livraison' && $user->rights->askpricesupplier->creer) { $result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); @@ -237,29 +209,14 @@ if (empty($reshook)) dol_print_error($db, $object->error); } - // Positionne ref client - else if ($action == 'set_ref_client' && $user->rights->askpricesupplier->creer) - { - $object->set_ref_client($user, $_POST['ref_client']); - } - - // Create proposal + // Create askprice else if ($action == 'add' && $user->rights->askpricesupplier->creer) { $object->socid = $socid; $object->fetch_thirdparty(); - $datep = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $date_delivery = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); - /* PHFAVRE - if (empty($datep)) { - setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors'); - $action = 'create'; - $error ++; - } - */ - if ($socid < 1) { setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors'); $action = 'create'; @@ -270,25 +227,19 @@ if (empty($reshook)) { $db->begin(); - // Si on a selectionne une propal a copier, on realise la copie + // Si on a selectionne une demande a copier, on realise la copie if (GETPOST('createmode') == 'copy' && GETPOST('copie_askpricesupplier')) { if ($object->fetch(GETPOST('copie_askpricesupplier')) > 0) { $object->ref = GETPOST('ref'); - $object->datep = $datep; $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); - $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); - $object->duree_validite = $duration; $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); - $object->fk_account = GETPOST('fk_account', 'int'); + $object->fk_account = GETPOST('fk_account', 'int'); $object->remise_percent = GETPOST('remise_percent'); $object->remise_absolue = GETPOST('remise_absolue'); $object->socid = GETPOST('socid'); - $object->contactid = GETPOST('contactid'); $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated @@ -301,18 +252,12 @@ if (empty($reshook)) } } else { $object->ref = GETPOST('ref'); - $object->ref_client = GETPOST('ref_client'); - $object->datep = $datep; $object->date_livraison = $date_delivery; - $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->fk_delivery_address = GETPOST('fk_address'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); - $object->duree_validite = GETPOST('duree_validite'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); - $object->fk_account = GETPOST('fk_account', 'int'); - $object->contactid = GETPOST('contactid'); + $object->fk_account = GETPOST('fk_account', 'int'); $object->fk_project = GETPOST('projectid'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated @@ -343,31 +288,9 @@ if (empty($reshook)) { if ($origin && $originid) { - // Parse element/subelement (ex: project_task) - $element = $subelement = $origin; - if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { - $element = $regs [1]; - $subelement = $regs [2]; - } - - // For compatibility - if ($element == 'order') { - $element = $subelement = 'commande'; - } - if ($element == 'askpricesupplier') { - $element = 'comm/askpricesupplier'; - $subelement = 'askpricesupplier'; - } - if ($element == 'contract') { - $element = $subelement = 'contrat'; - } - if ($element == 'inter') { - $element = $subelement = 'ficheinter'; - } - if ($element == 'shipping') { - $element = $subelement = 'expedition'; - } - + $element = 'comm/askpricesupplier'; + $subelement = 'askpricesupplier'; + $object->origin = $origin; $object->origin_id = $originid; @@ -404,54 +327,36 @@ if (empty($reshook)) $label=(! empty($lines[$i]->label)?$lines[$i]->label:''); $desc=(! empty($lines[$i]->desc)?$lines[$i]->desc:$lines[$i]->libelle); - // Positive line - $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); + // Positive line + $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); - // Date start - $date_start = false; - if ($lines[$i]->date_debut_prevue) - $date_start = $lines[$i]->date_debut_prevue; - if ($lines[$i]->date_debut_reel) - $date_start = $lines[$i]->date_debut_reel; - if ($lines[$i]->date_start) - $date_start = $lines[$i]->date_start; + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { + $fk_parent_line = 0; + } - // Date end - $date_end = false; - if ($lines[$i]->date_fin_prevue) - $date_end = $lines[$i]->date_fin_prevue; - if ($lines[$i]->date_fin_reel) - $date_end = $lines[$i]->date_fin_reel; - if ($lines[$i]->date_end) - $date_end = $lines[$i]->date_end; + // Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_option = $lines[$i]->array_options; + } - // Reset fk_parent_line for no child products and special product - if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { - $fk_parent_line = 0; - } + $tva_tx=get_default_tva($mysoc, $object->thirdparty); - // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); - $array_option = $lines[$i]->array_options; - } + $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_option); - $tva_tx=get_default_tva($mysoc, $object->thirdparty); + if ($result > 0) { + $lineid = $result; + } else { + $lineid = 0; + $error ++; + break; + } - $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_option); - - if ($result > 0) { - $lineid = $result; - } else { - $lineid = 0; - $error ++; - break; - } - - // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) { - $fk_parent_line = $result; - } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) { + $fk_parent_line = $result; + } } // Hooks @@ -476,17 +381,6 @@ if (empty($reshook)) if ($id > 0) { - // Insertion contact par defaut si defini - if (GETPOST('contactid') > 0) - { - $result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external'); - if ($result < 0) - { - $error++; - setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors'); - } - } - if (! $error) { $db->commit(); @@ -528,24 +422,6 @@ if (empty($reshook)) } } - // Classify billed - else if ($action == 'classifybilled' && $user->rights->askpricesupplier->cloturer) { - $object->cloture($user, 4, ''); - } - - // Reopen proposal - else if ($action == 'confirm_reopen' && $user->rights->askpricesupplier->cloturer && ! GETPOST('cancel')) { - // prevent browser refresh from reopening proposal several times - if ($object->statut == 2 || $object->statut == 3 || $object->statut == 4) { - $object->reopen($user, 1); - } - } - - // Classify billed - else if ($action == 'classifybilled' && $user->rights->askpricesupplier->cloturer) { - $object->cloture($user, 4, ''); - } - // Reopen proposal else if ($action == 'confirm_reopen' && $user->rights->askpricesupplier->cloturer && ! GETPOST('cancel')) { // prevent browser refresh from reopening proposal several times @@ -787,9 +663,6 @@ if (empty($reshook)) $fournprice = (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); $buyingprice = (GETPOST('buying_price' . $predef) ? GETPOST('buying_price' . $predef) : ''); - $date_start = dol_mktime(0, 0, 0, GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); - $date_end = dol_mktime(0, 0, 0, GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); - // Local Taxes $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); @@ -804,7 +677,7 @@ if (empty($reshook)) } else { // Insert line $ref_fourn = GETPOST('fourn_ref'); - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_option, $ref_fourn); + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_option, $ref_fourn); if ($result > 0) { $db->commit(); @@ -839,18 +712,6 @@ if (empty($reshook)) unset($_POST['dp_desc']); unset($_POST['idprod']); - unset($_POST['date_starthour']); - unset($_POST['date_startmin']); - unset($_POST['date_startsec']); - unset($_POST['date_startday']); - unset($_POST['date_startmonth']); - unset($_POST['date_startyear']); - unset($_POST['date_endhour']); - unset($_POST['date_endmin']); - unset($_POST['date_endsec']); - unset($_POST['date_endday']); - unset($_POST['date_endmonth']); - unset($_POST['date_endyear']); } else { $db->rollback(); @@ -860,7 +721,7 @@ if (empty($reshook)) } } - // Mise a jour d'une ligne dans la propale + // Mise a jour d'une ligne dans la demande de prix else if ($action == 'updateligne' && $user->rights->askpricesupplier->creer && GETPOST('save') == $langs->trans("Save")) { // Define info_bits $info_bits = 0; @@ -875,15 +736,12 @@ if (empty($reshook)) $vat_rate = str_replace('*', '', $vat_rate); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty); - $pu_ht = GETPOST('price_ht'); + $pu_ht = GETPOST('price_ht') ? GETPOST('price_ht') : 0; // Add buying price $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); $buyingprice = (GETPOST('buying_price') ? GETPOST('buying_price') : ''); - $date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); - $date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); - // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); @@ -932,7 +790,7 @@ if (empty($reshook)) if (! $error) { $db->begin(); $ref_fourn = GETPOST('fourn_ref'); - $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_option, $ref_fourn); + $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_option, $ref_fourn); if ($result >= 0) { $db->commit(); @@ -1025,11 +883,6 @@ if (empty($reshook)) $result = $object->availability($_POST['availability_id']); } - // Origine de la propale - else if ($action == 'setdemandreason' && $user->rights->askpricesupplier->creer) { - $result = $object->demand_reason($_POST['demand_reason_id']); - } - // Conditions de reglement else if ($action == 'setconditions' && $user->rights->askpricesupplier->creer) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); @@ -1115,51 +968,6 @@ if (empty($reshook)) if ($error) $action = 'edit_extras'; } - - if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->askpricesupplier->creer) - { - if ($action == 'addcontact') - { - if ($object->id > 0) { - $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); - $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"); - setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors'); - } else { - setEventMessage($object->error, 'errors'); - } - } - } - - // Bascule du statut d'un contact - else if ($action == 'swapstatut') { - if ($object->fetch($id) > 0) { - $result = $object->swapContactStatus(GETPOST('ligne')); - } else { - dol_print_error($db); - } - } - - // Efface un contact - else if ($action == 'deletecontact') { - $object->fetch($id); - $result = $object->delete_contact($lineid); - - if ($result >= 0) { - header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id); - exit(); - } else { - dol_print_error($db); - } - } - } } @@ -1167,7 +975,7 @@ if (empty($reshook)) * View */ -llxHeader('', $langs->trans('CommRequests'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); +llxHeader('', $langs->trans('CommRequests'), 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'); $form = new Form($db); $formother = new FormOther($db); @@ -1177,7 +985,7 @@ $companystatic = new Societe($db); $now = dol_now(); -// Add new proposal +// Add new askprice if ($action == 'create') { print_fiche_titre($langs->trans("NewAskPrice")); @@ -1189,58 +997,32 @@ if ($action == 'create') // Load objectsrc if (! empty($origin) && ! empty($originid)) { - // Parse element/subelement (ex: project_task) - $element = $subelement = $origin; - if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) { - $element = $regs [1]; - $subelement = $regs [2]; + $element = 'comm/askpricesupplier'; + $subelement = 'askpricesupplier'; + + dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); + + $classname = ucfirst($subelement); + $objectsrc = new $classname($db); + $objectsrc->fetch($originid); + if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) + { + $objectsrc->fetch_lines(); } + $objectsrc->fetch_thirdparty(); - if ($element == 'project') { - $projectid = $originid; - } else { - // For compatibility - if ($element == 'order' || $element == 'commande') { - $element = $subelement = 'commande'; - } - if ($element == 'askpricesupplier') { - $element = 'comm/askpricesupplier'; - $subelement = 'askpricesupplier'; - } - if ($element == 'contract') { - $element = $subelement = 'contrat'; - } - if ($element == 'shipping') { - $element = $subelement = 'expedition'; - } + $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); + $soc = $objectsrc->thirdparty; - dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); + $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); + $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); + $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); + $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $classname = ucfirst($subelement); - $objectsrc = new $classname($db); - $objectsrc->fetch($originid); - if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) - { - $objectsrc->fetch_lines(); - } - $objectsrc->fetch_thirdparty(); - - $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); - $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); - $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); - - $soc = $objectsrc->thirdparty; - - $cond_reglement_id = (! empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(! empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1)); - $mode_reglement_id = (! empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(! empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0)); - $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); - $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); - $dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); - - // Replicate extrafields - $objectsrc->fetch_optionals($originid); - $object->array_options = $objectsrc->array_options; - } + // Replicate extrafields + $objectsrc->fetch_optionals($originid); + $object->array_options = $objectsrc->array_options; + } $object = new AskPriceSupplier($db); @@ -1260,13 +1042,6 @@ if ($action == 'create') // Reference print '' . $langs->trans('Ref') . '' . $langs->trans("Draft") . ''; - // Ref customer - /* PHFAVRE retrait en temporaire - print '' . $langs->trans('RefCustomer') . ''; - print ''; - print ''; - */ - // Third party print ''; print '' . $langs->trans('Supplier') . ''; @@ -1282,47 +1057,6 @@ if ($action == 'create') } print '' . "\n"; - // Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice. - /* PHFAVRE retrait en temporaire - if ($socid > 0) - { - print "" . $langs->trans("DefaultContact") . ''; - $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist); - print ''; - } - - if ($socid > 0) - { - // Ligne info remises tiers - print '' . $langs->trans('Discounts') . ''; - if ($soc->remise_percent) - print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); - else - print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount = $soc->getAvailableDiscounts(); - print '. '; - if ($absolute_discount) - print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount), $langs->trans("Currency" . $conf->currency)); - else - print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.'; - print ''; - } - */ - - // Date - - /* PHFAVRE retrait en temporaire - print '' . $langs->trans('AskPriceSupplierDate') . ''; - $form->select_date('', '', '', '', '', "addask", 1, 1); - print ''; - */ - - // Validaty duration - /* PHFAVRE retrait en temporaire - print '' . $langs->trans("ValidityDuration") . ' ' . $langs->trans("days") . ''; - */ - // Terms of payment print '' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id'); @@ -1339,20 +1073,6 @@ if ($action == 'create') $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; } - - // What trigger creation - /* PHFAVRE retrait en temporaire - print '' . $langs->trans('Source') . ''; - $form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1); - print ''; - */ - - // Delivery delay - /* PHFAVRE retrait en temporaire - print '' . $langs->trans('AvailabilityPeriod') . ''; - $form->selectAvailabilityDelay('', 'availability_id', '', 1); - print ''; - */ // Shipping Method if (! empty($conf->expedition->enabled)) { @@ -1435,17 +1155,7 @@ if ($action == 'create') print ''; print ''; - $newclassname = $classname; - if ($newclassname == 'Askpricesupplier') - $newclassname = 'CommRequest'; - elseif ($newclassname == 'Commande') - $newclassname = 'Order'; - elseif ($newclassname == 'Expedition') - $newclassname = 'Sending'; - elseif ($newclassname == 'Fichinter') - $newclassname = 'Intervention'; - - print '' . $langs->trans($newclassname) . '' . $objectsrc->getNomUrl(1) . ''; + print '' . $langs->trans('CommRequest') . '' . $objectsrc->getNomUrl(1) . ''; print '' . $langs->trans('TotalHT') . '' . price($objectsrc->total_ht) . ''; print '' . $langs->trans('TotalVAT') . '' . price($objectsrc->total_tva) . ""; if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1 @@ -1543,7 +1253,6 @@ if ($action == 'create') dol_fiche_end(); - $langs->load("bills"); print '
'; print ''; print '     '; @@ -1588,7 +1297,7 @@ if ($action == 'create') // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => // 1), - array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); + array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', 's.fournisseur=1'))); // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneAsk'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } @@ -1608,7 +1317,7 @@ if ($action == 'create') $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); } - // Confirm validate proposal + // Confirm validate askprice else if ($action == 'validate') { $error = 0; @@ -1654,123 +1363,10 @@ if ($action == 'create') print '' . $langs->trans('Ref') . ''; print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print ''; - - // Ref customer - /* PHFAVRE retrait en temporaire - print ''; - print ''; - if ($action != 'refclient' && ! empty($object->brouillon)) - print ''; - print ''; - print '
'; - print $langs->trans('RefCustomer') . '' . img_edit($langs->trans('Modify')) . '
'; - print ''; - if ($user->rights->askpricesupplier->creer && $action == 'refclient') { - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; - } else { - print $object->ref_client; - } - print ''; - print ''; - */ // Company print '' . $langs->trans('Supplier') . '' . $soc->getNomUrl(1) . ''; print ''; - - // Ligne info remises tiers - /* PHFAVRE retrait en temporaire - print '' . $langs->trans('Discounts') . ''; - if ($soc->remise_percent) - print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); - else - print $langs->trans("CompanyHasNoRelativeDiscount"); - print '. '; - $absolute_discount = $soc->getAvailableDiscounts('', 'fk_facture_source IS NULL'); - $absolute_creditnote = $soc->getAvailableDiscounts('', 'fk_facture_source IS NOT NULL'); - $absolute_discount = price2num($absolute_discount, 'MT'); - $absolute_creditnote = price2num($absolute_creditnote, 'MT'); - if ($absolute_discount) { - if ($object->statut > 0) { - print $langs->trans("CompanyHasAbsoluteDiscount", price($absolute_discount, 0, $langs, 0, 0, -1, $conf->currency)); - } else { - // Remise dispo de type non avoir - $filter = 'fk_facture_source IS NULL'; - print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?id=' . $object->id, 0, 'remise_id', $soc->id, $absolute_discount, $filter); - } - } - if ($absolute_creditnote) { - print $langs->trans("CompanyHasCreditNote", price($absolute_creditnote, 0, $langs, 0, 0, -1, $conf->currency)) . '. '; - } - if (! $absolute_discount && ! $absolute_creditnote) - print $langs->trans("CompanyHasNoAbsoluteDiscount") . '.'; - print ''; - */ - - // Date of proposal - /* PHFAVRE retrait en temporaire - print ''; - print ''; - print ''; - if ($action != 'editdate' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('AskPriceSupplierDate'); - print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; - print ''; - if (! empty($object->brouillon) && $action == 'editdate') { - print '
'; - print ''; - print ''; - $form->select_date($object->date, 're', '', '', 0, "editdate"); - print ''; - print '
'; - } else { - if ($object->date) { - print dol_print_date($object->date, 'daytext'); - } else { - print ' '; - } - } - print ''; - */ - - // Date end proposal - /* PHFAVRE retrait en temporaire - print ''; - print ''; - print ''; - if ($action != 'editecheance' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('DateEndAsk'); - print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; - print ''; - if (! empty($object->brouillon) && $action == 'editecheance') { - print '
'; - print ''; - print ''; - $form->select_date($object->fin_validite, 'ech', '', '', '', "editecheance"); - print ''; - print '
'; - } else { - if (! empty($object->fin_validite)) { - print dol_print_date($object->fin_validite, 'daytext'); - if ($object->statut == 1 && $object->fin_validite < ($now - $conf->askpricesupplier->cloture->warning_delay)) - print img_warning($langs->trans("Late")); - } else { - print ' '; - } - } - print ''; - print ''; - */ // Payment term print ''; @@ -1812,69 +1408,6 @@ if ($action == 'create') print ''; print ''; - - // Delivery delay - /* PHFAVRE retrait en temporaire - print ''; - print ''; - if ($action != 'editavailability' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('AvailabilityPeriod'); - if (! empty($conf->commande->enabled)) - print ' (' . $langs->trans('AfterOrder') . ')'; - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '
'; - print ''; - if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); - } else { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1); - } - - print ''; - print ''; - */ - - // Shipping Method - /* PHFAVRE retrait en temporaire - if (! empty($conf->expedition->enabled)) { - print ''; - print ''; - if ($action != 'editshippingmethod' && $user->rights->propal->creer) - print ''; - print '
'; - print $langs->trans('SendingMethod'); - print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; - print ''; - if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); - } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); - } - print ''; - print ''; - } - */ - - // Origin of demand - /* PHFAVRE retrait en temporaire - print ''; - print ''; - if ($action != 'editdemandreason' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('Source'); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '
'; - print ''; - if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); - } else { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); - } - print ''; - print ''; - */ - // Payment mode print ''; print ''; @@ -1893,7 +1426,6 @@ if ($action == 'create') print ''; // Project - if (! empty($conf->projet->enabled)) { $langs->load("projects"); print ''; @@ -2056,24 +1588,6 @@ if ($action == 'create') } } - - /* - // Form to add new line - if ($object->statut == 0 && $user->rights->askpricesupplier->creer) - { - // Add free products/services form - global $forceall, $senderissupplier, $dateSelector; - $forceall=1; $senderissupplier=1; $dateSelector=0; - - $var = true; - - // Add free products/services - $object->formAddObjectLine(1, $mysoc, $object); - - $parameters = array(); - $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - } - */ print ''; print "\n"; @@ -2132,11 +1646,7 @@ if ($action == 'create') print ''; // else print ''.$langs->trans('Validate').''; } - // Create event - if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. - { - print '' . $langs->trans("AddAction") . ''; - } + // Edit if ($object->statut == 1 && $user->rights->askpricesupplier->creer) { print ''; @@ -2163,29 +1673,6 @@ if ($action == 'create') } } - // Create contract - if ($conf->contrat->enabled && $object->statut == 2) { - $langs->load("contracts"); - - if ($user->rights->contrat->creer) { - print ''; - } - } - - // Create an invoice and classify billed - if ($object->statut == 2) { - if (! empty($conf->facture->enabled) && $user->rights->facture->creer) - { - print ''; - } - - $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); - if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES)) - { - print ''; - } - } - // Close if ($object->statut == 1 && $user->rights->askpricesupplier->cloturer) { print ''; } @@ -2301,11 +1784,9 @@ if ($action == 'create') $formmail->withto = GETPOST("sendto") ? GETPOST("sendto") : $liste; $formmail->withtocc = $liste; $formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false); - if (empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendAskRef', '__ASKREF__'); - } else if (! empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendAskRef', '__ASKREF__ (__REFCLIENT__)'); - } + + $formmail->withtopic = $outputlangs->trans('SendAskRef', '__ASKREF__'); + $formmail->withfile = 2; $formmail->withbody = 1; $formmail->withdeliveryreceipt = 1; @@ -2314,30 +1795,10 @@ if ($action == 'create') // Tableau des substitutions $formmail->substit['__ASKREF__'] = $object->ref; $formmail->substit['__SIGNATURE__'] = $user->signature; - $formmail->substit['__REFCLIENT__'] = $object->ref_client; $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); - $formmail->substit['__PERSONALIZED__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = ''; - - // Find the good contact adress - $custcontact = ''; - $contactarr = array(); - $contactarr = $object->liste_contact(- 1, 'external'); - - if (is_array($contactarr) && count($contactarr) > 0) { - foreach ($contactarr as $contact) { - if ($contact ['libelle'] == $langs->trans('TypeContact_askpricesupplier_external_CUSTOMER')) { // TODO Use code and not label - $contactstatic = new Contact($db); - $contactstatic->fetch($contact ['id']); - $custcontact = $contactstatic->getFullName($langs, 1); - } - } - - if (! empty($custcontact)) { - $formmail->substit['__CONTACTCIVNAME__'] = $custcontact; - } - } + $formmail->substit['__PERSONALIZED__'] = ''; // Tableau des parametres complementaires $formmail->param['action'] = 'send'; diff --git a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php index 1fbe004e734..4f1d1807953 100644 --- a/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php +++ b/htdocs/comm/askpricesupplier/class/askpricesupplier.class.php @@ -58,18 +58,14 @@ class AskPriceSupplier extends CommonObject var $socid; // Id client var $client; // Objet societe client (a charger par fetch_client) - var $contactid; var $fk_project; var $author; var $ref; - var $ref_client; + var $ref_fourn; //Reference saisie lors de l'ajout d'une ligne à la demande var $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed) var $datec; // Date of creation - var $datev; // Date of validation var $date; // Date of proposal - var $datep; // Same than date var $date_livraison; - var $fin_validite; var $user_author_id; var $user_valid_id; @@ -95,15 +91,7 @@ class AskPriceSupplier extends CommonObject var $note; // deprecated (for compatibility) var $note_private; var $note_public; - var $fk_delivery_address; // deprecated (for compatibility) - var $fk_address; - var $address_type; - var $address; var $shipping_method_id; - var $availability_id; - var $availability_code; - var $demand_reason_id; - var $demand_reason_code; var $products=array(); var $extraparams=array(); @@ -117,7 +105,6 @@ class AskPriceSupplier extends CommonObject var $labelstatut=array(); var $labelstatut_short=array(); - // Pour board var $nbtodo; var $nbtodolate; @@ -143,8 +130,6 @@ class AskPriceSupplier extends CommonObject $this->remise_percent = 0; $this->remise_absolue = 0; - $this->duree_validite=$conf->global->ASKPRICESUPPLIER_VALIDITY_DURATION; - $langs->load("askpricesupplier"); $this->labelstatut[0]=(! empty($conf->global->ASKPRICESUPPLIER_STATUS_DRAFT_LABEL) ? $conf->global->ASKPRICESUPPLIER_STATUS_DRAFT_LABEL : $langs->trans("AskpricesupplierStatusDraft")); $this->labelstatut[1]=(! empty($conf->global->ASKPRICESUPPLIER_STATUS_VALIDATED_LABEL) ? $conf->global->ASKPRICESUPPLIER_STATUS_VALIDATED_LABEL : $langs->trans("AskpricesupplierStatusValidated")); @@ -240,27 +225,27 @@ class AskPriceSupplier extends CommonObject return -5; } - $propalligne=new AskPriceSupplierLigne($this->db); - $propalligne->fk_askpricesupplier=$this->id; - $propalligne->fk_remise_except=$remise->id; - $propalligne->desc=$remise->description; // Description ligne - $propalligne->tva_tx=$remise->tva_tx; - $propalligne->subprice=-$remise->amount_ht; - $propalligne->fk_product=0; // Id produit predefini - $propalligne->qty=1; - $propalligne->remise=0; - $propalligne->remise_percent=0; - $propalligne->rang=-1; - $propalligne->info_bits=2; + $askpricesupplierligne=new AskPriceSupplierLigne($this->db); + $askpricesupplierligne->fk_askpricesupplier=$this->id; + $askpricesupplierligne->fk_remise_except=$remise->id; + $askpricesupplierligne->desc=$remise->description; // Description ligne + $askpricesupplierligne->tva_tx=$remise->tva_tx; + $askpricesupplierligne->subprice=-$remise->amount_ht; + $askpricesupplierligne->fk_product=0; // Id produit predefini + $askpricesupplierligne->qty=1; + $askpricesupplierligne->remise=0; + $askpricesupplierligne->remise_percent=0; + $askpricesupplierligne->rang=-1; + $askpricesupplierligne->info_bits=2; // TODO deprecated - $propalligne->price=-$remise->amount_ht; + $askpricesupplierligne->price=-$remise->amount_ht; - $propalligne->total_ht = -$remise->amount_ht; - $propalligne->total_tva = -$remise->amount_tva; - $propalligne->total_ttc = -$remise->amount_ttc; + $askpricesupplierligne->total_ht = -$remise->amount_ht; + $askpricesupplierligne->total_tva = -$remise->amount_tva; + $askpricesupplierligne->total_ttc = -$remise->amount_ttc; - $result=$propalligne->insert(); + $result=$askpricesupplierligne->insert(); if ($result > 0) { $result=$this->update_price(1); @@ -277,7 +262,7 @@ class AskPriceSupplier extends CommonObject } else { - $this->error=$propalligne->error; + $this->error=$askpricesupplierligne->error; $this->db->rollback(); return -2; } @@ -314,14 +299,12 @@ class AskPriceSupplier extends CommonObject * @param int $fk_fournprice Id supplier price * @param int $pa_ht Buying price without tax * @param string $label ??? - * @param int $date_start Start date of the line - * @param int $date_end End date of the line * @param array $array_option extrafields array * @return int >0 if OK, <0 if KO * * @see add_product */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0, $ref_fourn='') + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='') { global $mysoc; @@ -417,9 +400,6 @@ class AskPriceSupplier extends CommonObject $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; - $this->line->date_start=$date_start; - $this->line->date_end=$date_end; - $this->line->ref_fourn = $this->db->escape($ref_fourn); // infos marge @@ -495,12 +475,10 @@ class AskPriceSupplier extends CommonObject * @param int $pa_ht Price (without tax) of product when it was bought * @param string $label ??? * @param int $type 0/1=Product/service - * @param int $date_start Start date of the line - * @param int $date_end End date of the line * @param array $array_option extrafields array * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0, $ref_fourn) + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn) { global $conf,$user,$langs, $mysoc; @@ -594,9 +572,6 @@ class AskPriceSupplier extends CommonObject } $this->line->pa_ht = $pa_ht; - $this->line->date_start=$date_start; - $this->line->date_end=$date_end; - // TODO deprecated $this->line->price=$price; $this->line->remise=$remise; @@ -682,12 +657,6 @@ class AskPriceSupplier extends CommonObject $now=dol_now(); - // Clean parameters - if (empty($this->date)) $this->date=$this->datep; - $this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600); - if (empty($this->availability_id)) $this->availability_id=0; - if (empty($this->demand_reason_id)) $this->demand_reason_id=0; - dol_syslog(get_class($this)."::create"); // Check parameters @@ -712,15 +681,6 @@ class AskPriceSupplier extends CommonObject } } - /* PHFAVRE - if (empty($this->date)) - { - $this->error="Date of proposal is required"; - dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); - return -4; - } - */ - $this->db->begin(); // Insert into database @@ -732,22 +692,17 @@ class AskPriceSupplier extends CommonObject $sql.= ", remise_absolue"; $sql.= ", tva"; $sql.= ", total"; - $sql.= ", datep"; $sql.= ", datec"; $sql.= ", ref"; $sql.= ", fk_user_author"; $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", model_pdf"; - $sql.= ", fin_validite"; $sql.= ", fk_cond_reglement"; $sql.= ", fk_mode_reglement"; $sql.= ", fk_account"; - $sql.= ", ref_client"; $sql.= ", date_livraison"; $sql.= ", fk_shipping_method"; - $sql.= ", fk_availability"; - $sql.= ", fk_input_reason"; $sql.= ", fk_projet"; $sql.= ", entity"; $sql.= ") "; @@ -759,22 +714,17 @@ class AskPriceSupplier extends CommonObject $sql.= ", ".($this->remise_absolue?$this->remise_absolue:'null'); $sql.= ", 0"; $sql.= ", 0"; - $sql.= ", '".$this->db->idate($this->date)."'"; $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '(PROV)'"; $sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null"); $sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->modelpdf."'"; - $sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"null"); $sql.= ", ".$this->cond_reglement_id; $sql.= ", ".$this->mode_reglement_id; $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); - $sql.= ", '".$this->db->escape($this->ref_client)."'"; $sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null"); $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL'); - $sql.= ", ".$this->availability_id; - $sql.= ", ".$this->demand_reason_id; $sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".$conf->entity; $sql.= ")"; @@ -828,8 +778,6 @@ class AskPriceSupplier extends CommonObject $this->lines[$i]->fk_fournprice, $this->lines[$i]->pa_ht, $this->lines[$i]->label, - $this->lines[$i]->date_start, - $this->lines[$i]->date_end, $this->lines[$i]->array_options, $this->lines[$i]->ref_fourn ); @@ -855,17 +803,6 @@ class AskPriceSupplier extends CommonObject if (! $ret) dol_print_error($this->db); } - // Set delivery address - if (! $error && $this->fk_delivery_address) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."askpricesupplier"; - $sql.= " SET fk_delivery_address = ".$this->fk_delivery_address; - $sql.= " WHERE ref = '".$this->ref."'"; - $sql.= " AND entity = ".$conf->entity; - - $result=$this->db->query($sql); - } - if (! $error) { // Mise a jour infos denormalisees @@ -935,7 +872,7 @@ class AskPriceSupplier extends CommonObject /** - * Insert into DB a proposal object completely defined by its data members (ex, results from copy). + * Insert into DB a askpricesupplier object completely defined by its data members (ex, results from copy). * * @param User $user User that create * @return int Id of the new object if ok, <0 if ko @@ -981,12 +918,8 @@ class AskPriceSupplier extends CommonObject $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); $this->fk_project = ''; - $this->fk_delivery_address = ''; } - // reset ref_client - $this->ref_client = ''; - // TODO Change product price if multi-prices } else @@ -1007,34 +940,16 @@ class AskPriceSupplier extends CommonObject $this->user_author = $user->id; $this->user_valid = ''; $this->date = $now; - $this->datep = $now; // deprecated - $this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600); - if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = ''; // Set ref require_once DOL_DOCUMENT_ROOT ."/core/modules/askpricesupplier/".$conf->global->ASKPRICESUPPLIER_ADDON.'.php'; $obj = $conf->global->ASKPRICESUPPLIER_ADDON; $modAskPriceSupplier = new $obj; $this->ref = $modAskPriceSupplier->getNextValue($objsoc,$this); - + // Create clone $result=$this->create($user); if ($result < 0) $error++; - /* PHFAVRE retrait en temporaire - else - { - // copy internal contacts - if ($this->copy_linked_contact($objFrom, 'internal') < 0) - $error++; - - // copy external contacts if same company - elseif ($objFrom->socid == $this->socid) - { - if ($this->copy_linked_contact($objFrom, 'external') < 0) - $error++; - } - } - */ if (! $error) { @@ -1081,30 +996,21 @@ class AskPriceSupplier extends CommonObject $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql.= ", p.datec"; $sql.= ", p.date_valid as datev"; - $sql.= ", p.datep as dp"; - $sql.= ", p.fin_validite as dfv"; $sql.= ", p.date_livraison as date_livraison"; - $sql.= ", p.model_pdf, p.ref_client, p.extraparams"; + $sql.= ", p.model_pdf, p.extraparams"; $sql.= ", p.note_private, p.note_public"; $sql.= ", p.fk_projet, p.fk_statut"; $sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; - $sql.= ", p.fk_delivery_address"; - $sql.= ", p.fk_availability"; - $sql.= ", p.fk_input_reason"; $sql.= ", p.fk_cond_reglement"; $sql.= ", p.fk_mode_reglement"; $sql.= ', p.fk_account'; $sql.= ", p.fk_shipping_method"; $sql.= ", c.label as statut_label"; - $sql.= ", ca.code as availability_code, ca.label as availability"; - $sql.= ", dr.code as demand_reason_code, dr.label as demand_reason"; $sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc"; $sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement"; $sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."askpricesupplier as p"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; $sql.= " WHERE p.fk_statut = c.id"; $sql.= " AND p.entity = ".$conf->entity; if ($ref) $sql.= " AND p.ref='".$ref."'"; @@ -1121,7 +1027,6 @@ class AskPriceSupplier extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; - $this->ref_client = $obj->ref_client; $this->remise = $obj->remise; $this->remise_percent = $obj->remise_percent; $this->remise_absolue = $obj->remise_absolue; @@ -1144,18 +1049,8 @@ class AskPriceSupplier extends CommonObject $this->datev = $this->db->jdate($obj->datev); // TODO obsolete $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date - $this->date = $this->db->jdate($obj->dp); // Proposal date - $this->datep = $this->db->jdate($obj->dp); // deprecated - $this->fin_validite = $this->db->jdate($obj->dfv); $this->date_livraison = $this->db->jdate($obj->date_livraison); $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; - $this->availability_id = $obj->fk_availability; - $this->availability_code = $obj->availability_code; - $this->availability = $obj->availability; - $this->demand_reason_id = $obj->fk_input_reason; - $this->demand_reason_code = $obj->demand_reason_code; - $this->demand_reason = $obj->demand_reason; - $this->fk_address = $obj->fk_delivery_address; $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; @@ -1189,12 +1084,12 @@ class AskPriceSupplier extends CommonObject $this->lines = array(); /* - * Lignes propales liees a un produit ou non + * Lignes askprice liees a un produit ou non */ $sql = "SELECT d.rowid, d.fk_askpricesupplier, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,"; $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; - $sql.= ' d.date_start, d.date_end, d.ref_fourn as ref_produit_fourn'; + $sql.= ' d.ref_fourn as ref_produit_fourn'; $sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplierdet as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; $sql.= " WHERE d.fk_askpricesupplier = ".$this->id; @@ -1249,15 +1144,11 @@ class AskPriceSupplier extends CommonObject $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; // Description produit $line->fk_product_type = $objp->fk_product_type; - - $line->date_start = $objp->date_start; - $line->date_end = $objp->date_end; $line->ref_fourn = $objp->ref_produit_fourn; $this->lines[$i] = $line; - //dol_syslog("1 ".$line->fk_product); - //print "xx $i ".$this->lines[$i]->fk_product; + $i++; } $this->db->free($result); @@ -1268,7 +1159,7 @@ class AskPriceSupplier extends CommonObject return -1; } - // Retreive all extrafield for propal + // Retreive all extrafield for askprice // fetch optionals attributes and labels require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields=new ExtraFields($this->db); @@ -1436,69 +1327,6 @@ class AskPriceSupplier extends CommonObject } } - - /** - * Define proposal date - * - * @param User $user Object user that modify - * @param int $date Date - * @return int <0 if KO, >0 if OK - */ - function set_date($user, $date) - { - if (empty($date)) - { - $this->error='ErrorBadParameter'; - dol_syslog(get_class($this)."::set_date ".$this->error, LOG_ERR); - return -1; - } - - if (! empty($user->rights->askpricesupplier->creer)) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."askpricesupplier SET datep = '".$this->db->idate($date)."'"; - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - - dol_syslog(get_class($this)."::set_date", LOG_DEBUG); - if ($this->db->query($sql) ) - { - $this->date = $date; - $this->datep = $date; // deprecated - return 1; - } - else - { - $this->error=$this->db->lasterror(); - return -1; - } - } - } - - /** - * Define end validity date - * - * @param User $user Object user that modify - * @param int $date_fin_validite End of validity date - * @return int <0 if KO, >0 if OK - */ - function set_echeance($user, $date_fin_validite) - { - if (! empty($user->rights->propal->creer)) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."askpricesupplier SET fin_validite = ".($date_fin_validite!=''?"'".$this->db->idate($date_fin_validite)."'":'null'); - $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; - if ($this->db->query($sql) ) - { - $this->fin_validite = $date_fin_validite; - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - } - } - } - /** * Set delivery date * @@ -1528,97 +1356,6 @@ class AskPriceSupplier extends CommonObject } } - /** - * Set delivery - * - * @param User $user Object user that modify - * @param int $id Availability id - * @return int <0 if KO, >0 if OK - */ - function set_availability($user, $id) - { - if (! empty($user->rights->propal->creer)) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."askpricesupplier "; - $sql.= " SET fk_availability = '".$id."'"; - $sql.= " WHERE rowid = ".$this->id; - - if ($this->db->query($sql)) - { - $this->fk_availability = $id; - return 1; - } - else - { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_availability Erreur SQL"); - return -1; - } - } - } - - /** - * Set source of demand - * - * @param User $user Object user that modify - * @param int $id Input reason id - * @return int <0 if KO, >0 if OK - */ - function set_demand_reason($user, $id) - { - if (! empty($user->rights->propal->creer)) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."askpricesupplier "; - $sql.= " SET fk_input_reason = '".$id."'"; - $sql.= " WHERE rowid = ".$this->id; - - if ($this->db->query($sql)) - { - $this->fk_input_reason = $id; - return 1; - } - else - { - $this->error=$this->db->error(); - dol_syslog(get_class($this)."::set_demand_reason Erreur SQL"); - return -1; - } - } - } - - /** - * Set customer reference number - * - * @param User $user Object user that modify - * @param string $ref_client Customer reference - * @return int <0 if ko, >0 if ok - */ - function set_ref_client($user, $ref_client) - { - if (! empty($user->rights->askpricesupplier->creer)) - { - dol_syslog('AskPriceSupplier::set_ref_client this->id='.$this->id.', ref_client='.$ref_client); - - $sql = 'UPDATE '.MAIN_DB_PREFIX.'askpricesupplier SET ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\''); - $sql.= ' WHERE rowid = '.$this->id; - if ($this->db->query($sql) ) - { - $this->ref_client = $ref_client; - return 1; - } - else - { - $this->error=$this->db->error(); - dol_syslog('AskPriceSupplier::set_ref_client Erreur '.$this->error.' - '.$sql); - return -2; - } - } - else - { - return -1; - } - } - /** * Set an overall discount on the proposal * @@ -1842,10 +1579,9 @@ class AskPriceSupplier extends CommonObject } /** - * Choose between upate or create ProductFournisseur + * Choose between update or create ProductFournisseur * * @param User $user Object user - * @return int <0 if KO, >0 if OK */ function updateOrCreatePriceFournisseur($user) { @@ -1925,37 +1661,6 @@ class AskPriceSupplier extends CommonObject return -1; } } - - /** - * Class invoiced the Propal - * - * @return int <0 si ko, >0 si ok - */ - function classifyBilled() - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'askpricesupplier SET fk_statut = 4'; - $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;'; - if ($this->db->query($sql) ) - { - $this->statut=4; - return 1; - } - else - { - dol_print_error($this->db); - } - } - - /** - * Class invoiced the Propal - * - * @return int <0 si ko, >0 si ok - * @deprecated - */ - function classer_facturee() - { - return $this->classifyBilled(); - } /** * Set draft status @@ -1984,7 +1689,7 @@ class AskPriceSupplier extends CommonObject /** - * Return list of proposal (eventually filtered on user) into an array + * Return list of askprice (eventually filtered on user) into an array * * @param int $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name) * @param int $draft 0=not draft, 1=draft @@ -1996,14 +1701,14 @@ class AskPriceSupplier extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') + function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datec', $sortorder='DESC') { global $conf,$user; $ga = array(); $sql = "SELECT s.rowid, s.nom as name, s.client,"; - $sql.= " p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, "; + $sql.= " p.rowid as askpricesupplierid, p.fk_statut, p.total_ht, p.ref, p.remise, "; $sql.= " p.datep as dp, p.fin_validite as datelimite"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."askpricesupplier as p, ".MAIN_DB_PREFIX."c_propalst as c"; @@ -2057,105 +1762,10 @@ class AskPriceSupplier extends CommonObject dol_print_error($this->db); return -1; } - } + } /** - * Returns an array with the numbers of related invoices - * - * @return array Array of invoices - */ - function getInvoiceArrayList() - { - return $this->InvoiceArrayList($this->id); - } - - /** - * Returns an array with id and ref of related invoices - * - * @param int $id Id propal - * @return array Array of invoices id - */ - function InvoiceArrayList($id) - { - $ga = array(); - $linkedInvoices = array(); - - $this->fetchObjectLinked($id,$this->element); - foreach($this->linkedObjectsIds as $objecttype => $objectid) - { - $numi=count($objectid); - for ($i=0;$i<$numi;$i++) - { - // Cas des factures liees directement - if ($objecttype == 'facture') - { - $linkedInvoices[] = $objectid[$i]; - } - // Cas des factures liees par un autre objet (ex: commande) - else - { - $this->fetchObjectLinked($objectid[$i],$objecttype); - foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid) - { - $numj=count($subobjectid); - for ($j=0;$j<$numj;$j++) - { - if ($subobjecttype == 'facture') - { - $linkedInvoices[] = $subobjectid[$j]; - } - } - } - } - } - } - - if (count($linkedInvoices) > 0) - { - $sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture"; - $sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")"; - - dol_syslog(get_class($this)."::InvoiceArrayList", LOG_DEBUG); - $resql=$this->db->query($sql); - - if ($resql) - { - $tab_sqlobj=array(); - $nump = $this->db->num_rows($resql); - for ($i = 0;$i < $nump;$i++) - { - $sqlobj = $this->db->fetch_object($resql); - $tab_sqlobj[] = $sqlobj; - } - $this->db->free($resql); - - $nump = count($tab_sqlobj); - - if ($nump) - { - $i = 0; - while ($i < $nump) - { - $obj = array_shift($tab_sqlobj); - - $ga[$i] = $obj; - - $i++; - } - } - return $ga; - } - else - { - return -1; - } - } - else return $ga; - } - - /** - * Delete proposal + * Delete askprice * * @param User $user Object user that delete * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers @@ -2189,12 +1799,6 @@ class AskPriceSupplier extends CommonObject // Delete linked object $res = $this->deleteObjectLinked(); if ($res < 0) $error++; - - // Delete linked contacts - /* PHFAVRE retrait en temporaire - $res = $this->delete_linked_contact(); - if ($res < 0) $error++; - */ if (! $error) { @@ -2280,76 +1884,7 @@ class AskPriceSupplier extends CommonObject } /** - * Change the delivery time - * - * @param int $availability_id Id of new delivery time - * @return int >0 if OK, <0 if KO - */ - function availability($availability_id) - { - dol_syslog('AskPriceSupplier::availability('.$availability_id.')'); - if ($this->statut >= 0) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'askpricesupplier'; - $sql .= ' SET fk_availability = '.$availability_id; - $sql .= ' WHERE rowid='.$this->id; - if ( $this->db->query($sql) ) - { - $this->availability_id = $availability_id; - return 1; - } - else - { - dol_syslog('AskPriceSupplier::availability Erreur '.$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; - } - } - else - { - dol_syslog('AskPriceSupplier::availability, etat propale incompatible'); - $this->error='Etat propale incompatible '.$this->statut; - return -2; - } - } - - /** - * Change source demand - * - * @param int $demand_reason_id Id of new source demand - * @return int >0 si ok, <0 si ko - */ - function demand_reason($demand_reason_id) - { - dol_syslog('AskPriceSupplier::demand_reason('.$demand_reason_id.')'); - if ($this->statut >= 0) - { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'askpricesupplier'; - $sql .= ' SET fk_input_reason = '.$demand_reason_id; - $sql .= ' WHERE rowid='.$this->id; - if ( $this->db->query($sql) ) - { - $this->demand_reason_id = $demand_reason_id; - return 1; - } - else - { - dol_syslog('AskPriceSupplier::demand_reason Erreur '.$sql.' - '.$this->db->error()); - $this->error=$this->db->error(); - return -1; - } - } - else - { - dol_syslog('AskPriceSupplier::demand_reason, etat propale incompatible'); - $this->error='Etat propale incompatible '.$this->statut; - return -2; - } - } - - - /** - * Object Proposal Information + * Object AskPriceSupplier Information * * @param int $id Proposal id * @return void @@ -2424,23 +1959,23 @@ class AskPriceSupplier extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - function LibStatut($statut,$mode=1) + function LibStatut($statut,$mode=1) { - global $langs; - $langs->load("askpricesupplier"); - - if ($statut==0) $statuttrans='statut0'; - if ($statut==1) $statuttrans='statut1'; - if ($statut==2) $statuttrans='statut3'; - if ($statut==3) $statuttrans='statut5'; - if ($statut==4) $statuttrans='statut6'; - - if ($mode == 0) return $this->labelstatut[$statut]; - if ($mode == 1) return $this->labelstatut_short[$statut]; - if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; - if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); - if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut_short[$statut],$statuttrans); + global $langs; + $langs->load("askpricesupplier"); + + if ($statut==0) $statuttrans='statut0'; + if ($statut==1) $statuttrans='statut1'; + if ($statut==2) $statuttrans='statut3'; + if ($statut==3) $statuttrans='statut5'; + if ($statut==4) $statuttrans='statut6'; + + if ($mode == 0) return $this->labelstatut[$statut]; + if ($mode == 1) return $this->labelstatut_short[$statut]; + if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; + if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); + if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; + if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut_short[$statut],$statuttrans); } @@ -2448,7 +1983,7 @@ class AskPriceSupplier extends CommonObject * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user - * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice + * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice * @return int <0 if KO, >0 if OK */ function load_board($user,$mode) @@ -2460,7 +1995,7 @@ class AskPriceSupplier extends CommonObject $this->nbtodo=$this->nbtodolate=0; $clause = " WHERE"; - $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin"; + $sql = "SELECT p.rowid, p.ref, p.datec as datec"; $sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) { @@ -2536,19 +2071,13 @@ class AskPriceSupplier extends CommonObject // Initialise parametres $this->id=0; $this->ref = 'SPECIMEN'; - $this->ref_client='NEMICEPS'; $this->specimen=1; $this->socid = 1; $this->date = time(); - $this->fin_validite = $this->date+3600*24*30; $this->cond_reglement_id = 1; $this->cond_reglement_code = 'RECEP'; $this->mode_reglement_id = 7; $this->mode_reglement_code = 'CHQ'; - $this->availability_id = 1; - $this->availability_code = 'AV_NOW'; - $this->demand_reason_id = 1; - $this->demand_reason_code = 'SRC_00'; $this->note_public='This is a comment (public)'; $this->note_private='This is a comment (private)'; // Lines @@ -2621,7 +2150,7 @@ class AskPriceSupplier extends CommonObject // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) { - $this->nb["proposals"]=$obj->nb; + $this->nb["askprice"]=$obj->nb; } $this->db->free($resql); return 1; @@ -2637,7 +2166,7 @@ class AskPriceSupplier extends CommonObject /** * Returns the reference to the following non used Proposal used depending on the active numbering module - * defined into PROPALE_ADDON + * defined into ASKPRICESUPPLIER_ADDON * * @param Societe $soc Object thirdparty * @return string Reference libre pour la propale @@ -2681,7 +2210,6 @@ class AskPriceSupplier extends CommonObject else { $this->error=$obj->error; - //dol_print_error($db,"Propale::getNextNumRef ".$obj->error); return ""; } } @@ -2707,18 +2235,10 @@ class AskPriceSupplier extends CommonObject $result=''; $label=$langs->trans("ShowAskpricesupplier").': '.$this->ref; - if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == '') { $lien = '
lines[$i]->fk_parent_line = $obj->fk_parent_line; $this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->rang = $obj->rang; - $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); - $this->lines[$i]->date_end = $this->db->jdate($obj->date_end); $this->lines[$i]->ref_fourn = $obj->ref_produit_fourn; @@ -2835,7 +2353,7 @@ class AskPriceSupplier extends CommonObject } else { - $modele = 'azur'; + $modele = 'aurore'; } } @@ -2850,7 +2368,7 @@ class AskPriceSupplier extends CommonObject /** * \class AskPriceSupplierLigne - * \brief Class to manage price ask supplier lines + * \brief Class to manage askpricesupplier lines */ class AskPriceSupplierLigne extends CommonObject { @@ -2862,7 +2380,7 @@ class AskPriceSupplierLigne extends CommonObject var $oldline; - // From llx_propaldet + // From llx_askpricesupplierdet var $rowid; var $fk_askpricesupplier; var $fk_parent_line; @@ -2912,9 +2430,6 @@ class AskPriceSupplierLigne extends CommonObject var $total_localtax1; // Line total local tax 1 var $total_localtax2; // Line total local tax 2 - var $date_start; - var $date_end; - var $skip_update_total; // Skip update price total for special lines var $ref_fourn; @@ -2942,7 +2457,7 @@ class AskPriceSupplierLigne extends CommonObject $sql.= ' pd.info_bits, pd.total_ht, pd.total_tva, pd.total_ttc, pd.fk_product_fournisseur_price as fk_fournprice, pd.buy_price_ht as pa_ht, pd.special_code, pd.rang,'; $sql.= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,'; $sql.= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; - $sql.= ' pd.date_start, pd.date_end, pd.product_type, pd.ref_fourn as ref_produit_fourn'; + $sql.= ' pd.product_type, pd.ref_fourn as ref_produit_fourn'; $sql.= ' FROM '.MAIN_DB_PREFIX.'askpricesupplierdet as pd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid'; $sql.= ' WHERE pd.rowid = '.$rowid; @@ -2987,9 +2502,6 @@ class AskPriceSupplierLigne extends CommonObject $this->libelle = $objp->product_label; // deprecated $this->product_label = $objp->product_label; $this->product_desc = $objp->product_desc; - - $this->date_start = $this->db->jdate($objp->date_start); - $this->date_end = $this->db->jdate($objp->date_end); $this->ref_fourn = $objp->ref_produit_forun; @@ -3051,7 +2563,7 @@ class AskPriceSupplierLigne extends CommonObject $sql.= ' subprice, remise_percent, '; $sql.= ' info_bits, '; $sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang,'; - $sql.= ' date_start, date_end, ref_fourn)'; + $sql.= ' ref_fourn)'; $sql.= " VALUES (".$this->fk_askpricesupplier.","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; @@ -3077,8 +2589,6 @@ class AskPriceSupplierLigne extends CommonObject $sql.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").","; $sql.= ' '.$this->special_code.','; $sql.= ' '.$this->rang.','; - $sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").','; - $sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").','; $sql.= " '".$this->db->escape($this->ref_fourn)."'"; $sql.= ')'; @@ -3240,8 +2750,6 @@ class AskPriceSupplierLigne extends CommonObject if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code; $sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null"); if (! empty($this->rang)) $sql.= ", rang=".$this->rang; - $sql.= " , date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null"); - $sql.= " , date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null"); $sql.= " , ref_fourn=".(! empty($this->ref_fourn)?"'".$this->db->escape($this->ref_fourn)."'":"null"); $sql.= " WHERE rowid = ".$this->rowid; diff --git a/htdocs/comm/askpricesupplier/sql/llx_askpricesupplier.sql b/htdocs/comm/askpricesupplier/sql/llx_askpricesupplier.sql index 93389cd5770..a7d1e2ccecc 100644 --- a/htdocs/comm/askpricesupplier/sql/llx_askpricesupplier.sql +++ b/htdocs/comm/askpricesupplier/sql/llx_askpricesupplier.sql @@ -4,13 +4,10 @@ CREATE TABLE `llx_askpricesupplier` ( `entity` int(11) NOT NULL DEFAULT '1', `ref_ext` varchar(255) DEFAULT NULL, `ref_int` varchar(255) DEFAULT NULL, - `ref_client` varchar(255) DEFAULT NULL, `fk_soc` int(11) DEFAULT NULL, `fk_projet` int(11) DEFAULT NULL, `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `datec` datetime DEFAULT NULL, - `datep` date DEFAULT NULL, - `fin_validite` datetime DEFAULT NULL, `date_valid` datetime DEFAULT NULL, `date_cloture` datetime DEFAULT NULL, `fk_user_author` int(11) DEFAULT NULL, @@ -36,11 +33,8 @@ CREATE TABLE `llx_askpricesupplier` ( `model_pdf` varchar(255) DEFAULT NULL, `date_livraison` date DEFAULT NULL, `fk_shipping_method` int(11) DEFAULT NULL, - `fk_availability` int(11) DEFAULT NULL, - `fk_input_reason` int(11) DEFAULT NULL, `import_key` varchar(14) DEFAULT NULL, `extraparams` varchar(255) DEFAULT NULL, - `fk_delivery_address` int(11) DEFAULT NULL, PRIMARY KEY (`rowid`), UNIQUE KEY `uk_askpricesupplier_ref` (`ref`,`entity`), KEY `idx_askpricesupplier_fk_soc` (`fk_soc`), diff --git a/htdocs/comm/askpricesupplier/sql/llx_askpricesupplierdet.sql b/htdocs/comm/askpricesupplier/sql/llx_askpricesupplierdet.sql index 1fa44fae708..919b89fe863 100644 --- a/htdocs/comm/askpricesupplier/sql/llx_askpricesupplierdet.sql +++ b/htdocs/comm/askpricesupplier/sql/llx_askpricesupplierdet.sql @@ -22,8 +22,6 @@ CREATE TABLE `llx_askpricesupplierdet` ( `total_localtax2` double(24,8) DEFAULT '0.00000000', `total_ttc` double(24,8) DEFAULT '0.00000000', `product_type` int(11) DEFAULT '0', - `date_start` datetime DEFAULT NULL, - `date_end` datetime DEFAULT NULL, `info_bits` int(11) DEFAULT '0', `buy_price_ht` double(24,8) DEFAULT '0.00000000', `fk_product_fournisseur_price` int(11) DEFAULT NULL, diff --git a/htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php b/htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php index f0d38f0ae4a..d37d2d49351 100644 --- a/htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php @@ -17,11 +17,6 @@ * along with this program. If not, see . */ -/** - * \file htdocs/comm/propal/tpl/linkedobjectblock.tpl.php - * \ingroup propal - * \brief Template to show objects linked to proposals - */ ?> diff --git a/htdocs/core/modules/modAskPriceSupplier.class.php b/htdocs/core/modules/modAskPriceSupplier.class.php index 1db1ca9c6c3..289a6879578 100644 --- a/htdocs/core/modules/modAskPriceSupplier.class.php +++ b/htdocs/core/modules/modAskPriceSupplier.class.php @@ -21,11 +21,11 @@ */ /** - * \defgroup propale Module commercial proposals - * \brief Module pour gerer la tenue de propositions commerciales - * \file htdocs/core/modules/modPropale.class.php - * \ingroup propale - * \brief Fichier de description et activation du module Propale + * \defgroup askpricesupplier Module de demandes de prix fournisseurs + * \brief Module pour gerer la tenue des demandes fournisseurs + * \file htdocs/core/modules/modAskPriceSupplier.class.php + * \ingroup askpricesupplier + * \brief Fichier de description et activation du module AskPriceSupplier */ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; @@ -49,22 +49,19 @@ class modAskPriceSupplier extends DolibarrModules $this->numero = 999999; $this->family = "products"; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "askpricesupplierDESC"; - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; $this->picto='askpricesupplier'; - // Data directories to create when module is enabled $this->dirs = array(); // Dependancies - $this->depends = array('modFournisseur'); + $this->depends = array('modFournisseur', 'modPropale'); $this->requiredby = array(); $this->config_page_url = array("askpricesupplier.php"); $this->langfiles = array("askpricesupplier"); @@ -87,13 +84,6 @@ class modAskPriceSupplier extends DolibarrModules $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "ASKPRICESUPPLIER_VALIDITY_DURATION"; - $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "15"; - $this->const[$r][3] = 'Durée de validitée des demandes de prix fournisseurs'; - $this->const[$r][4] = 0; - $r++; - $this->const[$r][0] = "ASKPRICESUPPLIER_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/askpricesupplier"; @@ -146,33 +136,6 @@ class modAskPriceSupplier extends DolibarrModules $this->rights[$r][1] = 'Cloturer les demandes de prix fournisseurs'; // libelle de la permission $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'cloturer'; - - // Exports - //-------- - $r=0; -/* - $r++; - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='ProposalsAndProposalsLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_permission[$r]=array(array("propale","export")); - $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','co.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.datec'=>"DateCreation",'c.datep'=>"DatePropal",'c.fin_validite'=>"DateEndPropal",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total'=>"TotalTTC",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel'); - //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text'); - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.ref'=>'Text','p.label'=>'Text'); - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"propal",'c.ref'=>"propal",'c.ref_client'=>"propal",'c.fk_soc'=>"propal",'c.datec'=>"propal",'c.datep'=>"propal",'c.fin_validite'=>"propal",'c.remise_percent'=>"propal",'c.total_ht'=>"propal",'c.total'=>"propal",'c.fk_statut'=>"propal",'c.note_public'=>"propal",'c.date_livraison'=>"propal",'cd.rowid'=>'propal_line','cd.label'=>"propal_line",'cd.description'=>"propal_line",'cd.product_type'=>'propal_line','cd.tva_tx'=>"propal_line",'cd.qty'=>"propal_line",'cd.total_ht'=>"propal_line",'cd.total_tva'=>"propal_line",'cd.total_ttc'=>"propal_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product'); - $this->export_dependencies_array[$r]=array('propal_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s '; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'propal as c'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uc.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'propal_extrafields as extra ON c.rowid = extra.fk_object'; - $this->export_sql_end[$r] .=', '.MAIN_DB_PREFIX.'propaldet as cd'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (cd.fk_product = p.rowid)'; - $this->export_sql_end[$r] .=' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; - $this->export_sql_end[$r] .=' AND c.entity = '.$conf->entity; - */ // Main menu entries $this->menu = array(); // List of menus to add @@ -273,14 +236,4 @@ class modAskPriceSupplier extends DolibarrModules return $this->_remove($sql,$options); } -} - - -/* - * -DROP TABLE llx_askpricesupplier_extrafields; -DROP TABLE llx_askpricesupplierdet_extrafields; -DROP TABLE llx_askpricesupplierdet; -DROP TABLE llx_askpricesupplier; - * - */ +} \ No newline at end of file diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index bca163db8bd..9e801108ada 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1150,6 +1150,13 @@ UseOptionLineIfNoQuantity=A line of product/service with a zero amount is consid FreeLegalTextOnProposal=Free text on commercial proposals WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty) BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal +##### AskPriceSupplier ##### +AskPriceSupplierSetup=Price requests suppliers module setup +AskPriceSupplierNumberingModules=Price requests suppliers numbering models +AskPriceSupplierPDFModules=Price requests suppliers documents models +FreeLegalTextOnAskPriceSupplier=Free text on price requests suppliers +WatermarkOnDraftAskPriceSupplier=Watermark on draft price requests suppliers (none if empty) +BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER=Ask for bank account destination of price request ##### Orders ##### OrdersSetup=Order management setup OrdersNumberingModules=Orders numbering models diff --git a/htdocs/langs/en_US/askpricesupplier.lang b/htdocs/langs/en_US/askpricesupplier.lang new file mode 100644 index 00000000000..80f0fe25285 --- /dev/null +++ b/htdocs/langs/en_US/askpricesupplier.lang @@ -0,0 +1,56 @@ +# Dolibarr language file - Source file is en_US - askpricesupplier +AskPriceSupplier=Price requests suppliers +askpricesupplierDESC=Managing price requests suppliers +askpricesupplierMENU_LEFT_TITLE=Price request supplier +askpricesupplierMENU_LEFT_TITLE_NEW=New request +askpricesupplierMENU_LEFT_TITLE_LIST=List +CommRequest=Price request +CommRequests=Price requests +SearchRequest=Find a request +DraftRequests=Draft requests +LastModifiedRequests=Last %s modified price requests +RequestsOpened=Opened price requests +AskPriceSupplierArea=Area price requests suppliers +Askpricesupplier=Price request supplier +NewAskPrice=New price request +NewAsk=New request +ShowAskpricesupplier=Show price request +AddAskPriceSupplier=Create a price request +AskPriceSupplierRefFourn=Supplier ref +AskPriceSupplierDate=Delivery date +AskPriceSupplierRefFournNotice=Before closing to "Accepted", think to grasp suppliers references. +RelatedAskPriceSupplier=Related price requests suppliers +ConfirmValidateAsk=Are you sure you want to validate this price request under name %s ? +DateAsk=Date of request +DeleteAsk=Delete request +ValidateAsk=Validate request +AddAsk=Create a request +AskpricesupplierDraft=Drafts +AskpricesupplierOpened=Opened +AskpricesupplierStatusDraft=Draft (needs to be validated) +AskpricesupplierStatusValidated=Validated (request is open) +AskpricesupplierStatusOpened=Validated (request is open) +AskpricesupplierStatusClosed=Closed +AskpricesupplierStatusSigned=Accepted +AskpricesupplierStatusNotSigned=Refused +AskpricesupplierStatusDraftShort=Draft +AskpricesupplierStatusValidatedShort=Validated +AskpricesupplierStatusOpenedShort=Opened +AskpricesupplierStatusClosedShort=Closed +AskpricesupplierStatusSignedShort=Accepted +AskpricesupplierStatusNotSignedShort=Refused +CopyAskFrom=Create price request by copying existing a request +CreateEmptyAsk=Create blank request +CloneAsk=Clone price request +ConfirmCloneAsk=Are you sure you want to clone the price request %s ? +ConfirmReOpenAsk=Are you sure you want to open back the price request %s ? +SendAskByMail=Send price request by mail +SendAskRef=Sending the price request %s +AskPriceSupplierCard=Request card +ConfirmDeleteAsk=Are you sure you want to delete this price request ? +ActionsOnAskPriceSupplier=Events on price request +DocModelAuroreDescription=A complete request model (logo...) +CommercialAsk=Price request +DefaultModelAskPriceSupplierCreate=Default model creation +DefaultModelAskPriceSupplierToBill=Default template when closing a price request (accepted) +DefaultModelAskPriceSupplierClosed=Default template when closing a price request (refused) \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0f41a43c90f..01e6bab6266 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -294,6 +294,7 @@ UnitPriceHT=Unit price (net) UnitPriceTTC=Unit price PriceU=U.P. PriceUHT=U.P. (net) +AskPriceSupplierUHT=P.U. HT Requested PriceUTTC=U.P. Amount=Amount AmountInvoice=Invoice amount diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index f5b39b3f704..d87601d8126 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -60,6 +60,7 @@ PredefinedMailTestHtml=This is a test mail (the word test must be in bold PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendInvoiceReminder=__CONTACTCIVNAME__\n\nWe would like to warn you that the invoice __FACREF__ seems to not being payed. So this is the invoice in attachment again, as a reminder.\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendProposal=__CONTACTCIVNAME__\n\nYou will find here the commercial proposal __PROPREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ +PredefinedMailContentSendAskPriceSupplier=__CONTACTCIVNAME__\n\nYou will find here the price request __ASKREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendOrder=__CONTACTCIVNAME__\n\nYou will find here the order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nYou will find here our order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__ diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 49e6a6a22ec..10195ce38aa 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1158,6 +1158,7 @@ AskPriceSupplierPDFModules=Modèles de documents de demandes de prix fournisseur AskPriceSupplierPDFModules=Modèles de documents de demandes de prix fournisseurs FreeLegalTextOnAskPriceSupplier=Mention complémentaire sur les demandes de prix fournisseurs WatermarkOnDraftAskPriceSupplier=Filigrane sur les brouillons de demandes de prix (aucun si vide) +BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER=Saisir le compte bancaire cible lors de la demande de prix ##### Orders ##### OrdersSetup=Configuration du module Commandes OrdersNumberingModules=Modèles de numérotation des commandes diff --git a/htdocs/langs/fr_FR/askpricesupplier.lang b/htdocs/langs/fr_FR/askpricesupplier.lang index 0eb72c68ab8..8891c8b7b76 100644 --- a/htdocs/langs/fr_FR/askpricesupplier.lang +++ b/htdocs/langs/fr_FR/askpricesupplier.lang @@ -22,30 +22,23 @@ AskPriceSupplierRefFournNotice=Avant de clôturer à "Acceptée", pensez à sais RelatedAskPriceSupplier=Demandes de prix fournisseurs associées ConfirmValidateAsk=Êtes-vous sûr de vouloir valider cette demande de prix sous la référence %s ? DateAsk=Date de demande -DateEndAsk=Date de fin de validité -DateEndAskShort=Date de fin DeleteAsk=Supprimer demande ValidateAsk=Valider demande AddAsk=Créer une demande AskpricesupplierDraft=Brouillons AskpricesupplierOpened=Ouvertes -AskpricesupplierNotBilled=Non facturées AskpricesupplierStatusDraft=Brouillon (à valider) AskpricesupplierStatusValidated=Validée (demande ouverte) AskpricesupplierStatusOpened=Validée (demande ouverte) AskpricesupplierStatusClosed=Fermée AskpricesupplierStatusSigned=Acceptée AskpricesupplierStatusNotSigned=Refusée -AskpricesupplierStatusBilled=Facturée AskpricesupplierStatusDraftShort=Brouillon AskpricesupplierStatusValidatedShort=Validée AskpricesupplierStatusOpenedShort=Ouverte AskpricesupplierStatusClosedShort=Fermée AskpricesupplierStatusSignedShort=Acceptée AskpricesupplierStatusNotSignedShort=Refusée -AskpricesupplierStatusBilledShort=Facturée -AskpricesupplierToClose=Demandes de prix à fermer -AskpricesupplierToBill=Demandes de prix signées à facturer CopyAskFrom=Créer demande/devis par recopie d'une demande existante CreateEmptyAsk=Créer demande/devis vierge CloneAsk=Cloner demande de prix @@ -55,15 +48,9 @@ SendAskByMail=Envoyer demande de prix par email SendAskRef=Envoi de la demande de prix %s AskPriceSupplierCard=Fiche demande ConfirmDeleteAsk=Êtes-vous sûr de vouloir effacer cette demande de prix %s ? -ListOfAskPriceSupplier=Liste des devis/propositions commerciales ActionsOnAskPriceSupplier=Événements sur la demande DocModelAuroreDescription=Modèle de demande de prix fournisseur complet (logo…) CommercialAsk=Demande de prix - DefaultModelAskPriceSupplierCreate=Modèle par défaut à la création -DefaultModelAskPriceSupplierToBill=Modèle par défaut lors de la clôture d'une proposition commerciale (à facturer) -DefaultModelAskPriceSupplierClosed=Modèle par défaut lors de la clôture d'une proposition commerciale (non facturée) -DefaultAskDurationValidity=Délai de validité par défaut (en jours) - -##### Types de contacts ##### -TypeContact_askpricesupplier_external_CUSTOMER=Contact client suivi demande \ No newline at end of file +DefaultModelAskPriceSupplierToBill=Modèle par défaut lors de la clôture d'une demande de prix (à accéptée) +DefaultModelAskPriceSupplierClosed=Modèle par défaut lors de la clôture d'une demande de prix (refusée) \ No newline at end of file diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 972fc5425fd..a3d9e75a4ac 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -60,7 +60,7 @@ PredefinedMailTestHtml=Ceci est un message de test (le mot test doit êtr PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ PredefinedMailContentSendInvoiceReminder=__CONTACTCIVNAME__ \n\nNous voudrions porter à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ PredefinedMailContentSendProposal=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la proposition commerciale __PROPREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ -PredefinedMailContentSendAskPriceSupplier=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la demande commerciale __ASKREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ +PredefinedMailContentSendAskPriceSupplier=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la demande de prix __ASKREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ PredefinedMailContentSendOrder=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la commande __ORDERREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint notre commande __ORDERREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__