[CORE] assainissement du code + traductions FR vers EN (#new_ask_price).

This commit is contained in:
phf 2015-02-04 15:39:57 +01:00
parent 6770e0415a
commit bcbf29d9a5
16 changed files with 211 additions and 1310 deletions

View File

@ -22,12 +22,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/admin/propal.php
* \ingroup propale
* \brief Setup page for commercial proposal module
*/
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.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') 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); $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER",$value,'chaine',0,'',$conf->entity);
@ -282,7 +260,6 @@ print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
clearstatcache(); clearstatcache();
foreach ($dirmodels as $reldir) foreach ($dirmodels as $reldir)
{ {
$dir = dol_buildpath($reldir."core/modules/askpricesupplier/"); $dir = dol_buildpath($reldir."core/modules/askpricesupplier/");
@ -296,7 +273,7 @@ foreach ($dirmodels as $reldir)
while (($file = readdir($handle))!==false) 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); $file = substr($file, 0, dol_strlen($file)-4);
@ -546,32 +523,6 @@ print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
print "<td>&nbsp;</td>\n"; print "<td>&nbsp;</td>\n";
print "</tr>"; print "</tr>";
$var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"setdefaultduration\">";
print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans("DefaultAskDurationValidity").'</td>';
print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".$conf->global->ASKPRICESUPPLIER_VALIDITY_DURATION."\"></td>";
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</form>';
/*
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setusecustomercontactasrecipient">';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("UseCustomerContactAsPropalRecipientIfExist");
print '</td><td width="60" align="center">';
print $form->selectyesno("value",$conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
*/
$var=! $var; $var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -622,7 +573,7 @@ else
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPLLIER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
} }
print '</table>'; print '</table>';

View File

@ -18,12 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/comm/admin/propal_extrafields.php
* \ingroup propal
* \brief Page to setup extra fields of third party
*/
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.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 * View
*/ */
$textobject=$langs->transnoentitiesnoconv("Proposals"); $textobject=$langs->transnoentitiesnoconv("CommRequests");
llxHeader('',$langs->trans("AskPriceSupplierSetup")); llxHeader('',$langs->trans("AskPriceSupplierSetup"));
@ -69,7 +63,7 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup'); 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'); dol_fiche_head($head, 'attributes', $langs->trans("CommRequests"), 0, 'askpricesupplier');

View File

