Fix serious deadlock feature. It was possible to link with no way to
unlink. What if user make a bad click ? I complete feature with reverse action to be sure to not have users with a corrupted situation.
This commit is contained in:
parent
72e7558356
commit
5ca6593a57
@ -38,24 +38,26 @@ print_titre($langs->trans('RelatedAskPriceSupplier'));
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> ><td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowAskPriceSupplier"),"askpricesupplier").' '.$object->ref; ?></a></td>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowAskPriceSupplier"),"askpricesupplier").' '.$objectlink->ref; ?></a></td>
|
||||
<td></td>
|
||||
<td align="center"><?php echo dol_print_date($object->datec,'day'); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->datec,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->askpricesupplier->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -67,7 +69,8 @@ foreach($linkedObjectBlock as $object)
|
||||
if ($user->rights->askpricesupplier->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -103,6 +103,8 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$hookmanager->initHooks(array('propalcard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->propale->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->rights->propale->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -117,7 +119,11 @@ if (empty($reshook))
|
||||
{
|
||||
if ($cancel) $action = '';
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_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
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
@ -1133,47 +1139,7 @@ if (empty($reshook))
|
||||
$result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
}
|
||||
|
||||
/*
|
||||
* Ordonnancement des lignes
|
||||
*/
|
||||
|
||||
else if ($action == 'up' && $user->rights->propal->creer) {
|
||||
$object->line_up(GETPOST('rowid'));
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||
exit();
|
||||
}
|
||||
|
||||
else if ($action == 'down' && $user->rights->propal->creer) {
|
||||
$object->line_down(GETPOST('rowid'));
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id . '#' . GETPOST('rowid'));
|
||||
exit();
|
||||
} else if ($action == 'update_extras') {
|
||||
else if ($action == 'update_extras') {
|
||||
// Fill array 'array_options' with data from update form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
|
||||
@ -43,24 +43,26 @@ print_titre($langs->trans('RelatedCommercialProposals'));
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td><?php echo $object->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->propale->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -72,7 +74,8 @@ foreach($linkedObjectBlock as $object)
|
||||
if ($user->rights->propale->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -93,8 +93,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->commande->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
|
||||
@ -112,6 +113,8 @@ if (empty($reshook))
|
||||
|
||||
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_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Action clone object
|
||||
|
||||
@ -40,24 +40,26 @@ print_titre($langs->trans('RelatedCustomerOrders'));
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $object->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->commande->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -69,7 +71,8 @@ foreach($linkedObjectBlock as $object)
|
||||
if ($user->rights->commande->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -108,6 +108,8 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$hookmanager->initHooks(array('invoicecard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->facture->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -120,7 +122,11 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_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
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
|
||||
@ -1644,54 +1650,6 @@ if (empty($reshook))
|
||||
exit();
|
||||
}
|
||||
|
||||
// Modify line position (up)
|
||||
else if ($action == 'up' && $user->rights->facture->creer) {
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$object->line_up($_GET ['rowid']);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
||||
exit();
|
||||
} // Modify line position (down)
|
||||
else if ($action == 'down' && $user->rights->facture->creer) {
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$object->line_down($_GET ['rowid']);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
if (! empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '#' . $_GET ['rowid']);
|
||||
exit();
|
||||
}
|
||||
|
||||
// Link invoice to order
|
||||
if (GETPOST('linkedOrder')) {
|
||||
$object->fetch($id);
|
||||
|
||||
@ -39,24 +39,26 @@ print_titre($langs->trans("RelatedCustomerInvoices"));
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $object->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo $objectlink->ref_client; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->facture->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -67,7 +69,8 @@ foreach($linkedObjectBlock as $object)
|
||||
if ($user->rights->facture->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -90,6 +90,7 @@ $extrafieldsline = new ExtraFields($db);
|
||||
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
|
||||
$permissionnote=$user->rights->contrat->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->contrat->creer; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -98,6 +99,8 @@ $permissionnote=$user->rights->contrat->creer; // Used by the include of actions
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
if ($action == 'confirm_active' && $confirm == 'yes' && $user->rights->contrat->activer)
|
||||
{
|
||||
$result = $object->active_line($user, GETPOST('ligne'), GETPOST('date'), GETPOST('dateend'), GETPOST('comment'));
|
||||
|
||||
@ -34,19 +34,21 @@ print_titre($langs->trans('RelatedContracts'));
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$object->fetch_lines();
|
||||
$objectlink->fetch_lines();
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date_contrat,'day'); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date_contrat,'day'); ?></td>
|
||||
<td align="right"> </td>
|
||||
<td align="right"><?php echo $object->getLibStatut(6); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(6); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
36
htdocs/core/actions_dellink.inc.php
Normal file
36
htdocs/core/actions_dellink.inc.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/actions_dellink.inc.php
|
||||
* \brief Code for actions on deleting link between elements
|
||||
*/
|
||||
|
||||
|
||||
// $action must be defined
|
||||
// $object must be defined
|
||||
// $permissiondellink must be defined
|
||||
|
||||
$dellinkid = GETPOST('dellinkid','int');
|
||||
|
||||
// Set public note
|
||||
if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $dellinkid > 0)
|
||||
{
|
||||
$result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid);
|
||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||
}
|
||||
@ -2166,7 +2166,7 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
// Links between objects are stored in table element_element
|
||||
$sql = 'SELECT fk_source, sourcetype, fk_target, targettype';
|
||||
$sql = 'SELECT rowid, fk_source, sourcetype, fk_target, targettype';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_element';
|
||||
$sql.= " WHERE ";
|
||||
if ($justsource || $justtarget)
|
||||
@ -2201,11 +2201,11 @@ abstract class CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj->fk_source == $sourceid)
|
||||
{
|
||||
$this->linkedObjectsIds[$obj->targettype][]=$obj->fk_target;
|
||||
$this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target;
|
||||
}
|
||||
if ($obj->fk_target == $targetid)
|
||||
{
|
||||
$this->linkedObjectsIds[$obj->sourcetype][]=$obj->fk_source;
|
||||
$this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
@ -2260,16 +2260,15 @@ abstract class CommonObject
|
||||
$classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur';
|
||||
}
|
||||
|
||||
// Here $module, $classfile and $classname are set
|
||||
if ($conf->$module->enabled && (($element != $this->element) || $alsosametype))
|
||||
{
|
||||
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
|
||||
|
||||
$num=count($objectids);
|
||||
|
||||
for ($i=0;$i<$num;$i++)
|
||||
foreach($objectids as $i => $objectid); // $i is rowid into llx_element_element
|
||||
{
|
||||
$object = new $classname($this->db);
|
||||
$ret = $object->fetch($objectids[$i]);
|
||||
$ret = $object->fetch($objectid);
|
||||
if ($ret >= 0)
|
||||
{
|
||||
$this->linkedObjects[$objecttype][$i] = $object;
|
||||
@ -2338,10 +2337,11 @@ abstract class CommonObject
|
||||
* @param string $sourcetype Object source type
|
||||
* @param int $targetid Object target id
|
||||
* @param string $targettype Object target type
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @param int $rowid Row id of line to delete. If defined, other parameters are not used.
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @see add_object_linked, updateObjectLinked, fetchObjectLinked
|
||||
*/
|
||||
function deleteObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='')
|
||||
function deleteObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='', $rowid='')
|
||||
{
|
||||
$deletesource=false;
|
||||
$deletetarget=false;
|
||||
@ -2356,21 +2356,28 @@ abstract class CommonObject
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_element";
|
||||
$sql.= " WHERE";
|
||||
if ($deletesource)
|
||||
if ($rowid > 0)
|
||||
{
|
||||
$sql.= " fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."'";
|
||||
$sql.= " AND fk_target = ".$this->id." AND targettype = '".$this->element."'";
|
||||
}
|
||||
else if ($deletetarget)
|
||||
{
|
||||
$sql.= " fk_target = ".$targetid." AND targettype = '".$targettype."'";
|
||||
$sql.= " AND fk_source = ".$this->id." AND sourcetype = '".$this->element."'";
|
||||
$sql.=" rowid = ".$rowid;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " (fk_source = ".$this->id." AND sourcetype = '".$this->element."')";
|
||||
$sql.= " OR";
|
||||
$sql.= " (fk_target = ".$this->id." AND targettype = '".$this->element."')";
|
||||
if ($deletesource)
|
||||
{
|
||||
$sql.= " fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."'";
|
||||
$sql.= " AND fk_target = ".$this->id." AND targettype = '".$this->element."'";
|
||||
}
|
||||
else if ($deletetarget)
|
||||
{
|
||||
$sql.= " fk_target = ".$targetid." AND targettype = '".$targettype."'";
|
||||
$sql.= " AND fk_source = ".$this->id." AND sourcetype = '".$this->element."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " (fk_source = ".$this->id." AND sourcetype = '".$this->element."')";
|
||||
$sql.= " OR";
|
||||
$sql.= " (fk_target = ".$this->id." AND targettype = '".$this->element."')";
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
|
||||
@ -2381,6 +2388,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->errors[]=$this->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +82,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('expeditioncard','globalcard'));
|
||||
|
||||
$permissiondellink=$user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -114,6 +117,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
@ -39,24 +39,26 @@ print_titre($langs->trans('RelatedShippings'));
|
||||
<td align="center"><?php echo $langs->trans("DateDeliveryPlanned"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date_creation,'day'); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date_delivery,'day'); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date_creation,'day'); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date_delivery,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->expedition->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -68,7 +70,8 @@ foreach($linkedObjectBlock as $object)
|
||||
if ($user->rights->expedition->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -34,17 +34,19 @@ print_titre($langs->trans('RelatedInterventions'));
|
||||
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
|
||||
<td><?php echo $object->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->datev,'day'); ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->datev,'day'); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@ -117,6 +117,7 @@ else if (! empty($socid) && $socid > 0)
|
||||
}
|
||||
|
||||
$permissionnote=$user->rights->fournisseur->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->fournisseur->commande->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit=$user->rights->fournisseur->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
@ -134,6 +135,8 @@ if (empty($reshook))
|
||||
|
||||
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_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
|
||||
|
||||
@ -37,23 +37,25 @@ print_titre($langs->trans('RelatedSupplierOrders'));
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><a href="<?php echo DOL_URL_ROOT.'/fourn/commande/card.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowOrder"),"order").' '.$object->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td><a href="<?php echo DOL_URL_ROOT.'/fourn/commande/card.php?id='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowOrder"),"order").' '.$objectlink->ref; ?></a></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->fournisseur->commande->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -65,7 +67,8 @@ foreach($linkedObjectBlock as $object)
|
||||
if ($user->rights->fournisseur->commande->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -87,6 +87,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
$permissionnote=$user->rights->fournisseur->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->fournisseur->facture->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit=$user->rights->fournisseur->facture->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
@ -104,6 +105,8 @@ if (empty($reshook))
|
||||
|
||||
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_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Action clone object
|
||||
|
||||
@ -40,24 +40,26 @@ print_titre($langs->trans("RelatedSupplierInvoices"));
|
||||
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<?php
|
||||
$total=0;
|
||||
$var=true;
|
||||
foreach($linkedObjectBlock as $object)
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
$var=!$var;
|
||||
?>
|
||||
<tr <?php echo $bc[$var]; ?> >
|
||||
<td><a href="<?php echo DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$object->id ?>"><?php echo img_object($langs->trans("ShowBill"),"bill").' '.$object->ref; ?></a></td>
|
||||
<td align="left"><?php echo $object->ref_supplier; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($object->date,'day'); ?></td>
|
||||
<td><a href="<?php echo DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objectlink->id ?>"><?php echo img_object($langs->trans("ShowBill"),"bill").' '.$objectlink->ref; ?></a></td>
|
||||
<td align="left"><?php echo $objectlink->ref_supplier; ?></td>
|
||||
<td align="center"><?php echo dol_print_date($objectlink->date,'day'); ?></td>
|
||||
<td align="right"><?php
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
$total = $total + $object->total_ht;
|
||||
echo price($object->total_ht);
|
||||
$total = $total + $objectlink->total_ht;
|
||||
echo price($objectlink->total_ht);
|
||||
} ?></td>
|
||||
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||
<td align="right"><?php echo $objectlink->getLibStatut(3); ?></td>
|
||||
<td align="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_delete($langs->transnoentitiesnoconv("RemoveLink")); ?></a></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
@ -68,7 +70,8 @@ foreach($linkedObjectBlock as $object)
|
||||
if ($user->rights->fournisseur->facture->lire) {
|
||||
echo price($total);
|
||||
} ?></td>
|
||||
<td> </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ ReCalculate=Recalculate
|
||||
Mode1=Method 1
|
||||
Mode2=Method 2
|
||||
CalculationRuleDesc=To calculate total VAT, there is two methods:<br>Method 1 is rounding vat on each line, then summing them.<br>Method 2 is summing all vat on each line, then rounding result.<br>Final result may differs from few cents. Default mode is mode <b>%s</b>.
|
||||
CalculationRuleDescSupplier=according to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier.
|
||||
CalculationRuleDescSupplier=According to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier.
|
||||
TurnoverPerProductInCommitmentAccountingNotRelevant=Turnover report per product, when using a <b>cash accountancy</b> mode is not relevant. This report is only available when using <b>engagement accountancy</b> mode (see setup of accountancy module).
|
||||
CalculationMode=Calculation mode
|
||||
AccountancyJournal=Accountancy code journal
|
||||
|
||||
Loading…
Reference in New Issue
Block a user