Skip to content

Commit

Permalink
Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into 6.0
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/contrat/card.php
  • Loading branch information
eldy committed Mar 22, 2018
2 parents 04199c2 + 7d5c3a5 commit ed2d9f1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions htdocs/contrat/card.php
Expand Up @@ -908,11 +908,27 @@
setEventMessages($object->error, $object->errors, 'errors');
}

$old_ref = $object->ref;

$result = $object->setValueFrom('ref', GETPOST('ref','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$action = 'editref';
} else {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$old_filedir = $conf->contrat->dir_output . '/' . dol_sanitizeFileName($old_ref);
$new_filedir = $conf->contrat->dir_output . '/' . dol_sanitizeFileName($object->ref);

$files = dol_dir_list($old_filedir);
if (!empty($files))
{
if (!is_dir($new_filedir)) dol_mkdir($new_filedir);
foreach ($files as $file)
{
dol_move($file['fullname'], $new_filedir.'/'.$file['name']);
}
}

header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit;
}
Expand Down

0 comments on commit ed2d9f1

Please sign in to comment.