@ -21,12 +21,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/comm/admin/propaldet_extrafields.php
* \ingroup order
* \brief Page to setup extra fields of order
*/
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -74,7 +68,7 @@ llxHeader('',$langs->trans("AskPriceSupplierSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup'); 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'); dol_fiche_head($head, 'attributeslines', $langs->trans("CommRequests"), 0, 'askpricesupplier');

View File

@ -25,11 +25,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/comm/propal.php
* \ingroup propale
* \brief Page of commercial proposals card and list
*/
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.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) else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->askpricesupplier->supprimer)
{ {
$result = $object->delete($user); $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) 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'])); $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); dol_print_error($db, $object->error);
} }
// Positionne ref client // Create askprice
else if ($action == 'set_ref_client' && $user->rights->askpricesupplier->creer)
{
$object->set_ref_client($user, $_POST['ref_client']);
}
// Create proposal
else if ($action == 'add' && $user->rights->askpricesupplier->creer) else if ($action == 'add' && $user->rights->askpricesupplier->creer)
{ {
$object->socid = $socid; $object->socid = $socid;
$object->fetch_thirdparty(); $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')); $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) { if ($socid < 1) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors'); setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
$action = 'create'; $action = 'create';
@ -270,25 +227,19 @@ if (empty($reshook))
{ {
$db->begin(); $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 (GETPOST('createmode') == 'copy' && GETPOST('copie_askpricesupplier'))
{ {
if ($object->fetch(GETPOST('copie_askpricesupplier')) > 0) { if ($object->fetch(GETPOST('copie_askpricesupplier')) > 0) {
$object->ref = GETPOST('ref'); $object->ref = GETPOST('ref');
$object->datep = $datep;
$object->date_livraison = $date_delivery; $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->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->duree_validite = $duration;
$object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_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_percent = GETPOST('remise_percent');
$object->remise_absolue = GETPOST('remise_absolue'); $object->remise_absolue = GETPOST('remise_absolue');
$object->socid = GETPOST('socid'); $object->socid = GETPOST('socid');
$object->contactid = GETPOST('contactid');
$object->fk_project = GETPOST('projectid'); $object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model'); $object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated $object->author = $user->id; // deprecated
@ -301,18 +252,12 @@ if (empty($reshook))
} }
} else { } else {
$object->ref = GETPOST('ref'); $object->ref = GETPOST('ref');
$object->ref_client = GETPOST('ref_client');
$object->datep = $datep;
$object->date_livraison = $date_delivery; $object->date_livraison = $date_delivery;
$object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_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->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->duree_validite = GETPOST('duree_validite');
$object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_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->contactid = GETPOST('contactid');
$object->fk_project = GETPOST('projectid'); $object->fk_project = GETPOST('projectid');
$object->modelpdf = GETPOST('model'); $object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated $object->author = $user->id; // deprecated
@ -343,30 +288,8 @@ if (empty($reshook))
{ {
if ($origin && $originid) 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'; $element = 'comm/askpricesupplier';
$subelement = 'askpricesupplier'; $subelement = 'askpricesupplier';
}
if ($element == 'contract') {
$element = $subelement = 'contrat';
}
if ($element == 'inter') {
$element = $subelement = 'ficheinter';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
}
$object->origin = $origin; $object->origin = $origin;
$object->origin_id = $originid; $object->origin_id = $originid;
@ -407,24 +330,6 @@ if (empty($reshook))
// Positive line // Positive line
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); $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;
// 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;
// Reset fk_parent_line for no child products and special product // 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) { if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0; $fk_parent_line = 0;
@ -438,7 +343,7 @@ if (empty($reshook))
$tva_tx=get_default_tva($mysoc, $object->thirdparty); $tva_tx=get_default_tva($mysoc, $object->thirdparty);
$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); $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);
if ($result > 0) { if ($result > 0) {
$lineid = $result; $lineid = $result;
@ -476,17 +381,6 @@ if (empty($reshook))
if ($id > 0) 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) if (! $error)
{ {
$db->commit(); $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 // Reopen proposal
else if ($action == 'confirm_reopen' && $user->rights->askpricesupplier->cloturer && ! GETPOST('cancel')) { else if ($action == 'confirm_reopen' && $user->rights->askpricesupplier->cloturer && ! GETPOST('cancel')) {
// prevent browser refresh from reopening proposal several times // prevent browser refresh from reopening proposal several times
@ -787,9 +663,6 @@ if (empty($reshook))
$fournprice = (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); $fournprice = (GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
$buyingprice = (GETPOST('buying_price' . $predef) ? GETPOST('buying_price' . $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 // Local Taxes
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty); $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty); $localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
@ -804,7 +677,7 @@ if (empty($reshook))
} else { } else {
// Insert line // Insert line
$ref_fourn = GETPOST('fourn_ref'); $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) { if ($result > 0) {
$db->commit(); $db->commit();
@ -839,18 +712,6 @@ if (empty($reshook))
unset($_POST['dp_desc']); unset($_POST['dp_desc']);
unset($_POST['idprod']); 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 { } else {
$db->rollback(); $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")) { else if ($action == 'updateligne' && $user->rights->askpricesupplier->creer && GETPOST('save') == $langs->trans("Save")) {
// Define info_bits // Define info_bits
$info_bits = 0; $info_bits = 0;
@ -875,15 +736,12 @@ if (empty($reshook))
$vat_rate = str_replace('*', '', $vat_rate); $vat_rate = str_replace('*', '', $vat_rate);
$localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty);
$localtax2_rate = get_localtax($vat_rate, 2, $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 // Add buying price
$fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : ''); $fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = (GETPOST('buying_price') ? GETPOST('buying_price') : ''); $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 // Extrafields
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
@ -932,7 +790,7 @@ if (empty($reshook))
if (! $error) { if (! $error) {
$db->begin(); $db->begin();
$ref_fourn = GETPOST('fourn_ref'); $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) { if ($result >= 0) {
$db->commit(); $db->commit();
@ -1025,11 +883,6 @@ if (empty($reshook))
$result = $object->availability($_POST['availability_id']); $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 // Conditions de reglement
else if ($action == 'setconditions' && $user->rights->askpricesupplier->creer) { else if ($action == 'setconditions' && $user->rights->askpricesupplier->creer) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
@ -1115,51 +968,6 @@ if (empty($reshook))
if ($error) if ($error)
$action = 'edit_extras'; $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 * 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); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -1177,7 +985,7 @@ $companystatic = new Societe($db);
$now = dol_now(); $now = dol_now();
// Add new proposal // Add new askprice
if ($action == 'create') if ($action == 'create')
{ {
print_fiche_titre($langs->trans("NewAskPrice")); print_fiche_titre($langs->trans("NewAskPrice"));
@ -1189,30 +997,8 @@ if ($action == 'create')
// Load objectsrc // Load objectsrc
if (! empty($origin) && ! empty($originid)) 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];
}
if ($element == 'project') {
$projectid = $originid;
} else {
// For compatibility
if ($element == 'order' || $element == 'commande') {
$element = $subelement = 'commande';
}
if ($element == 'askpricesupplier') {
$element = 'comm/askpricesupplier'; $element = 'comm/askpricesupplier';
$subelement = 'askpricesupplier'; $subelement = 'askpricesupplier';
}
if ($element == 'contract') {
$element = $subelement = 'contrat';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
}
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php'); dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
@ -1226,21 +1012,17 @@ if ($action == 'create')
$objectsrc->fetch_thirdparty(); $objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); $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; $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)); $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)); $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_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)); $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 // Replicate extrafields
$objectsrc->fetch_optionals($originid); $objectsrc->fetch_optionals($originid);
$object->array_options = $objectsrc->array_options; $object->array_options = $objectsrc->array_options;
}
} }
$object = new AskPriceSupplier($db); $object = new AskPriceSupplier($db);
@ -1260,13 +1042,6 @@ if ($action == 'create')
// Reference // Reference
print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>'; print '<tr><td class="fieldrequired">' . $langs->trans('Ref') . '</td><td colspan="2">' . $langs->trans("Draft") . '</td></tr>';
// Ref customer
/* PHFAVRE retrait en temporaire
print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td colspan="2">';
print '<input type="text" name="ref_client" value=""></td>';
print '</tr>';
*/
// Third party // Third party
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">' . $langs->trans('Supplier') . '</td>'; print '<td class="fieldrequired">' . $langs->trans('Supplier') . '</td>';
@ -1282,47 +1057,6 @@ if ($action == 'create')
} }
print '</tr>' . "\n"; print '</tr>' . "\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 "<tr><td>" . $langs->trans("DefaultContact") . '</td><td colspan="2">';
$form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
print '</td></tr>';
}
if ($socid > 0)
{
// Ligne info remises tiers
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="2">';
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 '</td></tr>';
}
*/
// Date
/* PHFAVRE retrait en temporaire
print '<tr><td class="fieldrequired">' . $langs->trans('AskPriceSupplierDate') . '</td><td colspan="2">';
$form->select_date('', '', '', '', '', "addask", 1, 1);
print '</td></tr>';
*/
// Validaty duration
/* PHFAVRE retrait en temporaire
print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td colspan="2"><input name="duree_validite" size="5" value="' . $conf->global->ASKPRICESUPPLIER_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>';
*/
// Terms of payment // Terms of payment
print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">'; print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
$form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id'); $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id');
@ -1340,20 +1074,6 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// What trigger creation
/* PHFAVRE retrait en temporaire
print '<tr><td>' . $langs->trans('Source') . '</td><td>';
$form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1);
print '</td></tr>';
*/
// Delivery delay
/* PHFAVRE retrait en temporaire
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
$form->selectAvailabilityDelay('', 'availability_id', '', 1);
print '</td></tr>';
*/
// Shipping Method // Shipping Method
if (! empty($conf->expedition->enabled)) { if (! empty($conf->expedition->enabled)) {
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">';
@ -1435,17 +1155,7 @@ if ($action == 'create')
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">'; print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">'; print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
$newclassname = $classname; print '<tr><td>' . $langs->trans('CommRequest') . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
if ($newclassname == 'Askpricesupplier')
$newclassname = 'CommRequest';
elseif ($newclassname == 'Commande')
$newclassname = 'Order';
elseif ($newclassname == 'Expedition')
$newclassname = 'Sending';
elseif ($newclassname == 'Fichinter')
$newclassname = 'Intervention';
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>'; print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>"; print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1 if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0 ) // Localtax1
@ -1543,7 +1253,6 @@ if ($action == 'create')
dol_fiche_end(); dol_fiche_end();
$langs->load("bills");
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("CreateDraft") . '">'; print '<input type="submit" class="button" value="' . $langs->trans("CreateDraft") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@ -1588,7 +1297,7 @@ if ($action == 'create')
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' =>
// 1), // 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 // 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); $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); $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') { else if ($action == 'validate') {
$error = 0; $error = 0;
@ -1655,123 +1364,10 @@ if ($action == 'create')
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>'; print '</td></tr>';
// Ref customer
/* PHFAVRE retrait en temporaire
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans('RefCustomer') . '</td>';
if ($action != 'refclient' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER['PHP_SELF'] . '?action=refclient&amp;id=' . $object->id . '">' . img_edit($langs->trans('Modify')) . '</a></td>';
print '</td>';
print '</tr></table>';
print '</td><td colspan="5">';
if ($user->rights->askpricesupplier->creer && $action == 'refclient') {
print '<form action="askpricesupplier.php?id=' . $object->id . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="set_ref_client">';
print '<input type="text" class="flat" size="20" name="ref_client" value="' . $object->ref_client . '">';
print ' <input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
print $object->ref_client;
}
print '</td>';
print '</tr>';
*/
// Company // Company
print '<tr><td>' . $langs->trans('Supplier') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>'; print '<tr><td>' . $langs->trans('Supplier') . '</td><td colspan="5">' . $soc->getNomUrl(1) . '</td>';
print '</tr>'; print '</tr>';
// Ligne info remises tiers
/* PHFAVRE retrait en temporaire
print '<tr><td>' . $langs->trans('Discounts') . '</td><td colspan="5">';
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 '<br>';
$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 '</td></tr>';
*/
// Date of proposal
/* PHFAVRE retrait en temporaire
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('AskPriceSupplierDate');
print '</td>';
if ($action != 'editdate' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if (! empty($object->brouillon) && $action == 'editdate') {
print '<form name="editdate" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="setdate">';
$form->select_date($object->date, 're', '', '', 0, "editdate");
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
if ($object->date) {
print dol_print_date($object->date, 'daytext');
} else {
print '&nbsp;';
}
}
print '</td>';
*/
// Date end proposal
/* PHFAVRE retrait en temporaire
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DateEndAsk');
print '</td>';
if ($action != 'editecheance' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if (! empty($object->brouillon) && $action == 'editecheance') {
print '<form name="editecheance" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="setecheance">';
$form->select_date($object->fin_validite, 'ech', '', '', '', "editecheance");
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} 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 '&nbsp;';
}
}
print '</td>';
print '</tr>';
*/
// Payment term // Payment term
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
@ -1812,69 +1408,6 @@ if ($action == 'create')
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Delivery delay
/* PHFAVRE retrait en temporaire
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('AvailabilityPeriod');
if (! empty($conf->commande->enabled))
print ' (' . $langs->trans('AfterOrder') . ')';
print '</td>';
if ($action != 'editavailability' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';
*/
// Shipping Method
/* PHFAVRE retrait en temporaire
if (! empty($conf->expedition->enabled)) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print $langs->trans('SendingMethod');
print '</td>';
if ($action != 'editshippingmethod' && $user->rights->propal->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';
}
*/
// Origin of demand
/* PHFAVRE retrait en temporaire
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source');
print '</td>';
if ($action != 'editdemandreason' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';
*/
// Payment mode // Payment mode
print '<tr>'; print '<tr>';
print '<td width="25%">'; print '<td width="25%">';
@ -1893,7 +1426,6 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
$langs->load("projects"); $langs->load("projects");
print '<tr><td>'; print '<tr><td>';
@ -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 '</table>'; print '</table>';
print "</form>\n"; print "</form>\n";
@ -2132,11 +1646,7 @@ if ($action == 'create')
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
// else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>'; // else print '<a class="butActionRefused" href="#">'.$langs->trans('Validate').'</a>';
} }
// 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 '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}
// Edit // Edit
if ($object->statut == 1 && $user->rights->askpricesupplier->creer) { if ($object->statut == 1 && $user->rights->askpricesupplier->creer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
}
}
// Create an invoice and classify billed
if ($object->statut == 2) {
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
}
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES))
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
}
}
// Close // Close
if ($object->statut == 1 && $user->rights->askpricesupplier->cloturer) { if ($object->statut == 1 && $user->rights->askpricesupplier->cloturer) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"'; print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
@ -2212,8 +1699,6 @@ if ($action == 'create')
if ($action != 'presend') if ($action != 'presend')
{ {
print '<div class="fichecenter"><div class="fichehalfleft">'; print '<div class="fichecenter"><div class="fichehalfleft">';
// print '<table width="100%"><tr><td width="50%" valign="top">';
// print '<a name="builddoc"></a>'; // ancre
/* /*
* Documents generes * Documents generes
@ -2234,14 +1719,12 @@ if ($action == 'create')
$somethingshown = $object->showLinkedObjectBlock(); $somethingshown = $object->showLinkedObjectBlock();
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// print '</td><td valign="top" width="50%">';
// List of actions on element // List of actions on element
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
$formactions = new FormActions($db); $formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'askpricesupplier', $socid); $somethingshown = $formactions->showactions($object, 'askpricesupplier', $socid);
// print '</td></tr></table>';
print '</div></div></div>'; print '</div></div></div>';
} }
@ -2301,11 +1784,9 @@ if ($action == 'create')
$formmail->withto = GETPOST("sendto") ? GETPOST("sendto") : $liste; $formmail->withto = GETPOST("sendto") ? GETPOST("sendto") : $liste;
$formmail->withtocc = $liste; $formmail->withtocc = $liste;
$formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false); $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__'); $formmail->withtopic = $outputlangs->trans('SendAskRef', '__ASKREF__');
} else if (! empty($object->ref_client)) {
$formmail->withtopic = $outputlangs->trans('SendAskRef', '__ASKREF__ (__REFCLIENT__)');
}
$formmail->withfile = 2; $formmail->withfile = 2;
$formmail->withbody = 1; $formmail->withbody = 1;
$formmail->withdeliveryreceipt = 1; $formmail->withdeliveryreceipt = 1;
@ -2314,30 +1795,10 @@ if ($action == 'create')
// Tableau des substitutions // Tableau des substitutions
$formmail->substit['__ASKREF__'] = $object->ref; $formmail->substit['__ASKREF__'] = $object->ref;
$formmail->substit['__SIGNATURE__'] = $user->signature; $formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name; $formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:''); $formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit['__CONTACTCIVNAME__'] = ''; $formmail->substit['__CONTACTCIVNAME__'] = '';
$formmail->substit['__PERSONALIZED__'] = '';
// 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;
}
}
// Tableau des parametres complementaires // Tableau des parametres complementaires
$formmail->param['action'] = 'send'; $formmail->param['action'] = 'send';

View File

@ -58,18 +58,14 @@ class AskPriceSupplier extends CommonObject
var $socid; // Id client var $socid; // Id client
var $client; // Objet societe client (a charger par fetch_client) var $client; // Objet societe client (a charger par fetch_client)
var $contactid;
var $fk_project; var $fk_project;
var $author; var $author;
var $ref; 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 $statut; // 0 (draft), 1 (validated), 2 (signed), 3 (not signed), 4 (billed)
var $datec; // Date of creation var $datec; // Date of creation
var $datev; // Date of validation
var $date; // Date of proposal var $date; // Date of proposal
var $datep; // Same than date
var $date_livraison; var $date_livraison;
var $fin_validite;
var $user_author_id; var $user_author_id;
var $user_valid_id; var $user_valid_id;
@ -95,15 +91,7 @@ class AskPriceSupplier extends CommonObject
var $note; // deprecated (for compatibility) var $note; // deprecated (for compatibility)
var $note_private; var $note_private;
var $note_public; var $note_public;
var $fk_delivery_address; // deprecated (for compatibility)
var $fk_address;
var $address_type;
var $address;
var $shipping_method_id; var $shipping_method_id;
var $availability_id;
var $availability_code;
var $demand_reason_id;
var $demand_reason_code;
var $products=array(); var $products=array();
var $extraparams=array(); var $extraparams=array();
@ -117,7 +105,6 @@ class AskPriceSupplier extends CommonObject
var $labelstatut=array(); var $labelstatut=array();
var $labelstatut_short=array(); var $labelstatut_short=array();
// Pour board
var $nbtodo; var $nbtodo;
var $nbtodolate; var $nbtodolate;
@ -143,8 +130,6 @@ class AskPriceSupplier extends CommonObject
$this->remise_percent = 0; $this->remise_percent = 0;
$this->remise_absolue = 0; $this->remise_absolue = 0;
$this->duree_validite=$conf->global->ASKPRICESUPPLIER_VALIDITY_DURATION;
$langs->load("askpricesupplier"); $langs->load("askpricesupplier");
$this->labelstatut[0]=(! empty($conf->global->ASKPRICESUPPLIER_STATUS_DRAFT_LABEL) ? $conf->global->ASKPRICESUPPLIER_STATUS_DRAFT_LABEL : $langs->trans("AskpricesupplierStatusDraft")); $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")); $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; return -5;
} }
$propalligne=new AskPriceSupplierLigne($this->db); $askpricesupplierligne=new AskPriceSupplierLigne($this->db);
$propalligne->fk_askpricesupplier=$this->id; $askpricesupplierligne->fk_askpricesupplier=$this->id;
$propalligne->fk_remise_except=$remise->id; $askpricesupplierligne->fk_remise_except=$remise->id;
$propalligne->desc=$remise->description; // Description ligne $askpricesupplierligne->desc=$remise->description; // Description ligne
$propalligne->tva_tx=$remise->tva_tx; $askpricesupplierligne->tva_tx=$remise->tva_tx;
$propalligne->subprice=-$remise->amount_ht; $askpricesupplierligne->subprice=-$remise->amount_ht;
$propalligne->fk_product=0; // Id produit predefini $askpricesupplierligne->fk_product=0; // Id produit predefini
$propalligne->qty=1; $askpricesupplierligne->qty=1;
$propalligne->remise=0; $askpricesupplierligne->remise=0;
$propalligne->remise_percent=0; $askpricesupplierligne->remise_percent=0;
$propalligne->rang=-1; $askpricesupplierligne->rang=-1;
$propalligne->info_bits=2; $askpricesupplierligne->info_bits=2;
// TODO deprecated // TODO deprecated
$propalligne->price=-$remise->amount_ht; $askpricesupplierligne->price=-$remise->amount_ht;
$propalligne->total_ht = -$remise->amount_ht; $askpricesupplierligne->total_ht = -$remise->amount_ht;
$propalligne->total_tva = -$remise->amount_tva; $askpricesupplierligne->total_tva = -$remise->amount_tva;
$propalligne->total_ttc = -$remise->amount_ttc; $askpricesupplierligne->total_ttc = -$remise->amount_ttc;
$result=$propalligne->insert(); $result=$askpricesupplierligne->insert();
if ($result > 0) if ($result > 0)
{ {
$result=$this->update_price(1); $result=$this->update_price(1);
@ -277,7 +262,7 @@ class AskPriceSupplier extends CommonObject
} }
else else
{ {
$this->error=$propalligne->error; $this->error=$askpricesupplierligne->error;
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
} }
@ -314,14 +299,12 @@ class AskPriceSupplier extends CommonObject
* @param int $fk_fournprice Id supplier price * @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax * @param int $pa_ht Buying price without tax
* @param string $label ??? * @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 * @param array $array_option extrafields array
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* *
* @see add_product * @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; global $mysoc;
@ -417,9 +400,6 @@ class AskPriceSupplier extends CommonObject
$this->line->special_code=$special_code; $this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line; $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); $this->line->ref_fourn = $this->db->escape($ref_fourn);
// infos marge // infos marge
@ -495,12 +475,10 @@ class AskPriceSupplier extends CommonObject
* @param int $pa_ht Price (without tax) of product when it was bought * @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label ??? * @param string $label ???
* @param int $type 0/1=Product/service * @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 * @param array $array_option extrafields array
* @return int 0 if OK, <0 if KO * @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; global $conf,$user,$langs, $mysoc;
@ -594,9 +572,6 @@ class AskPriceSupplier extends CommonObject
} }
$this->line->pa_ht = $pa_ht; $this->line->pa_ht = $pa_ht;
$this->line->date_start=$date_start;
$this->line->date_end=$date_end;
// TODO deprecated // TODO deprecated
$this->line->price=$price; $this->line->price=$price;
$this->line->remise=$remise; $this->line->remise=$remise;
@ -682,12 +657,6 @@ class AskPriceSupplier extends CommonObject
$now=dol_now(); $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"); dol_syslog(get_class($this)."::create");
// Check parameters // 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(); $this->db->begin();
// Insert into database // Insert into database
@ -732,22 +692,17 @@ class AskPriceSupplier extends CommonObject
$sql.= ", remise_absolue"; $sql.= ", remise_absolue";
$sql.= ", tva"; $sql.= ", tva";
$sql.= ", total"; $sql.= ", total";
$sql.= ", datep";
$sql.= ", datec"; $sql.= ", datec";
$sql.= ", ref"; $sql.= ", ref";
$sql.= ", fk_user_author"; $sql.= ", fk_user_author";
$sql.= ", note_private"; $sql.= ", note_private";
$sql.= ", note_public"; $sql.= ", note_public";
$sql.= ", model_pdf"; $sql.= ", model_pdf";
$sql.= ", fin_validite";
$sql.= ", fk_cond_reglement"; $sql.= ", fk_cond_reglement";
$sql.= ", fk_mode_reglement"; $sql.= ", fk_mode_reglement";
$sql.= ", fk_account"; $sql.= ", fk_account";
$sql.= ", ref_client";
$sql.= ", date_livraison"; $sql.= ", date_livraison";
$sql.= ", fk_shipping_method"; $sql.= ", fk_shipping_method";
$sql.= ", fk_availability";
$sql.= ", fk_input_reason";
$sql.= ", fk_projet"; $sql.= ", fk_projet";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ") "; $sql.= ") ";
@ -759,22 +714,17 @@ class AskPriceSupplier extends CommonObject
$sql.= ", ".($this->remise_absolue?$this->remise_absolue:'null'); $sql.= ", ".($this->remise_absolue?$this->remise_absolue:'null');
$sql.= ", 0"; $sql.= ", 0";
$sql.= ", 0"; $sql.= ", 0";
$sql.= ", '".$this->db->idate($this->date)."'";
$sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", '(PROV)'"; $sql.= ", '(PROV)'";
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null"); $sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
$sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_private)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'";
$sql.= ", '".$this->modelpdf."'"; $sql.= ", '".$this->modelpdf."'";
$sql.= ", ".($this->fin_validite!=''?"'".$this->db->idate($this->fin_validite)."'":"null");
$sql.= ", ".$this->cond_reglement_id; $sql.= ", ".$this->cond_reglement_id;
$sql.= ", ".$this->mode_reglement_id; $sql.= ", ".$this->mode_reglement_id;
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); $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->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null");
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'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.= ", ".($this->fk_project?$this->fk_project:"null");
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ")"; $sql.= ")";
@ -828,8 +778,6 @@ class AskPriceSupplier extends CommonObject
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label, $this->lines[$i]->label,
$this->lines[$i]->date_start,
$this->lines[$i]->date_end,
$this->lines[$i]->array_options, $this->lines[$i]->array_options,
$this->lines[$i]->ref_fourn $this->lines[$i]->ref_fourn
); );
@ -855,17 +803,6 @@ class AskPriceSupplier extends CommonObject
if (! $ret) dol_print_error($this->db); 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) if (! $error)
{ {
// Mise a jour infos denormalisees // 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 * @param User $user User that create
* @return int Id of the new object if ok, <0 if ko * @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->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->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$this->fk_project = ''; $this->fk_project = '';
$this->fk_delivery_address = '';
} }
// reset ref_client
$this->ref_client = '';
// TODO Change product price if multi-prices // TODO Change product price if multi-prices
} }
else else
@ -1007,9 +940,6 @@ class AskPriceSupplier extends CommonObject
$this->user_author = $user->id; $this->user_author = $user->id;
$this->user_valid = ''; $this->user_valid = '';
$this->date = $now; $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 // Set ref
require_once DOL_DOCUMENT_ROOT ."/core/modules/askpricesupplier/".$conf->global->ASKPRICESUPPLIER_ADDON.'.php'; require_once DOL_DOCUMENT_ROOT ."/core/modules/askpricesupplier/".$conf->global->ASKPRICESUPPLIER_ADDON.'.php';
@ -1020,21 +950,6 @@ class AskPriceSupplier extends CommonObject
// Create clone // Create clone
$result=$this->create($user); $result=$this->create($user);
if ($result < 0) $error++; 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) if (! $error)
{ {
@ -1081,30 +996,21 @@ class AskPriceSupplier extends CommonObject
$sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht"; $sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
$sql.= ", p.datec"; $sql.= ", p.datec";
$sql.= ", p.date_valid as datev"; $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.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.note_private, p.note_public";
$sql.= ", p.fk_projet, p.fk_statut"; $sql.= ", p.fk_projet, p.fk_statut";
$sql.= ", p.fk_user_author, p.fk_user_valid, p.fk_user_cloture"; $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_cond_reglement";
$sql.= ", p.fk_mode_reglement"; $sql.= ", p.fk_mode_reglement";
$sql.= ', p.fk_account'; $sql.= ', p.fk_account';
$sql.= ", p.fk_shipping_method"; $sql.= ", p.fk_shipping_method";
$sql.= ", c.label as statut_label"; $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.= ", 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.= ", 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.= " 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_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_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.= " WHERE p.fk_statut = c.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
if ($ref) $sql.= " AND p.ref='".$ref."'"; if ($ref) $sql.= " AND p.ref='".$ref."'";
@ -1121,7 +1027,6 @@ class AskPriceSupplier extends CommonObject
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->ref; $this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->remise = $obj->remise; $this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent; $this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue; $this->remise_absolue = $obj->remise_absolue;
@ -1144,18 +1049,8 @@ class AskPriceSupplier extends CommonObject
$this->datev = $this->db->jdate($obj->datev); // TODO obsolete $this->datev = $this->db->jdate($obj->datev); // TODO obsolete
$this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_creation = $this->db->jdate($obj->datec); //Creation date
$this->date_validation = $this->db->jdate($obj->datev); //Validation 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->date_livraison = $this->db->jdate($obj->date_livraison);
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; $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_id = $obj->fk_mode_reglement;
$this->mode_reglement_code = $obj->mode_reglement_code; $this->mode_reglement_code = $obj->mode_reglement_code;
@ -1189,12 +1084,12 @@ class AskPriceSupplier extends CommonObject
$this->lines = array(); $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 = "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.= " 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.= ' 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.= " FROM ".MAIN_DB_PREFIX."askpricesupplierdet as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
$sql.= " WHERE d.fk_askpricesupplier = ".$this->id; $sql.= " WHERE d.fk_askpricesupplier = ".$this->id;
@ -1250,14 +1145,10 @@ class AskPriceSupplier extends CommonObject
$line->product_desc = $objp->product_desc; // Description produit $line->product_desc = $objp->product_desc; // Description produit
$line->fk_product_type = $objp->fk_product_type; $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; $line->ref_fourn = $objp->ref_produit_fourn;
$this->lines[$i] = $line; $this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
//print "xx $i ".$this->lines[$i]->fk_product;
$i++; $i++;
} }
$this->db->free($result); $this->db->free($result);
@ -1268,7 +1159,7 @@ class AskPriceSupplier extends CommonObject
return -1; return -1;
} }
// Retreive all extrafield for propal // Retreive all extrafield for askprice
// fetch optionals attributes and labels // fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db); $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 * 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 * 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 * @param User $user Object user
* @return int <0 if KO, >0 if OK
*/ */
function updateOrCreatePriceFournisseur($user) function updateOrCreatePriceFournisseur($user)
{ {
@ -1926,37 +1662,6 @@ class AskPriceSupplier extends CommonObject
} }
} }
/**
* 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 * 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 $shortlist 0=Return array[id]=ref, 1=Return array[](id=>id,ref=>ref,name=>name)
* @param int $draft 0=not draft, 1=draft * @param int $draft 0=not draft, 1=draft
@ -1996,14 +1701,14 @@ class AskPriceSupplier extends CommonObject
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @return int -1 if KO, array with result if OK * @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; global $conf,$user;
$ga = array(); $ga = array();
$sql = "SELECT s.rowid, s.nom as name, s.client,"; $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"; $sql.= " p.datep as dp, p.fin_validite as datelimite";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; 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"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."askpricesupplier as p, ".MAIN_DB_PREFIX."c_propalst as c";
@ -2060,102 +1765,7 @@ class AskPriceSupplier extends CommonObject
} }
/** /**
* Returns an array with the numbers of related invoices * Delete askprice
*
* @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
* *
* @param User $user Object user that delete * @param User $user Object user that delete
* @param int $notrigger 1=Does not execute triggers, 0= execuete triggers * @param int $notrigger 1=Does not execute triggers, 0= execuete triggers
@ -2190,12 +1800,6 @@ class AskPriceSupplier extends CommonObject
$res = $this->deleteObjectLinked(); $res = $this->deleteObjectLinked();
if ($res < 0) $error++; if ($res < 0) $error++;
// Delete linked contacts
/* PHFAVRE retrait en temporaire
$res = $this->delete_linked_contact();
if ($res < 0) $error++;
*/
if (! $error) if (! $error)
{ {
// We remove directory // We remove directory
@ -2280,76 +1884,7 @@ class AskPriceSupplier extends CommonObject
} }
/** /**
* Change the delivery time * Object AskPriceSupplier Information
*
* @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
* *
* @param int $id Proposal id * @param int $id Proposal id
* @return void * @return void
@ -2448,7 +1983,7 @@ class AskPriceSupplier extends CommonObject
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Object user * @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 * @return int <0 if KO, >0 if OK
*/ */
function load_board($user,$mode) function load_board($user,$mode)
@ -2460,7 +1995,7 @@ class AskPriceSupplier extends CommonObject
$this->nbtodo=$this->nbtodolate=0; $this->nbtodo=$this->nbtodolate=0;
$clause = " WHERE"; $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"; $sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier as p";
if (!$user->rights->societe->client->voir && !$user->societe_id) if (!$user->rights->societe->client->voir && !$user->societe_id)
{ {
@ -2536,19 +2071,13 @@ class AskPriceSupplier extends CommonObject
// Initialise parametres // Initialise parametres
$this->id=0; $this->id=0;
$this->ref = 'SPECIMEN'; $this->ref = 'SPECIMEN';
$this->ref_client='NEMICEPS';
$this->specimen=1; $this->specimen=1;
$this->socid = 1; $this->socid = 1;
$this->date = time(); $this->date = time();
$this->fin_validite = $this->date+3600*24*30;
$this->cond_reglement_id = 1; $this->cond_reglement_id = 1;
$this->cond_reglement_code = 'RECEP'; $this->cond_reglement_code = 'RECEP';
$this->mode_reglement_id = 7; $this->mode_reglement_id = 7;
$this->mode_reglement_code = 'CHQ'; $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_public='This is a comment (public)';
$this->note_private='This is a comment (private)'; $this->note_private='This is a comment (private)';
// Lines // Lines
@ -2621,7 +2150,7 @@ class AskPriceSupplier extends CommonObject
// This assignment in condition is not a bug. It allows walking the results. // This assignment in condition is not a bug. It allows walking the results.
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$this->nb["proposals"]=$obj->nb; $this->nb["askprice"]=$obj->nb;
} }
$this->db->free($resql); $this->db->free($resql);
return 1; 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 * 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 * @param Societe $soc Object thirdparty
* @return string Reference libre pour la propale * @return string Reference libre pour la propale
@ -2681,7 +2210,6 @@ class AskPriceSupplier extends CommonObject
else else
{ {
$this->error=$obj->error; $this->error=$obj->error;
//dol_print_error($db,"Propale::getNextNumRef ".$obj->error);
return ""; return "";
} }
} }
@ -2707,18 +2235,10 @@ class AskPriceSupplier extends CommonObject
$result=''; $result='';
$label=$langs->trans("ShowAskpricesupplier").': '.$this->ref; $label=$langs->trans("ShowAskpricesupplier").': '.$this->ref;
if (! empty($this->ref_client))
$label.= '<br>'.$langs->trans('RefCustomer').': '.$this->ref_client;
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
if ($option == '') { if ($option == '') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier.php?id='.$this->id. $get_params .$linkclose; $lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier.php?id='.$this->id. $get_params .$linkclose;
} }
if ($option == 'compta') { // deprecated
$lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'expedition') {
$lien = '<a href="'.DOL_URL_ROOT.'/expedition/askpricesupplier.php?id='.$this->id. $get_params .$linkclose;
}
if ($option == 'document') { if ($option == 'document') {
$lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$this->id. $get_params .$linkclose; $lien = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$this->id. $get_params .$linkclose;
} }
@ -2736,7 +2256,7 @@ class AskPriceSupplier extends CommonObject
} }
/** /**
* Retrieve an array of propal lines * Retrieve an array of askprice lines
* *
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
@ -2745,7 +2265,7 @@ class AskPriceSupplier extends CommonObject
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,'; $sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,'; $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,'; $sql.= ' pt.product_type, pt.rang, pt.fk_parent_line,';
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
$sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn'; $sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn';
$sql.= ' FROM '.MAIN_DB_PREFIX.'askpricesupplierdet as pt'; $sql.= ' FROM '.MAIN_DB_PREFIX.'askpricesupplierdet as pt';
@ -2792,8 +2312,6 @@ class AskPriceSupplier extends CommonObject
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line; $this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
$this->lines[$i]->special_code = $obj->special_code; $this->lines[$i]->special_code = $obj->special_code;
$this->lines[$i]->rang = $obj->rang; $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; $this->lines[$i]->ref_fourn = $obj->ref_produit_fourn;
@ -2835,7 +2353,7 @@ class AskPriceSupplier extends CommonObject
} }
else else
{ {
$modele = 'azur'; $modele = 'aurore';
} }
} }
@ -2850,7 +2368,7 @@ class AskPriceSupplier extends CommonObject
/** /**
* \class AskPriceSupplierLigne * \class AskPriceSupplierLigne
* \brief Class to manage price ask supplier lines * \brief Class to manage askpricesupplier lines
*/ */
class AskPriceSupplierLigne extends CommonObject class AskPriceSupplierLigne extends CommonObject
{ {
@ -2862,7 +2380,7 @@ class AskPriceSupplierLigne extends CommonObject
var $oldline; var $oldline;
// From llx_propaldet // From llx_askpricesupplierdet
var $rowid; var $rowid;
var $fk_askpricesupplier; var $fk_askpricesupplier;
var $fk_parent_line; var $fk_parent_line;
@ -2912,9 +2430,6 @@ class AskPriceSupplierLigne extends CommonObject
var $total_localtax1; // Line total local tax 1 var $total_localtax1; // Line total local tax 1
var $total_localtax2; // Line total local tax 2 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 $skip_update_total; // Skip update price total for special lines
var $ref_fourn; 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.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.= ' 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.= ' 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.= ' FROM '.MAIN_DB_PREFIX.'askpricesupplierdet as pd';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
$sql.= ' WHERE pd.rowid = '.$rowid; $sql.= ' WHERE pd.rowid = '.$rowid;
@ -2988,9 +2503,6 @@ class AskPriceSupplierLigne extends CommonObject
$this->product_label = $objp->product_label; $this->product_label = $objp->product_label;
$this->product_desc = $objp->product_desc; $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; $this->ref_fourn = $objp->ref_produit_forun;
$this->db->free($result); $this->db->free($result);
@ -3051,7 +2563,7 @@ class AskPriceSupplierLigne extends CommonObject
$sql.= ' subprice, remise_percent, '; $sql.= ' subprice, remise_percent, ';
$sql.= ' info_bits, '; $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.= ' 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.= " VALUES (".$this->fk_askpricesupplier.",";
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"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.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").",";
$sql.= ' '.$this->special_code.','; $sql.= ' '.$this->special_code.',';
$sql.= ' '.$this->rang.','; $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.= " '".$this->db->escape($this->ref_fourn)."'";
$sql.= ')'; $sql.= ')';
@ -3240,8 +2750,6 @@ class AskPriceSupplierLigne extends CommonObject
if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code; 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"); $sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
if (! empty($this->rang)) $sql.= ", rang=".$this->rang; 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.= " , ref_fourn=".(! empty($this->ref_fourn)?"'".$this->db->escape($this->ref_fourn)."'":"null");
$sql.= " WHERE rowid = ".$this->rowid; $sql.= " WHERE rowid = ".$this->rowid;

View File

@ -4,13 +4,10 @@ CREATE TABLE `llx_askpricesupplier` (
`entity` int(11) NOT NULL DEFAULT '1', `entity` int(11) NOT NULL DEFAULT '1',
`ref_ext` varchar(255) DEFAULT NULL, `ref_ext` varchar(255) DEFAULT NULL,
`ref_int` varchar(255) DEFAULT NULL, `ref_int` varchar(255) DEFAULT NULL,
`ref_client` varchar(255) DEFAULT NULL,
`fk_soc` int(11) DEFAULT NULL, `fk_soc` int(11) DEFAULT NULL,
`fk_projet` int(11) DEFAULT NULL, `fk_projet` int(11) DEFAULT NULL,
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`datec` datetime DEFAULT NULL, `datec` datetime DEFAULT NULL,
`datep` date DEFAULT NULL,
`fin_validite` datetime DEFAULT NULL,
`date_valid` datetime DEFAULT NULL, `date_valid` datetime DEFAULT NULL,
`date_cloture` datetime DEFAULT NULL, `date_cloture` datetime DEFAULT NULL,
`fk_user_author` int(11) DEFAULT NULL, `fk_user_author` int(11) DEFAULT NULL,
@ -36,11 +33,8 @@ CREATE TABLE `llx_askpricesupplier` (
`model_pdf` varchar(255) DEFAULT NULL, `model_pdf` varchar(255) DEFAULT NULL,
`date_livraison` date DEFAULT NULL, `date_livraison` date DEFAULT NULL,
`fk_shipping_method` int(11) 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, `import_key` varchar(14) DEFAULT NULL,
`extraparams` varchar(255) DEFAULT NULL, `extraparams` varchar(255) DEFAULT NULL,
`fk_delivery_address` int(11) DEFAULT NULL,
PRIMARY KEY (`rowid`), PRIMARY KEY (`rowid`),
UNIQUE KEY `uk_askpricesupplier_ref` (`ref`,`entity`), UNIQUE KEY `uk_askpricesupplier_ref` (`ref`,`entity`),
KEY `idx_askpricesupplier_fk_soc` (`fk_soc`), KEY `idx_askpricesupplier_fk_soc` (`fk_soc`),

View File

@ -22,8 +22,6 @@ CREATE TABLE `llx_askpricesupplierdet` (
`total_localtax2` double(24,8) DEFAULT '0.00000000', `total_localtax2` double(24,8) DEFAULT '0.00000000',
`total_ttc` double(24,8) DEFAULT '0.00000000', `total_ttc` double(24,8) DEFAULT '0.00000000',
`product_type` int(11) DEFAULT '0', `product_type` int(11) DEFAULT '0',
`date_start` datetime DEFAULT NULL,
`date_end` datetime DEFAULT NULL,
`info_bits` int(11) DEFAULT '0', `info_bits` int(11) DEFAULT '0',
`buy_price_ht` double(24,8) DEFAULT '0.00000000', `buy_price_ht` double(24,8) DEFAULT '0.00000000',
`fk_product_fournisseur_price` int(11) DEFAULT NULL, `fk_product_fournisseur_price` int(11) DEFAULT NULL,

View File

@ -17,11 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* \file htdocs/comm/propal/tpl/linkedobjectblock.tpl.php
* \ingroup propal
* \brief Template to show objects linked to proposals
*/
?> ?>
<!-- BEGIN PHP TEMPLATE --> <!-- BEGIN PHP TEMPLATE -->

View File

@ -21,11 +21,11 @@
*/ */
/** /**
* \defgroup propale Module commercial proposals * \defgroup askpricesupplier Module de demandes de prix fournisseurs
* \brief Module pour gerer la tenue de propositions commerciales * \brief Module pour gerer la tenue des demandes fournisseurs
* \file htdocs/core/modules/modPropale.class.php * \file htdocs/core/modules/modAskPriceSupplier.class.php
* \ingroup propale * \ingroup askpricesupplier
* \brief Fichier de description et activation du module Propale * \brief Fichier de description et activation du module AskPriceSupplier
*/ */
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
@ -49,22 +49,19 @@ class modAskPriceSupplier extends DolibarrModules
$this->numero = 999999; $this->numero = 999999;
$this->family = "products"; $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->name = preg_replace('/^mod/i','',get_class($this));
$this->description = "askpricesupplierDESC"; $this->description = "askpricesupplierDESC";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0; $this->special = 0;
$this->picto='askpricesupplier'; $this->picto='askpricesupplier';
// Data directories to create when module is enabled
$this->dirs = array(); $this->dirs = array();
// Dependancies // Dependancies
$this->depends = array('modFournisseur'); $this->depends = array('modFournisseur', 'modPropale');
$this->requiredby = array(); $this->requiredby = array();
$this->config_page_url = array("askpricesupplier.php"); $this->config_page_url = array("askpricesupplier.php");
$this->langfiles = array("askpricesupplier"); $this->langfiles = array("askpricesupplier");
@ -87,13 +84,6 @@ class modAskPriceSupplier extends DolibarrModules
$this->const[$r][4] = 0; $this->const[$r][4] = 0;
$r++; $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][0] = "ASKPRICESUPPLIER_ADDON_PDF_ODT_PATH";
$this->const[$r][1] = "chaine"; $this->const[$r][1] = "chaine";
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/askpricesupplier"; $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/askpricesupplier";
@ -147,33 +137,6 @@ class modAskPriceSupplier extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'cloturer'; $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 // Main menu entries
$this->menu = array(); // List of menus to add $this->menu = array(); // List of menus to add
$r=0; $r=0;
@ -274,13 +237,3 @@ class modAskPriceSupplier extends DolibarrModules
} }
} }
/*
*
DROP TABLE llx_askpricesupplier_extrafields;
DROP TABLE llx_askpricesupplierdet_extrafields;
DROP TABLE llx_askpricesupplierdet;
DROP TABLE llx_askpricesupplier;
*
*/

