Skip to content

Commit

Permalink
Drop dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed May 23, 2024
1 parent c86e6db commit 7422728
Showing 1 changed file with 0 additions and 91 deletions.
91 changes: 0 additions & 91 deletions lib/GaletteObjectsLend/Entity/LendObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,97 +369,6 @@ public function store(): bool
}
}

/**
* Get object rent status and rent user information.
*
* @param LendObject $object Object instance to be modified
*
* @return void
*/
public static function getStatusForObject(LendObject $object): void
{
global $zdb;

// Statut
$select_rent = $zdb->select(LEND_PREFIX . LendRent::TABLE)
->join(
PREFIX_DB . LEND_PREFIX . LendStatus::TABLE,
PREFIX_DB . LEND_PREFIX . LendRent::TABLE . '.status_id = ' .
PREFIX_DB . LEND_PREFIX . LendStatus::TABLE . '.status_id'
)
->join(
PREFIX_DB . Adherent::TABLE,
PREFIX_DB . Adherent::TABLE . '.id_adh = ' . PREFIX_DB . LEND_PREFIX . LendRent::TABLE . '.adherent_id',
'*',
'left'
)
->where(array('object_id' => $object->object_id))
->limit(1)
->offset(0)
->order('date_begin desc');

$results = $zdb->execute($select_rent);
if ($results->count() == 1) {
$rent = $results->current();
$object->date_begin = $rent->date_begin;
$object->date_forecast = $rent->date_forecast;
$object->date_end = $rent->date_end;
$object->status_text = $rent->status_text;
$object->comments = $rent->comments;
$object->in_stock = $rent->in_stock == '1' ? true : false;
$object->nom_adh = $rent->nom_adh;
$object->prenom_adh = $rent->prenom_adh;
$object->email_adh = $rent->email_adh;
$object->id_adh = $rent->id_adh;
} else {
$object->in_stock = true;
}
}

/**
* Get requested objects
*
* @param array<int> $ids Objects to retrieve IDs
*
* @return LendObject[]
*/
public static function getMoreObjectsByIds(array $ids): array
{
global $zdb, $plugins;

$myids = array();
foreach ($ids as $id) {
if (is_numeric($id)) {
$myids[] = $id;
}
}

try {
$select = $zdb->select(LEND_PREFIX . self::TABLE)
->where(array(self::PK => $myids));

$results = array();

$rows = $zdb->execute($select);
foreach ($rows as $r) {
$o = new self($zdb, $plugins, $r);

self::getStatusForObject($o);

$results[] = $o;
}

return $results;
} catch (\Exception $e) {
Analog::log(
'Something went wrong :\'( | ' . $e->getMessage() . "\n" .
$e->getTraceAsString(),
Analog::ERROR
);
throw $e;
}
}

/**
* Global getter method
*
Expand Down

0 comments on commit 7422728

Please sign in to comment.