Merge pull request #5603 from atm-florian/4.0_FIX_Multicurrency_with_french_number_setting
FIX : MULTICURRENCY if value is 1,56 then GETPOST 'int' check return ''
This commit is contained in:
commit
adc0a73e93
@ -279,7 +279,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($socid < 1) {
|
if ($socid < 1) {
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
|
||||||
|
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$object->origin = GETPOST('origin');
|
$object->origin = GETPOST('origin');
|
||||||
$object->origin_id = GETPOST('originid');
|
$object->origin_id = GETPOST('originid');
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
@ -718,7 +718,7 @@ if (empty($reshook))
|
|||||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||||
if (empty($tva_tx)) $tva_npr=0;
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
|
|
||||||
$pu_ht = $prod->price;
|
$pu_ht = $prod->price;
|
||||||
$pu_ttc = $prod->price_ttc;
|
$pu_ttc = $prod->price_ttc;
|
||||||
$price_min = $prod->price_min;
|
$price_min = $prod->price_min;
|
||||||
@ -932,7 +932,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Add buying price
|
// Add buying price
|
||||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||||
|
|
||||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||||
@ -1082,7 +1082,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
else if ($action == 'setmulticurrencyrate' && $user->rights->propal->creer) {
|
else if ($action == 'setmulticurrencyrate' && $user->rights->propal->creer) {
|
||||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
@ -1167,12 +1167,12 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
$upload_dir = $conf->propal->dir_output;
|
$upload_dir = $conf->propal->dir_output;
|
||||||
$permissioncreate=$user->rights->propal->creer;
|
$permissioncreate=$user->rights->propal->creer;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1432,11 +1432,11 @@ if ($action == 'create')
|
|||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||||
@ -1934,7 +1934,7 @@ if ($action == 'create')
|
|||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td width="25%">';
|
print '<td width="25%">';
|
||||||
@ -2053,7 +2053,7 @@ if ($action == 'create')
|
|||||||
print '<td class="nowrap" colspan="2">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||||
|
|
||||||
// Margin Infos
|
// Margin Infos
|
||||||
if (! empty($conf->margin->enabled))
|
if (! empty($conf->margin->enabled))
|
||||||
{
|
{
|
||||||
$rowspan=4;
|
$rowspan=4;
|
||||||
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++;
|
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++;
|
||||||
@ -2087,25 +2087,25 @@ if ($action == 'create')
|
|||||||
print '<tr><td height="10">' . $langs->trans('AmountTTC') . '</td>';
|
print '<tr><td height="10">' . $langs->trans('AmountTTC') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
// Multicurrency Amount HT
|
// Multicurrency Amount HT
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
|
print '<tr><td height="10">' . $langs->trans('Status') . '</td><td align="left" colspan="2">' . $object->getLibStatut(4) . '</td></tr>';
|
||||||
|
|
||||||
@ -2397,7 +2397,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id);
|
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id);
|
||||||
}
|
}
|
||||||
$formmail->withfrom = 1;
|
$formmail->withfrom = 1;
|
||||||
$liste = array();
|
$liste = array();
|
||||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||||
|
|||||||
@ -262,14 +262,14 @@ if (empty($reshook))
|
|||||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
if (! empty($origin) && ! empty($originid))
|
if (! empty($origin) && ! empty($originid))
|
||||||
{
|
{
|
||||||
@ -388,7 +388,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
|
||||||
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
|
||||||
|
|
||||||
$resqlcontact = $db->query($sqlcontact);
|
$resqlcontact = $db->query($sqlcontact);
|
||||||
if ($resqlcontact)
|
if ($resqlcontact)
|
||||||
{
|
{
|
||||||
@ -400,14 +400,14 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else dol_print_error($resqlcontact);
|
else dol_print_error($resqlcontact);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
$parameters = array('objFrom' => $srcobject);
|
$parameters = array('objFrom' => $srcobject);
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
// modified by hook
|
// modified by hook
|
||||||
if ($reshook < 0)
|
if ($reshook < 0)
|
||||||
$error++;
|
$error++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -475,12 +475,12 @@ if (empty($reshook))
|
|||||||
else if ($action == 'classifyunbilled' && $user->rights->commande->creer)
|
else if ($action == 'classifyunbilled' && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$ret=$object->classifyUnBilled();
|
$ret=$object->classifyUnBilled();
|
||||||
|
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Positionne ref commande client
|
// Positionne ref commande client
|
||||||
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
|
||||||
$object->set_ref_client($user, GETPOST('ref_client'));
|
$object->set_ref_client($user, GETPOST('ref_client'));
|
||||||
@ -525,7 +525,7 @@ if (empty($reshook))
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency Code
|
// Multicurrency Code
|
||||||
else if ($action == 'setmulticurrencycode' && $user->rights->commande->creer) {
|
else if ($action == 'setmulticurrencycode' && $user->rights->commande->creer) {
|
||||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||||
@ -533,9 +533,9 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
else if ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) {
|
else if ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) {
|
||||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
else if ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||||
$result = $object->availability(GETPOST('availability_id'));
|
$result = $object->availability(GETPOST('availability_id'));
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -1334,7 +1334,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$remise_absolue = 0;
|
$remise_absolue = 0;
|
||||||
|
|
||||||
$currency_code = $conf->currency;
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
if (! empty($origin) && ! empty($originid)) {
|
if (! empty($origin) && ! empty($originid)) {
|
||||||
// Parse element/subelement (ex: project_task)
|
// Parse element/subelement (ex: project_task)
|
||||||
$element = $subelement = $origin;
|
$element = $subelement = $origin;
|
||||||
@ -1405,7 +1405,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
$note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null));
|
$note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null));
|
||||||
@ -1428,7 +1428,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$remise_absolue = 0;
|
$remise_absolue = 0;
|
||||||
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
|
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
|
||||||
$projectid = 0;
|
$projectid = 0;
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
|
|
||||||
$note_private = $object->getDefaultCreateValueFor('note_private');
|
$note_private = $object->getDefaultCreateValueFor('note_private');
|
||||||
@ -1696,12 +1696,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1747,7 +1747,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
// Show origin lines
|
// Show origin lines
|
||||||
@ -2018,7 +2018,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Relative and absolute discounts
|
// Relative and absolute discounts
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
|
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
|
||||||
@ -2203,7 +2203,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td width="25%">';
|
print '<td width="25%">';
|
||||||
@ -2269,8 +2269,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print ' / ';
|
print ' / ';
|
||||||
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
@ -2385,16 +2385,16 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
|
|||||||
@ -141,7 +141,7 @@ if (empty($reshook))
|
|||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
|
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||||
// if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
// if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
|
||||||
@ -290,9 +290,9 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
||||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -320,7 +320,7 @@ if (empty($reshook))
|
|||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
if ($result < 0) dol_print_error($db, $object->error);
|
if ($result < 0) dol_print_error($db, $object->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -713,7 +713,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
// This is a replacement invoice
|
// This is a replacement invoice
|
||||||
$result = $object->fetch($_POST['fac_replacement']);
|
$result = $object->fetch($_POST['fac_replacement']);
|
||||||
@ -766,7 +766,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->socid = GETPOST('socid','int');
|
$object->socid = GETPOST('socid','int');
|
||||||
@ -788,7 +788,7 @@ if (empty($reshook))
|
|||||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||||
|
|
||||||
// Proprietes particulieres a facture avoir
|
// Proprietes particulieres a facture avoir
|
||||||
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
|
||||||
$object->type = Facture::TYPE_CREDIT_NOTE;
|
$object->type = Facture::TYPE_CREDIT_NOTE;
|
||||||
@ -875,7 +875,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->socid = GETPOST('socid','int');
|
$object->socid = GETPOST('socid','int');
|
||||||
@ -899,7 +899,7 @@ if (empty($reshook))
|
|||||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||||
|
|
||||||
// Source facture
|
// Source facture
|
||||||
$object->fac_rec = GETPOST('fac_rec');
|
$object->fac_rec = GETPOST('fac_rec');
|
||||||
|
|
||||||
@ -924,7 +924,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Si facture standard
|
// Si facture standard
|
||||||
@ -1206,9 +1206,9 @@ if (empty($reshook))
|
|||||||
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
|
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dol_print_error($resqlcontact);
|
else dol_print_error($resqlcontact);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
$parameters = array('objFrom' => $srcobject);
|
$parameters = array('objFrom' => $srcobject);
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
@ -1218,7 +1218,7 @@ if (empty($reshook))
|
|||||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -1250,7 +1250,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||||
|
|
||||||
if (!($_POST['situations'] > 0)) {
|
if (!($_POST['situations'] > 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
$mesg = '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '</div>';
|
||||||
@ -1265,8 +1265,8 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->origin = $origin;
|
$object->origin = $origin;
|
||||||
$object->origin_id = $originid;
|
$object->origin_id = $originid;
|
||||||
|
|
||||||
foreach ($object->lines as &$line)
|
foreach ($object->lines as &$line)
|
||||||
{
|
{
|
||||||
$line->origin = $object->origin;
|
$line->origin = $object->origin;
|
||||||
$line->origin_id = $line->id;
|
$line->origin_id = $line->id;
|
||||||
@ -1612,7 +1612,7 @@ if (empty($reshook))
|
|||||||
$pu_ht = GETPOST('price_ht');
|
$pu_ht = GETPOST('price_ht');
|
||||||
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||||
$qty = GETPOST('qty');
|
$qty = GETPOST('qty');
|
||||||
|
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
$info_bits = 0;
|
$info_bits = 0;
|
||||||
if (preg_match('/\*/', $vat_rate))
|
if (preg_match('/\*/', $vat_rate))
|
||||||
@ -1797,7 +1797,7 @@ if (empty($reshook))
|
|||||||
$upload_dir = $conf->facture->dir_output;
|
$upload_dir = $conf->facture->dir_output;
|
||||||
$permissioncreate=$user->rights->facture->creer;
|
$permissioncreate=$user->rights->facture->creer;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'update_extras') {
|
if ($action == 'update_extras') {
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
@ -1904,7 +1904,7 @@ if ($action == 'create')
|
|||||||
$res = $soc->fetch($socid);
|
$res = $soc->fetch($socid);
|
||||||
|
|
||||||
$currency_code = $conf->currency;
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
// Load objectsrc
|
// Load objectsrc
|
||||||
$remise_absolue = 0;
|
$remise_absolue = 0;
|
||||||
|
|
||||||
@ -1976,9 +1976,9 @@ if ($action == 'create')
|
|||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replicate extrafields
|
// Replicate extrafields
|
||||||
$objectsrc->fetch_optionals($originid);
|
$objectsrc->fetch_optionals($originid);
|
||||||
$object->array_options = $objectsrc->array_options;
|
$object->array_options = $objectsrc->array_options;
|
||||||
@ -1992,7 +1992,7 @@ if ($action == 'create')
|
|||||||
$remise_percent = $soc->remise_percent;
|
$remise_percent = $soc->remise_percent;
|
||||||
$remise_absolue = 0;
|
$remise_absolue = 0;
|
||||||
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); // Do not set 0 here (0 for a date is 1970)
|
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); // Do not set 0 here (0 for a date is 1970)
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2018,7 +2018,7 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
print info_admin($text, 0, 0, 0).'<br>';
|
print info_admin($text, 0, 0, 0).'<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
@ -2029,7 +2029,7 @@ if ($action == 'create')
|
|||||||
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
||||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||||
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@ -2083,7 +2083,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$invoice_predefined = new FactureRec($db);
|
$invoice_predefined = new FactureRec($db);
|
||||||
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
|
$invoice_predefined->fetch(GETPOST('fac_rec','int'));
|
||||||
|
|
||||||
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
$dateinvoice = $invoice_predefined->date_when; // To use next gen date by default later
|
||||||
|
|
||||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||||
@ -2349,7 +2349,7 @@ if ($action == 'create')
|
|||||||
$desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3);
|
$desc = $form->textwithpicto($text, $langs->transnoentities("YouMustCreateStandardInvoiceFirstDesc"), 1, 'help', '', 0, 3);
|
||||||
print $desc;
|
print $desc;
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -2388,7 +2388,7 @@ if ($action == 'create')
|
|||||||
print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1);
|
print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Payment term
|
// Payment term
|
||||||
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td colspan="2">';
|
||||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||||
@ -2453,7 +2453,7 @@ if ($action == 'create')
|
|||||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public note
|
// Public note
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
print '<td class="border" valign="top">' . $langs->trans('NotePublic') . '</td>';
|
||||||
@ -2536,12 +2536,12 @@ if ($action == 'create')
|
|||||||
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
|
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
|
||||||
}
|
}
|
||||||
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3153,13 +3153,13 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$nbrows ++;
|
$nbrows ++;
|
||||||
if (! empty($conf->multicurrency->enabled)) $nbrows+=5;
|
if (! empty($conf->multicurrency->enabled)) $nbrows+=5;
|
||||||
if (! empty($conf->incoterm->enabled)) $nbrows+=1;
|
if (! empty($conf->incoterm->enabled)) $nbrows+=1;
|
||||||
|
|
||||||
print '<td rowspan="' . $nbrows . '" colspan="2" valign="top">';
|
print '<td rowspan="' . $nbrows . '" colspan="2" valign="top">';
|
||||||
|
|
||||||
if ($object->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
|
if ($object->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION))
|
||||||
{
|
{
|
||||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '<table class="nobordernopadding paymenttable" width="100%">';
|
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '<table class="nobordernopadding paymenttable" width="100%">';
|
||||||
|
|
||||||
if (count($object->tab_previous_situation_invoice) > 0)
|
if (count($object->tab_previous_situation_invoice) > 0)
|
||||||
{
|
{
|
||||||
//List of previous invoices
|
//List of previous invoices
|
||||||
@ -3172,7 +3172,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||||
print '<td width="18"> </td>';
|
print '<td width="18"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$total_prev_ht = $total_prev_ttc = 0;
|
$total_prev_ht = $total_prev_ttc = 0;
|
||||||
$var = true;
|
$var = true;
|
||||||
foreach ($object->tab_previous_situation_invoice as $prev_invoice)
|
foreach ($object->tab_previous_situation_invoice as $prev_invoice)
|
||||||
@ -3189,10 +3189,10 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
|
print '<td align="right">' . price($prev_invoice->total_ttc) . '</td>';
|
||||||
print '<td align="right">'.$prev_invoice->getLibStatut(3, $totalpaye).'</td>';
|
print '<td align="right">'.$prev_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr '.$bc [$var].'>';
|
print '<tr '.$bc [$var].'>';
|
||||||
print '<td colspan="2" align="right"></td>';
|
print '<td colspan="2" align="right"></td>';
|
||||||
print '<td align="right"><b>' . price($total_prev_ht) . '</b></td>';
|
print '<td align="right"><b>' . price($total_prev_ht) . '</b></td>';
|
||||||
@ -3200,7 +3200,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td width="18"> </td>';
|
print '<td width="18"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($object->tab_next_situation_invoice) > 0)
|
if (count($object->tab_next_situation_invoice) > 0)
|
||||||
{
|
{
|
||||||
//List of next invoices
|
//List of next invoices
|
||||||
@ -3213,9 +3213,9 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
|
||||||
print '<td width="18"> </td>';
|
print '<td width="18"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$total_next_ht = $total_next_ttc = 0;
|
$total_next_ht = $total_next_ttc = 0;
|
||||||
|
|
||||||
$var = true;
|
$var = true;
|
||||||
foreach ($object->tab_next_situation_invoice as $next_invoice)
|
foreach ($object->tab_next_situation_invoice as $next_invoice)
|
||||||
{
|
{
|
||||||
@ -3231,10 +3231,10 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
|
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
|
||||||
print '<td align="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
|
print '<td align="right">'.$next_invoice->getLibStatut(3, $totalpaye).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr '.$bc [$var].'>';
|
print '<tr '.$bc [$var].'>';
|
||||||
print '<td colspan="2" align="right"></td>';
|
print '<td colspan="2" align="right"></td>';
|
||||||
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
|
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
|
||||||
@ -3242,7 +3242,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<td width="18"> </td>';
|
print '<td width="18"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '</table>';
|
if (count($object->tab_previous_situation_invoice) > 0 || count($object->tab_next_situation_invoice) > 0) print '</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3469,7 +3469,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print dol_print_date($object->date_pointoftax, 'daytext');
|
print dol_print_date($object->date_pointoftax, 'daytext');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Conditions de reglement
|
// Conditions de reglement
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
@ -3554,7 +3554,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -3695,16 +3695,16 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
@ -4003,7 +4003,7 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Classify 'closed not completely paid' (possible si validee et pas encore classee payee)
|
// Classify 'closed not completely paid' (possible si validee et pas encore classee payee)
|
||||||
|
|
||||||
if ($object->statut == 1 && $object->paye == 0 && $resteapayer > 0 && $user->rights->facture->paiement)
|
if ($object->statut == 1 && $object->paye == 0 && $resteapayer > 0 && $user->rights->facture->paiement)
|
||||||
{
|
{
|
||||||
if ($totalpaye > 0 || $totalcreditnotes > 0)
|
if ($totalpaye > 0 || $totalcreditnotes > 0)
|
||||||
@ -4015,11 +4015,11 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
{
|
{
|
||||||
if ( empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED))
|
if ( empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED))
|
||||||
{
|
{
|
||||||
if ($objectidnext)
|
if ($objectidnext)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ClassifyCanceled') . '</span></div>';
|
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ClassifyCanceled') . '</span></div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=canceled">' . $langs->trans('ClassifyCanceled') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=canceled">' . $langs->trans('ClassifyCanceled') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -165,7 +165,7 @@ if (empty($reshook))
|
|||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency Code
|
// Multicurrency Code
|
||||||
else if ($action == 'setmulticurrencycode' && $user->rights->fournisseur->commande->creer) {
|
else if ($action == 'setmulticurrencycode' && $user->rights->fournisseur->commande->creer) {
|
||||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||||
@ -173,7 +173,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
else if ($action == 'setmulticurrencyrate' && $user->rights->fournisseur->commande->creer) {
|
else if ($action == 'setmulticurrencyrate' && $user->rights->fournisseur->commande->creer) {
|
||||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
@ -218,13 +218,13 @@ if (empty($reshook))
|
|||||||
//$newstatus=3; // Submited
|
//$newstatus=3; // Submited
|
||||||
// TODO If there is at least one reception, we can set to Received->Received partially
|
// TODO If there is at least one reception, we can set to Received->Received partially
|
||||||
$newstatus=4; // Received partially
|
$newstatus=4; // Received partially
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ($object->statut == 6) $newstatus=2; // Canceled->Approved
|
else if ($object->statut == 6) $newstatus=2; // Canceled->Approved
|
||||||
else if ($object->statut == 7) $newstatus=3; // Canceled->Process running
|
else if ($object->statut == 7) $newstatus=3; // Canceled->Process running
|
||||||
else if ($object->statut == 9) $newstatus=1; // Refused->Validated
|
else if ($object->statut == 9) $newstatus=1; // Refused->Validated
|
||||||
else $newstatus = 2;
|
else $newstatus = 2;
|
||||||
|
|
||||||
//print "old status = ".$object->statut.' new status = '.$newstatus;
|
//print "old status = ".$object->statut.' new status = '.$newstatus;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ if (empty($reshook))
|
|||||||
$sql.= ' WHERE rowid = '.$object->id;
|
$sql.= ' WHERE rowid = '.$object->id;
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|
||||||
if ($newstatus == 0)
|
if ($newstatus == 0)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur';
|
||||||
@ -351,7 +351,7 @@ if (empty($reshook))
|
|||||||
$idprod=0;
|
$idprod=0;
|
||||||
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('idprodfournprice') > 0)
|
if (GETPOST('idprodfournprice') > 0)
|
||||||
{
|
{
|
||||||
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat.
|
$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat.
|
||||||
@ -367,7 +367,7 @@ if (empty($reshook))
|
|||||||
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
|
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc);
|
||||||
|
|
||||||
$type = $productsupplier->type;
|
$type = $productsupplier->type;
|
||||||
|
|
||||||
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
$tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
||||||
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
$tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice'));
|
||||||
if (empty($tva_tx)) $tva_npr=0;
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
@ -763,7 +763,7 @@ if (empty($reshook))
|
|||||||
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
|
$result = $object->commande($user, $_REQUEST["datecommande"], $_REQUEST["methode"], $_REQUEST['comment']);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
{
|
{
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
@ -870,10 +870,10 @@ if (empty($reshook))
|
|||||||
if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post
|
if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post
|
||||||
{
|
{
|
||||||
// Build document
|
// Build document
|
||||||
|
|
||||||
// Save last template used to generate document
|
// Save last template used to generate document
|
||||||
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
|
||||||
|
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
if (GETPOST('lang_id'))
|
if (GETPOST('lang_id'))
|
||||||
{
|
{
|
||||||
@ -899,7 +899,7 @@ if (empty($reshook))
|
|||||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'update_extras')
|
if ($action == 'update_extras')
|
||||||
{
|
{
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
@ -972,7 +972,7 @@ if (empty($reshook))
|
|||||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||||
$object->fk_project = GETPOST('projectid');
|
$object->fk_project = GETPOST('projectid');
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -994,7 +994,7 @@ if (empty($reshook))
|
|||||||
$element = 'supplier_proposal';
|
$element = 'supplier_proposal';
|
||||||
$subelement = 'supplier_proposal';
|
$subelement = 'supplier_proposal';
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->origin = $origin;
|
$object->origin = $origin;
|
||||||
$object->origin_id = $originid;
|
$object->origin_id = $originid;
|
||||||
|
|
||||||
@ -1031,7 +1031,7 @@ if (empty($reshook))
|
|||||||
$num = count($lines);
|
$num = count($lines);
|
||||||
|
|
||||||
$productsupplier = new ProductFournisseur($db);
|
$productsupplier = new ProductFournisseur($db);
|
||||||
|
|
||||||
for($i = 0; $i < $num; $i ++)
|
for($i = 0; $i < $num; $i ++)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1041,12 +1041,12 @@ if (empty($reshook))
|
|||||||
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
|
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
|
||||||
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle);
|
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle);
|
||||||
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
|
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if
|
||||||
// trigger used
|
// trigger used
|
||||||
@ -1056,17 +1056,17 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty);
|
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty);
|
||||||
if ($result>=0)
|
if ($result>=0)
|
||||||
{
|
{
|
||||||
$tva_tx = $lines[$i]->tva_tx;
|
$tva_tx = $lines[$i]->tva_tx;
|
||||||
|
|
||||||
if ($origin=="commande")
|
if ($origin=="commande")
|
||||||
{
|
{
|
||||||
$soc=new societe($db);
|
$soc=new societe($db);
|
||||||
$soc->fetch($socid);
|
$soc->fetch($socid);
|
||||||
$tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id);
|
$tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->addline(
|
$result = $object->addline(
|
||||||
$desc,
|
$desc,
|
||||||
$lines[$i]->subprice,
|
$lines[$i]->subprice,
|
||||||
@ -1089,7 +1089,7 @@ if (empty($reshook))
|
|||||||
$lines[$i]->fk_unit
|
$lines[$i]->fk_unit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
@ -1102,8 +1102,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add link between elements
|
// Add link between elements
|
||||||
|
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
$parameters = array('objFrom' => $srcobject);
|
$parameters = array('objFrom' => $srcobject);
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
@ -1149,14 +1149,14 @@ if (empty($reshook))
|
|||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$actiontypecode='AC_SUP_ORD';
|
$actiontypecode='AC_SUP_ORD';
|
||||||
$trigger_name='ORDER_SUPPLIER_SENTBYMAIL';
|
$trigger_name='ORDER_SUPPLIER_SENTBYMAIL';
|
||||||
$paramname='id';
|
$paramname='id';
|
||||||
$mode='emailfromsupplierorder';
|
$mode='emailfromsupplierorder';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel'))
|
if ($action == 'webservice' && GETPOST('mode', 'alpha') == "send" && ! GETPOST('cancel'))
|
||||||
{
|
{
|
||||||
@ -1380,9 +1380,9 @@ if ($action=='create')
|
|||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
$note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null));
|
$note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null));
|
||||||
$note_public = $object->getDefaultCreateValueFor('note_public', (! empty($objectsrc->note_public) ? $objectsrc->note_public : null));
|
$note_public = $object->getDefaultCreateValueFor('note_public', (! empty($objectsrc->note_public) ? $objectsrc->note_public : null));
|
||||||
|
|
||||||
@ -1394,9 +1394,9 @@ if ($action=='create')
|
|||||||
{
|
{
|
||||||
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
||||||
$mode_reglement_id = $societe->mode_reglement_supplier_id;
|
$mode_reglement_id = $societe->mode_reglement_supplier_id;
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
|
|
||||||
$note_private = $object->getDefaultCreateValueFor('note_private');
|
$note_private = $object->getDefaultCreateValueFor('note_private');
|
||||||
$note_public = $object->getDefaultCreateValueFor('note_public');
|
$note_public = $object->getDefaultCreateValueFor('note_public');
|
||||||
}
|
}
|
||||||
@ -1409,7 +1409,7 @@ if ($action=='create')
|
|||||||
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
||||||
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||||
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
||||||
|
|
||||||
dol_fiche_head('');
|
dol_fiche_head('');
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@ -1497,7 +1497,7 @@ if ($action=='create')
|
|||||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
$doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||||
@ -1539,12 +1539,12 @@ if ($action=='create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1571,7 +1571,7 @@ if ($action=='create')
|
|||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|
||||||
// Show origin lines
|
// Show origin lines
|
||||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
if (! empty($origin) && ! empty($originid) && is_object($objectsrc))
|
||||||
{
|
{
|
||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
@ -1631,7 +1631,7 @@ elseif (! empty($object->id))
|
|||||||
$object->date_commande=dol_now();
|
$object->date_commande=dol_now();
|
||||||
|
|
||||||
// We check if number is temporary number
|
// We check if number is temporary number
|
||||||
if (preg_match('/^[\(]?PROV/i',$object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life
|
if (preg_match('/^[\(]?PROV/i',$object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life
|
||||||
{
|
{
|
||||||
$newref = $object->getNextNumRef($object->thirdparty);
|
$newref = $object->getNextNumRef($object->thirdparty);
|
||||||
}
|
}
|
||||||
@ -1841,7 +1841,7 @@ elseif (! empty($object->id))
|
|||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
|
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
if (! empty($conf->multicurrency->enabled))
|
if (! empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
@ -1861,7 +1861,7 @@ elseif (! empty($object->id))
|
|||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td width="25%">';
|
print '<td width="25%">';
|
||||||
@ -2021,16 +2021,16 @@ elseif (! empty($object->id))
|
|||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table><br>";
|
print "</table><br>";
|
||||||
@ -2339,7 +2339,7 @@ elseif (! empty($object->id))
|
|||||||
{
|
{
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sor'.$object->id);
|
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sor'.$object->id);
|
||||||
}
|
}
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
$liste=array();
|
$liste=array();
|
||||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||||
@ -2615,7 +2615,7 @@ elseif (! empty($object->id))
|
|||||||
/**
|
/**
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete')
|
if ($user->societe_id == 0 && $action != 'editline' && $action != 'delete')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
@ -2625,7 +2625,7 @@ elseif (! empty($object->id))
|
|||||||
// modified by hook
|
// modified by hook
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == 0 && $num > 0)
|
if ($object->statut == 0 && $num > 0)
|
||||||
{
|
{
|
||||||
@ -2771,7 +2771,7 @@ elseif (! empty($object->id))
|
|||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier']))
|
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier']))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||||
@ -2808,7 +2808,7 @@ elseif (! empty($object->id))
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2833,7 +2833,7 @@ elseif (! empty($object->id))
|
|||||||
|
|
||||||
// Linked object block
|
// Linked object block
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||||
|
|||||||
@ -118,7 +118,7 @@ if (empty($reshook))
|
|||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
$result = $object->add_object_linked('order_supplier', GETPOST('linkedOrder'));
|
$result = $object->add_object_linked('order_supplier', GETPOST('linkedOrder'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
@ -248,7 +248,7 @@ if (empty($reshook))
|
|||||||
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
|
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
|
||||||
{
|
{
|
||||||
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
|
$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
|
||||||
|
|
||||||
if ($object->update($user) < 0) {
|
if ($object->update($user) < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency Code
|
// Multicurrency Code
|
||||||
else if ($action == 'setmulticurrencycode' && $user->rights->facture->creer) {
|
else if ($action == 'setmulticurrencycode' && $user->rights->facture->creer) {
|
||||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||||
@ -273,7 +273,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
|
||||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// bank account
|
// bank account
|
||||||
@ -485,7 +485,7 @@ if (empty($reshook))
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now reload line
|
// Now reload line
|
||||||
$object->fetch_lines();
|
$object->fetch_lines();
|
||||||
}
|
}
|
||||||
@ -506,7 +506,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// If some invoice's lines already known
|
// If some invoice's lines already known
|
||||||
@ -544,7 +544,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='create';
|
$action='create';
|
||||||
$_GET['socid']=$_POST['socid'];
|
$_GET['socid']=$_POST['socid'];
|
||||||
@ -938,14 +938,14 @@ if (empty($reshook))
|
|||||||
/*
|
/*
|
||||||
* Send mail
|
* Send mail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$actiontypecode='AC_SUP_INV';
|
$actiontypecode='AC_SUP_INV';
|
||||||
$trigger_name='BILL_SUPPLIER_SENTBYMAIL';
|
$trigger_name='BILL_SUPPLIER_SENTBYMAIL';
|
||||||
$paramname='id';
|
$paramname='id';
|
||||||
$mode='emailfromsupplierinvoice';
|
$mode='emailfromsupplierinvoice';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
|
|
||||||
// Build document
|
// Build document
|
||||||
if ($action == 'builddoc')
|
if ($action == 'builddoc')
|
||||||
@ -1125,7 +1125,7 @@ if ($action == 'create')
|
|||||||
dol_htmloutput_events();
|
dol_htmloutput_events();
|
||||||
|
|
||||||
$currency_code = $conf->currency;
|
$currency_code = $conf->currency;
|
||||||
|
|
||||||
$societe='';
|
$societe='';
|
||||||
if (GETPOST('socid') > 0)
|
if (GETPOST('socid') > 0)
|
||||||
{
|
{
|
||||||
@ -1133,7 +1133,7 @@ if ($action == 'create')
|
|||||||
$societe->fetch(GETPOST('socid','int'));
|
$societe->fetch(GETPOST('socid','int'));
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) $currency_code = $societe->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('origin') && GETPOST('originid'))
|
if (GETPOST('origin') && GETPOST('originid'))
|
||||||
{
|
{
|
||||||
// Parse element/subelement (ex: project_task)
|
// Parse element/subelement (ex: project_task)
|
||||||
@ -1181,9 +1181,9 @@ if ($action == 'create')
|
|||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
|
||||||
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
|
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
|
||||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
||||||
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
||||||
@ -1199,7 +1199,7 @@ if ($action == 'create')
|
|||||||
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$datetmp);
|
||||||
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
|
||||||
$datedue=($datetmp==''?-1:$datetmp);
|
$datedue=($datetmp==''?-1:$datetmp);
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,9 +1210,9 @@ if ($action == 'create')
|
|||||||
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';
|
||||||
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
|
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
|
||||||
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
if (!empty($currency_tx)) print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -1444,12 +1444,12 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
|
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled))
|
if (!empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
|
||||||
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1721,7 +1721,7 @@ else
|
|||||||
if (! empty($conf->projet->enabled)) $nbrows++;
|
if (! empty($conf->projet->enabled)) $nbrows++;
|
||||||
if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; }
|
if (! empty($conf->banque->enabled)) { $nbrows++; $nbcols++; }
|
||||||
if (! empty($conf->incoterm->enabled)) $nbrows++;
|
if (! empty($conf->incoterm->enabled)) $nbrows++;
|
||||||
|
|
||||||
// Local taxes
|
// Local taxes
|
||||||
if ($societe->localtax1_assuj=="1") $nbrows++;
|
if ($societe->localtax1_assuj=="1") $nbrows++;
|
||||||
if ($societe->localtax2_assuj=="1") $nbrows++;
|
if ($societe->localtax2_assuj=="1") $nbrows++;
|
||||||
@ -1896,7 +1896,7 @@ else
|
|||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1972,16 +1972,16 @@ else
|
|||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="2">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
@ -2082,7 +2082,7 @@ else
|
|||||||
|
|
||||||
global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax;
|
global $forceall, $senderissupplier, $dateSelector, $inputalsopricewithtax;
|
||||||
$forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1;
|
$forceall=1; $senderissupplier=1; $dateSelector=0; $inputalsopricewithtax=1;
|
||||||
|
|
||||||
// Show object lines
|
// Show object lines
|
||||||
if (! empty($object->lines))
|
if (! empty($object->lines))
|
||||||
$ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1);
|
$ret = $object->printObjectLines($action, $societe, $mysoc, $lineid, 1);
|
||||||
@ -2123,15 +2123,15 @@ else
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
// modified by hook
|
// modified by hook
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Modify a validated invoice with no payments
|
// Modify a validated invoice with no payments
|
||||||
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
|
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'edit' && $object->getSommePaiement() == 0 && $user->rights->fournisseur->facture->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reopen a standard paid invoice
|
// Reopen a standard paid invoice
|
||||||
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||||
{
|
{
|
||||||
@ -2144,7 +2144,7 @@ else
|
|||||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send by mail
|
// Send by mail
|
||||||
if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED))
|
if (($object->statut == FactureFournisseur::STATUS_VALIDATED || $object->statut == FactureFournisseur::STATUS_CLOSED))
|
||||||
{
|
{
|
||||||
@ -2154,23 +2154,23 @@ else
|
|||||||
}
|
}
|
||||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make payments
|
// Make payments
|
||||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&action=create'.($object->fk_account>0?'&accountid='.$object->fk_account:'').'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice
|
print '<a class="butAction" href="paiement.php?facid='.$object->id.'&action=create'.($object->fk_account>0?'&accountid='.$object->fk_account:'').'">'.$langs->trans('DoPayment').'</a>'; // must use facid because id is for payment id not invoice
|
||||||
}
|
}
|
||||||
|
|
||||||
// Classify paid
|
// Classify paid
|
||||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid"';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid"';
|
||||||
print '>'.$langs->trans('ClassifyPaid').'</a>';
|
print '>'.$langs->trans('ClassifyPaid').'</a>';
|
||||||
|
|
||||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
|
if ($action != 'edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
|
||||||
{
|
{
|
||||||
@ -2189,19 +2189,19 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create event
|
// 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.
|
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 '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
|
if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&socid='.$object->socid.'">'.$langs->trans('ToClone').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
|
if ($action != 'edit' && $user->rights->fournisseur->facture->supprimer)
|
||||||
{
|
{
|
||||||
@ -2213,17 +2213,17 @@ else
|
|||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if ($action != 'edit')
|
if ($action != 'edit')
|
||||||
{
|
{
|
||||||
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 '<table width="100%"><tr><td width="50%" valign="top">';
|
||||||
//print '<a name="builddoc"></a>'; // ancre
|
//print '<a name="builddoc"></a>'; // ancre
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents generes
|
* Documents generes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$ref=dol_sanitizeFileName($object->ref);
|
$ref=dol_sanitizeFileName($object->ref);
|
||||||
$subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
$subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||||
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
|
||||||
@ -2231,27 +2231,27 @@ else
|
|||||||
$genallowed=$user->rights->fournisseur->facture->creer;
|
$genallowed=$user->rights->fournisseur->facture->creer;
|
||||||
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
$delallowed=$user->rights->fournisseur->facture->supprimer;
|
||||||
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF));
|
$modelpdf=(! empty($object->modelpdf)?$object->modelpdf:(empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)?'':$conf->global->INVOICE_SUPPLIER_ADDON_PDF));
|
||||||
|
|
||||||
print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
|
print $formfile->showdocuments('facture_fournisseur',$subdir,$filedir,$urlsource,$genallowed,$delallowed,$modelpdf,1,0,0,40,0,'','','',$societe->default_lang);
|
||||||
$somethingshown=$formfile->numoffiles;
|
$somethingshown=$formfile->numoffiles;
|
||||||
|
|
||||||
// Linked object block
|
// Linked object block
|
||||||
$somethingshown = $form->showLinkedObjectBlock($object);
|
$somethingshown = $form->showLinkedObjectBlock($object);
|
||||||
|
|
||||||
// Show links to link elements
|
// Show links to link elements
|
||||||
$linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
|
$linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order'));
|
||||||
if ($linktoelem) print '<br>'.$linktoelem;
|
if ($linktoelem) print '<br>'.$linktoelem;
|
||||||
|
|
||||||
|
|
||||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
//print '</td><td valign="top" width="50%">';
|
//print '</td><td valign="top" width="50%">';
|
||||||
//print '<br>';
|
//print '<br>';
|
||||||
|
|
||||||
// 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,'invoice_supplier',$socid,0,'listaction'.($genallowed?'largetitle':''));
|
$somethingshown=$formactions->showactions($object,'invoice_supplier',$socid,0,'listaction'.($genallowed?'largetitle':''));
|
||||||
|
|
||||||
print '</div></div></div>';
|
print '</div></div></div>';
|
||||||
//print '</td></tr></table>';
|
//print '</td></tr></table>';
|
||||||
}
|
}
|
||||||
@ -2318,7 +2318,7 @@ else
|
|||||||
{
|
{
|
||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sin'.$object->id);
|
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sin'.$object->id);
|
||||||
}
|
}
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
$liste=array();
|
$liste=array();
|
||||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||||
|
|||||||
@ -109,13 +109,13 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
if ($cancel) $action='';
|
if ($cancel) $action='';
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||||
{
|
{
|
||||||
@ -130,8 +130,8 @@ if (empty($reshook))
|
|||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = '';
|
$action = '';
|
||||||
@ -581,7 +581,7 @@ if (empty($reshook))
|
|||||||
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
|
||||||
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
|
||||||
if (empty($tva_tx)) $tva_npr=0;
|
if (empty($tva_tx)) $tva_npr=0;
|
||||||
|
|
||||||
//On garde le prix indiqué dans l'input pour la demande de prix fournisseur
|
//On garde le prix indiqué dans l'input pour la demande de prix fournisseur
|
||||||
//$pu_ht = $prod->price;
|
//$pu_ht = $prod->price;
|
||||||
$pu_ht = price2num($price_ht, 'MU');
|
$pu_ht = price2num($price_ht, 'MU');
|
||||||
@ -776,7 +776,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Add buying price
|
// Add buying price
|
||||||
$fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
$fournprice = (GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||||
$buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
$buyingprice = (GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||||
|
|
||||||
// Extrafields
|
// Extrafields
|
||||||
$extrafieldsline = new ExtraFields($db);
|
$extrafieldsline = new ExtraFields($db);
|
||||||
@ -947,7 +947,7 @@ if (empty($reshook))
|
|||||||
else if ($action == 'setmode' && $user->rights->supplier_proposal->creer) {
|
else if ($action == 'setmode' && $user->rights->supplier_proposal->creer) {
|
||||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency Code
|
// Multicurrency Code
|
||||||
else if ($action == 'setmulticurrencycode' && $user->rights->supplier_proposal->creer) {
|
else if ($action == 'setmulticurrencycode' && $user->rights->supplier_proposal->creer) {
|
||||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||||
@ -955,7 +955,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
else if ($action == 'setmulticurrencyrate' && $user->rights->supplier_proposal->creer) {
|
else if ($action == 'setmulticurrencyrate' && $user->rights->supplier_proposal->creer) {
|
||||||
$result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
|
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'update_extras') {
|
else if ($action == 'update_extras') {
|
||||||
@ -1142,14 +1142,14 @@ if ($action == 'create')
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multicurrency
|
// Multicurrency
|
||||||
if (! empty($conf->multicurrency->enabled))
|
if (! empty($conf->multicurrency->enabled))
|
||||||
{
|
{
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
@ -1506,7 +1506,7 @@ if ($action == 'create')
|
|||||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Multicurrency rate
|
// Multicurrency rate
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1560,7 +1560,7 @@ if ($action == 'create')
|
|||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 2;
|
$cols = 2;
|
||||||
if (empty($conf->margin->enabled)) $cols++;
|
if (empty($conf->margin->enabled)) $cols++;
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||||
|
|
||||||
// Amount HT
|
// Amount HT
|
||||||
@ -1609,16 +1609,16 @@ if ($action == 'create')
|
|||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>';
|
||||||
print '<td class="nowrap" colspan="'.$colspan.'">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="'.$colspan.'">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount VAT
|
// Multicurrency Amount VAT
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>';
|
||||||
print '<td class="nowrap" colspan="'.$colspan.'">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="'.$colspan.'">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multicurrency Amount TTC
|
// Multicurrency Amount TTC
|
||||||
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
print '<tr><td height="10">' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>';
|
||||||
print '<td class="nowrap" colspan="'.$colspan.'">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
print '<td class="nowrap" colspan="'.$colspan.'">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
@ -1770,7 +1770,7 @@ if ($action == 'create')
|
|||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=close' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=close' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
|
||||||
print '>' . $langs->trans('Close') . '</a></div>';
|
print '>' . $langs->trans('Close') . '</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
if ($user->rights->supplier_proposal->creer) {
|
if ($user->rights->supplier_proposal->creer) {
|
||||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
||||||
@ -1884,7 +1884,7 @@ if ($action == 'create')
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'spr'.$object->id);
|
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'spr'.$object->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$formmail->withfrom = 1;
|
$formmail->withfrom = 1;
|
||||||
$liste = array();
|
$liste = array();
|
||||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user