View File

@ -1150,6 +1150,13 @@ UseOptionLineIfNoQuantity=A line of product/service with a zero amount is consid
FreeLegalTextOnProposal=Free text on commercial proposals FreeLegalTextOnProposal=Free text on commercial proposals
WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty) WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty)
BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal 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 ##### ##### Orders #####
OrdersSetup=Order management setup OrdersSetup=Order management setup
OrdersNumberingModules=Orders numbering models OrdersNumberingModules=Orders numbering models

View File

@ -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 <b>%s</b> ?
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 <b>%s</b> ?
ConfirmReOpenAsk=Are you sure you want to open back the price request <b>%s</b> ?
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)

View File

@ -294,6 +294,7 @@ UnitPriceHT=Unit price (net)
UnitPriceTTC=Unit price UnitPriceTTC=Unit price
PriceU=U.P. PriceU=U.P.
PriceUHT=U.P. (net) PriceUHT=U.P. (net)
AskPriceSupplierUHT=P.U. HT Requested
PriceUTTC=U.P. PriceUTTC=U.P.
Amount=Amount Amount=Amount
AmountInvoice=Invoice amount AmountInvoice=Invoice amount

View File

@ -60,6 +60,7 @@ PredefinedMailTestHtml=This is a <b>test</b> 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__ 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__ 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__ 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__ 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__ 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__ PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__

View File

@ -1158,6 +1158,7 @@ AskPriceSupplierPDFModules=Modèles de documents de demandes de prix fournisseur
AskPriceSupplierPDFModules=Modèles de documents de demandes de prix fournisseurs AskPriceSupplierPDFModules=Modèles de documents de demandes de prix fournisseurs
FreeLegalTextOnAskPriceSupplier=Mention complémentaire sur les 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) 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 ##### ##### Orders #####
OrdersSetup=Configuration du module Commandes OrdersSetup=Configuration du module Commandes
OrdersNumberingModules=Modèles de numérotation des commandes OrdersNumberingModules=Modèles de numérotation des commandes

View File

@ -22,30 +22,23 @@ AskPriceSupplierRefFournNotice=Avant de clôturer à "Acceptée", pensez à sais
RelatedAskPriceSupplier=Demandes de prix fournisseurs associées RelatedAskPriceSupplier=Demandes de prix fournisseurs associées
ConfirmValidateAsk=Êtes-vous sûr de vouloir valider cette demande de prix sous la référence <b>%s</b> ? ConfirmValidateAsk=Êtes-vous sûr de vouloir valider cette demande de prix sous la référence <b>%s</b> ?
DateAsk=Date de demande DateAsk=Date de demande
DateEndAsk=Date de fin de validité
DateEndAskShort=Date de fin
DeleteAsk=Supprimer demande DeleteAsk=Supprimer demande
ValidateAsk=Valider demande ValidateAsk=Valider demande
AddAsk=Créer une demande AddAsk=Créer une demande
AskpricesupplierDraft=Brouillons AskpricesupplierDraft=Brouillons
AskpricesupplierOpened=Ouvertes AskpricesupplierOpened=Ouvertes
AskpricesupplierNotBilled=Non facturées
AskpricesupplierStatusDraft=Brouillon (à valider) AskpricesupplierStatusDraft=Brouillon (à valider)
AskpricesupplierStatusValidated=Validée (demande ouverte) AskpricesupplierStatusValidated=Validée (demande ouverte)
AskpricesupplierStatusOpened=Validée (demande ouverte) AskpricesupplierStatusOpened=Validée (demande ouverte)
AskpricesupplierStatusClosed=Fermée AskpricesupplierStatusClosed=Fermée
AskpricesupplierStatusSigned=Acceptée AskpricesupplierStatusSigned=Acceptée
AskpricesupplierStatusNotSigned=Refusée AskpricesupplierStatusNotSigned=Refusée
AskpricesupplierStatusBilled=Facturée
AskpricesupplierStatusDraftShort=Brouillon AskpricesupplierStatusDraftShort=Brouillon
AskpricesupplierStatusValidatedShort=Validée AskpricesupplierStatusValidatedShort=Validée
AskpricesupplierStatusOpenedShort=Ouverte AskpricesupplierStatusOpenedShort=Ouverte
AskpricesupplierStatusClosedShort=Fermée AskpricesupplierStatusClosedShort=Fermée
AskpricesupplierStatusSignedShort=Acceptée AskpricesupplierStatusSignedShort=Acceptée
AskpricesupplierStatusNotSignedShort=Refusé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 CopyAskFrom=Créer demande/devis par recopie d'une demande existante
CreateEmptyAsk=Créer demande/devis vierge CreateEmptyAsk=Créer demande/devis vierge
CloneAsk=Cloner demande de prix CloneAsk=Cloner demande de prix
@ -55,15 +48,9 @@ SendAskByMail=Envoyer demande de prix par email
SendAskRef=Envoi de la demande de prix %s SendAskRef=Envoi de la demande de prix %s
AskPriceSupplierCard=Fiche demande AskPriceSupplierCard=Fiche demande
ConfirmDeleteAsk=Êtes-vous sûr de vouloir effacer cette demande de prix <b>%s</b> ? ConfirmDeleteAsk=Êtes-vous sûr de vouloir effacer cette demande de prix <b>%s</b> ?
ListOfAskPriceSupplier=Liste des devis/propositions commerciales
ActionsOnAskPriceSupplier=Événements sur la demande ActionsOnAskPriceSupplier=Événements sur la demande
DocModelAuroreDescription=Modèle de demande de prix fournisseur complet (logo…) DocModelAuroreDescription=Modèle de demande de prix fournisseur complet (logo…)
CommercialAsk=Demande de prix CommercialAsk=Demande de prix
DefaultModelAskPriceSupplierCreate=Modèle par défaut à la création 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) 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 proposition commerciale (non facturée) DefaultModelAskPriceSupplierClosed=Modèle par défaut lors de la clôture d'une demande de prix (refusée)
DefaultAskDurationValidity=Délai de validité par défaut (en jours)
##### Types de contacts #####
TypeContact_askpricesupplier_external_CUSTOMER=Contact client suivi demande

View File

@ -60,7 +60,7 @@ PredefinedMailTestHtml=Ceci est un message de <b>test</b> (le mot test doit êtr
PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__ 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__ 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__ 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__ 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__ 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__ PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__